L3MON4D3 / LuaSnip

Snippet Engine for Neovim written in Lua.
Apache License 2.0
3.31k stars 234 forks source link

Failed to Install L3MON4D3/LuaSnip #886

Open sarunmrzn opened 1 year ago

sarunmrzn commented 1 year ago
    -- LSP
    use({
        "VonHeikemen/lsp-zero.nvim",
        branch = "v2.x",
        requires = {
            { "neovim/nvim-lspconfig" },
            { "williamboman/mason.nvim" },
            { "williamboman/mason-lspconfig.nvim" },
            -- Autocompletion
            { "hrsh7th/nvim-cmp" }, -- Required
            { "hrsh7th/cmp-buffer" }, -- buffer completions
            { "hrsh7th/cmp-path" },
            { "saadparwaiz1/cmp_luasnip" },
            { "hrsh7th/cmp-nvim-lsp" },
            { "hrsh7th/cmp-nvim-lua" },
            -- Snippets
            { "L3MON4D3/LuaSnip", run = "make install_jsregexp" }, -- Required
            { "rafamadriz/friendly-snippets" },
            { "jose-elias-alvarez/null-ls.nvim" },
            { "jose-elias-alvarez/typescript.nvim" },
        },
    })

whenever i try to run with 'make install_jsregexp' it fails btu when i remove it, it installs and snippets do work, but the problem is the auto capitalization fails when jsregexp doesn't get installed.

this works fine on my mac but on PopOS it keeps throwing this error, any fix for fix?

L3MON4D3 commented 1 year ago

I'm guessing neovims luajit is not installed system-wide, you'll have to figure out which package provides it, and install that package

sarunmrzn commented 1 year ago

image i tried uninstalling and installing again with luajit installed, it still says error when installing

L3MON4D3 commented 1 year ago

You'll need libluajit-5.1.so, or something similar, could you look for that?

sarunmrzn commented 1 year ago

image it says its already installed

L3MON4D3 commented 1 year ago

Ah, okay, then you'll have to modify the -l we use, manually call make LUA_LDLIBS=-lluajit5.1-2 install_jsregexp in luasnips directory

sarunmrzn commented 1 year ago

image still doesnt work, i tried make LUA_LDLIBS=-lluajit5.1-2 install_jsregexp and make LUA_LDLIBS=-llibluajit5.1-2 install_jsregexp both.

the directory is /home/sarun/.local/share/nvim/site/pack/packer/start/LuaSnip right?

L3MON4D3 commented 1 year ago

Ah, omit the lib in -llibluajit5.1-2, -l always prepends it when searching for the actual file Yeah, that looks like the correct directory :+1:

sarunmrzn commented 1 year ago

yep it doesnt work either, the second command i ran is that, and next i added `lib' which also didnt work, any other solutions?

L3MON4D3 commented 1 year ago

Oh, my bad, ofc Can you list the files provided by the libluajit5.1-2-package? I guess the .so-file is called something different

Majixed commented 1 year ago

Hi, just encountered this same issue and I found libluajit-5.1.so in /usr/lib/x86_64-linux-gnu. How can I tell the compiler to use this path?

Never mind, I had installed the libluajit-5.1-dev package a few minutes before posting this and I think this is what solved the problem, didn't need to edit any paths.

L3MON4D3 commented 1 year ago

NiceπŸ‘ŒπŸ‘Œ

Majixed commented 1 year ago

Perhaps this could be added to the README for any people who might encounter this issue in the future?

L3MON4D3 commented 1 year ago

I'll pin this issue for now, we should switch to providing the static library from the get-go (@leiserfg you were right :sweat_smile:)

kmarius commented 1 year ago

The LDLIBS variable should be empty because we don't actually need to link against libluajit (or liblua5.1) when building the module. Only the headers from either luajit or lua5.1 are needed.

Edit: clarification

L3MON4D3 commented 1 year ago

Oh dammit :facepalm: But why not? How is luaL_newlib resolved?

sarunmrzn commented 1 year ago

I'll pin this issue for now, we should switch to providing the static library from the get-go (@leiserfg you were right sweat_smile)

This would be so helpful.

By the way, I distro hopped to Arch to get this feature working πŸ’€

kmarius commented 1 year ago

@L3MON4D3 The nvim binary is compiled so that all symbols (including those from shared libraries, i.e. libluajit) are exported. luaL_newlib resolves to whatever library nvim is linked against (which could also be lua5.1). See also man ld and search for export-dynamic.

Unsetting LDLIBS will probably break the MacOS build again. I had to see and check how luarocks does it.

L3MON4D3 commented 1 year ago

Ahh okay, that's pretty cool Thank you! I'll upload some patches and ask the MacOS-users in the other thread to test it :D