Closed alexanderjeurissen closed 2 weeks ago
Hey :wave:
uv_dlopen: no error
usually indicates that luarocks failed to detect your system architecture and has installed the parser for the wrong one.
I should add a troubleshooting section to the rocks(-treesitter).nvim readmes, you are not the first person to encounter this.
You should be able to work around this as follows:
:Rocks prune <parser>
)vim.g.rocks_nvim
config:vim.g.rocks_nvim = {
-- ...
luarocks_config = {
arch = "macosx-aarch64" , -- or arch = "macosx-x86_64" , depending on your architecture
},
}
If this solves the issue for you, please leave this open. I'll close it when I've added the troubleshooting section.
:thinking: It might also be possible for rocks.nvim to use vim.uv
to detect the architecture and set that config automatically.
Hi @mrcjkb I can confirm that this solves the issue.
I think it would be a good enhancement indeed to get this from vim.uv
and to allow the user to override it if they need/desire to.
I created a rough POC to determine the arch using vim.uv
:
-- Function to determine architecture
local function get_arch(sysname, machine)
local arch_map = {
Darwin = {
arm64 = "macosx-aarch64",
x86_64 = "macosx-x86_64"
},
Linux = {
x86_64 = "linux-x86_64",
arm64 = "linux-aarch64",
aarch64 = "linux-aarch64"
},
Windows_NT = {
x86_64 = "win32-x86_64",
arm64 = "win32-arm64",
[""] = "win32-arm64" -- catch-all for other ARM variants
}
}
return arch_map[sysname] and arch_map[sysname][machine]
end
-- Get the system architecture
local uname = vim.uv.os_uname()
local arch = get_arch(uname.sysname, uname.machine)
Thanks, that's very helpful 😄 🙏 We can also use this to disable the binary servers for unsupported architectures:
@mrcjkb Hi wanted to check back in,
Tree-sitter parsers are installing smoothly now,
However there is one tree sitter parser that I encountered the original error with recently: tree-sitter-norg
I'm not sure what is different about that parser but somehow it seems that the arch
is not respected, strangely enough the tree-sitter-norg-meta
parser does get installed correctly..
vim.treesitter: require("vim.treesitter.health").check()
- Nvim runtime ABI version: 14
- ERROR Parser "norg" failed to load (path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-norg/parser/norg.so): ...3a714/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'norg': uv_dlopen: no error
- OK Parser: javascript ABI: 14, path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-javascript/parser/javascript.so
- OK Parser: go ABI: 14, path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-go/parser/go.so
- OK Parser: json ABI: 14, path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-json/parser/json.so
- OK Parser: lua ABI: 14, path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-lua/parser/lua.so
- OK Parser: toml ABI: 14, path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-toml/parser/toml.so
- OK Parser: typescript ABI: 14, path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-typescript/parser/typescript.so
- OK Parser: xml ABI: 14, path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-xml/parser/xml.so
- OK Parser: tsx ABI: 14, path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-tsx/parser/tsx.so
- OK Parser: tmux ABI: 14, path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-tmux/parser/tmux.so
- OK Parser: sql ABI: 14, path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-sql/parser/sql.so
- OK Parser: scss ABI: 13, path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-scss/parser/scss.so
- OK Parser: norg_meta ABI: 14, path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-norg-meta/parser/norg_meta.so
- OK Parser: graphql ABI: 13, path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-graphql/parser/graphql.so
- OK Parser: gitcommit ABI: 14, path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-gitcommit/parser/gitcommit.so
- OK Parser: ruby ABI: 14, path: /Users/alexander/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-ruby/parser/ruby.so
@alexanderjeurissen tree-sitter-norg currently has issues on macOS (either M1 only or both M1 and x86_64; I'm not sure).
See also: https://github.com/nvim-neorg/tree-sitter-norg/issues/67
You might have to install it manually for now.
Description: An error is encountered when opening files with various Tree-sitter parsers using
rocks.nvim
. The error message suggests a problem with loading the Tree-sitter parsers, indicating a failure to load the parsers for multiple languages.Minimal Configuration:
rocks.toml:
init.lua:
Error Message:
Debug Steps Taken:
:lua print(vim.inspect(package.path))
"/opt/homebrew/Cellar/luarocks/3.9.1/share/lua/5.1/?.lua;/opt/homebrew/share/lua/5.1/?.lua;/opt/homebrew/share/lua/5.1/?/init.lua;/opt/homebrew/lib/lua/5.1/?.lua;/opt/homebrew/lib/lua/5.1/?/init.lua;./?.lua;./?/init.lua;/Users/alexander/.luarocks/share/lua/5.1/?.lua;/Users/alexander/.luarocks/share/lua/5.1/?/init.lua;/Users/alexander/.local/share/nvim/rocks/share/lua/5.1/?.lua;/Users/alexander/.local/share/nvim/rocks/share/lua/5.1/?/init.lua;/Users/alexander/.local/share/nvim/rocks/share/lua/5.1/init.lua"
:lua print(vim.inspect(package.cpath))
"/opt/homebrew/lib/lua/5.1/?.so;/opt/homebrew/lib/lua/5.1/loadall.so;./?.so;/Users/alexander/.luarocks/lib/lua/5.1/?.so;/Users/alexander/.local/share/nvim/rocks/lib/lua/5.1/?.so;/Users/alexander/.local/share/nvim/rocks/lib64/lua/5.1/?.so;/Users/alexander/.local/share/nvim/rocks/lib/lua/5.1/?.dylib;/Users/alexander/.local/share/nvim/rocks/lib64/lua/5.1/?.dylib;/Users/alexander/.local/share/nvim/rocks/lib/lua/5.1/?.dll;/Users/alexander/.local/share/nvim/rocks/lib64/lua/5.1/?.dll"
Additional Notes:
System Information: