nvim-neorocks / rocks.nvim

🌒 Neovim plugin management inspired by Cargo, powered by luarocks
GNU General Public License v3.0
677 stars 13 forks source link

doesn't work on systems without libgcc_s.so.1 #342

Closed ghost closed 1 month ago

ghost commented 4 months ago

On Linux distributions without libgcc, such as Chimera Linux which uses libunwind instead, nvim spits the following error when opening nvim.

Error executing Lua callback: ...<user>/.local/share/nvim/rocks/share/lua/5.1/nio/tasks.lua:100: Async task failed without callback: The coroutine failed with this message:
error loading module 'toml_edit' from file '/home/<user>/.local/share/nvim/rocks/lib/lua/5.1/toml_edit.so':
        Error loading shared library libgcc_s.so.1: No such file or directory (needed by /home/<user>/.local/share/nvim/rocks/lib/lua/5.1/toml_edit.so)
stack traceback:
        [C]: at 0x7457690eac80
        [C]: in function 'require'
        ...share/nvim/rocks/share/lua/5.1/rocks/config/internal.lua:55: in function 'get_rocks_toml'
        ...share/nvim/rocks/share/lua/5.1/rocks/config/internal.lua:75: in function 'get_user_rocks'
        .../luarocks/rocks-5.1/rocks.nvim/2.28.0-1/plugin/rocks.lua:57: in main chunk

It seems might be an issue with the toml-edit dependency, but I am unsure. Is there anything that can be done? Or is the issue with luarocks linking libgcc?

ghost commented 4 months ago

Upon some sniffing, it is probably because it pulls the precompiled toml-edit from here, perhaps a way to manually force plugins to be compiled, like the README says is done on some architectures would solve this

mrcjkb commented 4 months ago

perhaps a way to manually force plugins to be compiled, like the README says is done on some architectures would solve this

Yep, that sounds like a good idea. We could also try to automate this based on the presence of the libraries.

As a workaround, you could follow the manual installation instructions without specifying the rocks-binaries server.

ghost commented 4 months ago

I worked around it by grabbing the installer script, and manually removing the server. After that, fzy failed to compile as it called gcc, which is not present (why not just call cc instead), to work around this, I ran env CC=/usr/bin/clang LD=/usr/bin/ld.lld nvim -u NORC -c "source /home/<user>/installer.lua" And the install worked. Can I set these envs for rocks.nvim somewhere?

There are however, still a few errors. Checking the logs for Rocks I see this error:

ERROR | 2024-05-19 11:27:42 | .../.local/share/nvim/rocks/share/lua/5.1/rocks/adapter.lua:53 | Failed to remove symlink: /home/<user>/.local/share/nvim/rocks/rocks_rtp/parser (ENOENT: no such file or directory: /home/<user>/.local/share/nvim/rocks/rocks_rtp/parser)

but rocks seems to work fine. Another potentially related issue is with nvim-treesitter, I seem to be unable to install any parsers. I run :TSInstall <parser>, but when running TSInstallInfo, they are listed as not installed, moreover, some parsers, like lua, give the following error:

nvim-treesitter[lua]: Failed to execute the following command:
{                                                                                                                      
  cmd = "mv",                                                                                                          
  opts = {                                                                                                             
    args = { "-f", "tree-sitter-lua-tmp/tree-sitter-lua-master", "tree-sitter-lua" },                                  
    cwd = "/home/<user>/.local/share/nvim",                                                                          
    stdio = {                                                                                                          
      [2] = <userdata 1>,                                                                                              
      [3] = <userdata 2>                                                                                               
    }                                                                                                                  
  }                                                                                                                    
}                                                                                                                      
mv: rename tree-sitter-lua-tmp/tree-sitter-lua-master to tree-sitter-lua: No such file or directory                    

This setup is very hacky, but if you have any ideas, help would be appreciated.

mrcjkb commented 4 months ago

Can I set these envs for rocks.nvim somewhere?

Not as of today. These are luarocks config variables. I have a draft PR to make it possible to override the luarocks config:

There are however, still a few errors. Checking the logs for Rocks I see this error:

The log message is harmless, but I've opened #345.

I seem to be unable to install any parsers. I run :TSInstall , but when running TSInstallInfo, they are listed as not installed,

This is because nvim-treesitter uses a hack to determine where it is installed. This breaks with the way luarocks packages are installed. Also, the nvim-treesitter luarocks package is compatible with neovim 0.9.2, not 0.10.0.

You have a few options:

  1. Install nvim-treesitter with rocks-git
  2. Install the luarocks tree-sitter parsers directly (:Rocks install tree-sitter-{lang} where {lang} is the parser language) and set up highlighting manually with vim.treesitter.start()
  3. Use rocks-treesitter.nvim

See also: https://github.com/nvim-neorocks/rocks.nvim/#deciduous_tree-enhanced-tree-sitter-support

ghost commented 4 months ago

Thanks, got rocks set all up now, seems like the CC and LD variable for luarocks works just fine. Sorry for filling this issue with unrelated questions

TarunDaCoder commented 3 months ago

Hey, I am receiving a similar type of error with rocks.nvim (on ArchWSL)

Error executing vim.schedule lua callback: ...arun/.local/share/nvim/rocks/share/lua/5.1/nio/tasks.lua:100: Async task failed without callback: The coroutine failed with th
is message:
...tarun/.local/share/nvim/rocks/share/lua/5.1/nio/init.lua:119: The coroutine failed with this message: Task was cancelled
stack traceback:
        [C]: in function 'error'
        ...tarun/.local/share/nvim/rocks/share/lua/5.1/nio/init.lua:119: in function 'gather'
        .../luarocks/rocks-5.1/rocks.nvim/2.30.0-1/plugin/rocks.lua:46: in function <.../luarocks/rocks-5.1/rocks.nvim/2.30.0-1/plugin/rocks.lua:44>
stack traceback:
        [C]: in function 'error'
        ...arun/.local/share/nvim/rocks/share/lua/5.1/nio/tasks.lua:100: in function 'close_task'
        ...arun/.local/share/nvim/rocks/share/lua/5.1/nio/tasks.lua:122: in function 'cb'
        ...arun/.local/share/nvim/rocks/share/lua/5.1/nio/tasks.lua:188: in function 'waiter'
        ...un/.local/share/nvim/rocks/share/lua/5.1/nio/control.lua:57: in function 'set'
        ...tarun/.local/share/nvim/rocks/share/lua/5.1/nio/init.lua:105: in function 'cb'
        ...arun/.local/share/nvim/rocks/share/lua/5.1/nio/tasks.lua:98: in function 'close_task'
        ...arun/.local/share/nvim/rocks/share/lua/5.1/nio/tasks.lua:122: in function 'cb'
        ...arun/.local/share/nvim/rocks/share/lua/5.1/nio/tasks.lua:188: in function 'waiter'
        ...un/.local/share/nvim/rocks/share/lua/5.1/nio/control.lua:116: in function 'wake'
        ...un/.local/share/nvim/rocks/share/lua/5.1/nio/control.lua:137: in function 'set_error'
        ...un/.local/share/nvim/rocks/rocks_rtp/lua/rocks/state.lua:37: in function 'on_exit'
        ....local/share/nvim/rocks/rocks_rtp/lua/rocks/luarocks.lua:68: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>
mrcjkb commented 3 months ago

@TarunDaCoder that's a different error, unrelated to this issue.

Are you able to reproduce it with the latest rocks.nvim version? If so, could you please open a separate issue and include your :Rocks log?

mrcjkb commented 3 months ago

@TarunDaCoder You're probably running into https://github.com/nvim-neorocks/rocks.nvim/issues/377

I'll look into it later today.