Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package.cpath update init.lua snippet is not platform independent #269

Closed
zackerydev opened this issue Apr 12, 2024 · 6 comments · Fixed by #271
Closed

package.cpath update init.lua snippet is not platform independent #269

zackerydev opened this issue Apr 12, 2024 · 6 comments · Fixed by #271
Assignees
Labels
bug Something isn't working

Comments

@zackerydev
Copy link

Looks like something similar to this issue is happening in this library.

Thanks for all the great work on this.

#250

@mrcjkb
Copy link
Member

mrcjkb commented Apr 12, 2024

Hey 👋

rocks-treesitter doesn't use toml_edit directly. It uses the rocks.nvim API, which uses toml_edit.
Have you tried updating rocks.nvim to the latest version?

@zackerydev
Copy link
Author

@mrcjkb Yes - I have this in my rocks.toml

# This is your rocks.nvim plugins declaration file.
# Here is a small yet pretty detailed example on how to use it:
#
# [plugins]
# nvim-treesitter = "semver_version"  # e.g. "1.0.0"

# List of non-Neovim rocks.
# This includes things like `toml` or other lua packages.
[rocks]

# List of Neovim plugins to install alongside their versions.
# If the plugin name contains a dot then you must add quotes to the key name!
[plugins]
"rocks.nvim" = "2.21.1" # rocks.nvim can also manage itself :D
"telescope.nvim" = "scm"
github-nvim-theme = "1.0.1"
"mason.nvim" = "1.10.0"
"mason-lspconfig.nvim" = "1.27.0"
cmp-nvim-lsp = "scm"
cmp-buffer = "scm"
cmp-path = "scm"
nvim-cmp = "0.0.1"
"trouble.nvim" = "2.10.0"
"lualine.nvim" = "scm"
"glow.nvim" = "0.2.0"
nvim-comment = "scm"
"conform.nvim" = "5.6.0"
"gruvbox.nvim" = "2.0.0"
nvim-treesitter = "0.9.2"
neorg = "8.4.0"
toml-edit = "0.3.6"
"oil.nvim" = "2.7.0"
"rocks-treesitter.nvim" = "scm"

And I get this stack trace when booting up:

CleanShot 2024-04-12 at 11 17 52@2x

But only when installing this rocks-treesitter.nvim plugin.

@zackerydev
Copy link
Author

I did find a workaround by doing this:

cp /Users/zack.griesinger/.local/share/nvim/rocks/lib/lua/5.1/toml_edit.so /opt/homebrew/lib/lua/5.1/

This seems wrong though 🤔

@mrcjkb
Copy link
Member

mrcjkb commented Apr 12, 2024

Ahh, I see what the issue is.

The installer script gives you a snippet to add to your init.lua, which adds luarocks native libraries in the rocks.nvim install directory to the package.cpath.
On Darwin, it assumes those libraries have a .dylib extension. But in the case of toml_edit, it's .so, so lua can't find it.

As a hotfix, you can duplicate the path patterns for the cpath and set the extension to .so.

I'll create an issue to fix this.
We should probably update it to make the snippet itself platform independent, in case people use the same config on multiple systems.

Very strange that this only happens when rocks-treesitter is installed though 🤔

@mrcjkb
Copy link
Member

mrcjkb commented Apr 12, 2024

Transferring to rocks.nvim...

@mrcjkb mrcjkb changed the title Issue with TOML library package.cpath update init.lua snippet is not platform independent Apr 12, 2024
@mrcjkb mrcjkb transferred this issue from nvim-neorocks/rocks-treesitter.nvim Apr 12, 2024
@mrcjkb mrcjkb added the bug Something isn't working label Apr 12, 2024
@mrcjkb mrcjkb self-assigned this Apr 12, 2024
@zackerydev
Copy link
Author

If anyone else makes it here this is the hotfix I used thanks for the suggestion @mrcjkb

-- ...
local luarocks_cpath = {
  vim.fs.joinpath(rocks_config.rocks_path, 'lib', 'lua', '5.1', '?.so'),
  vim.fs.joinpath(rocks_config.rocks_path, 'lib64', 'lua', '5.1', '?.so'),
  vim.fs.joinpath(rocks_config.rocks_path, 'lib', 'lua', '5.1', '?.dylib'),
  vim.fs.joinpath(rocks_config.rocks_path, 'lib64', 'lua', '5.1', '?.dylib'),
}
-- ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants