LuaSnip icon indicating copy to clipboard operation
LuaSnip copied to clipboard

Failed to Install L3MON4D3/LuaSnip

Open sarunmrzn opened this issue 2 years ago β€’ 18 comments

	-- 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?

sarunmrzn avatar May 12 '23 12:05 sarunmrzn

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

L3MON4D3 avatar May 12 '23 13:05 L3MON4D3

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

sarunmrzn avatar May 15 '23 05:05 sarunmrzn

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

L3MON4D3 avatar May 15 '23 06:05 L3MON4D3

image it says its already installed

sarunmrzn avatar May 15 '23 06:05 sarunmrzn

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

L3MON4D3 avatar May 15 '23 06:05 L3MON4D3

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?

sarunmrzn avatar May 15 '23 06:05 sarunmrzn

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:

L3MON4D3 avatar May 15 '23 07:05 L3MON4D3

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

sarunmrzn avatar May 15 '23 08:05 sarunmrzn

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

L3MON4D3 avatar May 15 '23 14:05 L3MON4D3

~~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.

Majixed avatar May 23 '23 07:05 Majixed

NiceπŸ‘ŒπŸ‘Œ

L3MON4D3 avatar May 23 '23 08:05 L3MON4D3

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

Majixed avatar Jun 09 '23 07:06 Majixed

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:)

L3MON4D3 avatar Jun 09 '23 10:06 L3MON4D3

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

kmarius avatar Jun 10 '23 19:06 kmarius

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

L3MON4D3 avatar Jun 10 '23 21:06 L3MON4D3

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 πŸ’€

sarunmrzn avatar Jun 11 '23 03:06 sarunmrzn

@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.

kmarius avatar Jun 11 '23 06:06 kmarius

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

L3MON4D3 avatar Jun 11 '23 07:06 L3MON4D3