L3MON4D3 / LuaSnip

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

jsregexp installation failing on macos + nix-darwin #925

Closed gwarf closed 1 year ago

gwarf commented 1 year ago

Hello, I'm using nix-darwin on macos, I run a LazyVim-based neovim setup, and jsrexexp installation is failing.

NOTE: jsregexp is optional, so not a big deal if it fails to build
git submodule init
git submodule update
make INCLUDE_DIR=-I/Users/baptiste/.local/share/nvim/lazy/LuaSnip/deps/lua51_include/ LDLIBS="-lluajit-5.1.2 -L/etc/profiles/per-user/baptiste/lib/" -C deps/jsregexp
make[1]: Entering directory '/Users/baptiste/.local/share/nvim/lazy/LuaSnip/deps/jsregexp'
gcc -shared jsregexp.o cutils.o libregexp.o libunicode.o -lluajit-5.1.2 -L/etc/profiles/per-user/baptiste/lib/ -o jsregexp.so
ld: warning: directory not found for option '-L/etc/profiles/per-user/baptiste/lib/'
ld: library not found for -lluajit-5.1.2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Makefile:17: jsregexp.so] Error 1
make: *** [Makefile:53: jsregexp] Error 2
make[1]: Leaving directory '/Users/baptiste/.local/share/nvim/lazy/LuaSnip/deps/jsregexp'

From what I saw when looking at the makefile, this quite specific configuration is not taken into account.

L3MON4D3 commented 1 year ago

Could you try the branch make_jsregexp_simplify?

gwarf commented 1 year ago

Just did, it fails differently:

NOTE: jsregexp is optional, so not a big deal if it fails to build
git submodule init
git submodule update
make INCLUDE_DIR=-I/Users/baptiste/.local/share/nvim/lazy/LuaSnip/deps/lua51_include/ LDLIBS="-bundle -undefined dynamic_lookup -all_load" -C deps/jsregexp
make[1]: Entering directory '/Users/baptiste/.local/share/nvim/lazy/LuaSnip/deps/jsregexp'
gcc -shared jsregexp.o cutils.o libregexp.o libunicode.o -bundle -undefined dynamic_lookup -all_load -o jsregexp.so
clang: error: invalid argument '-bundle' not allowed with '-dynamiclib'
make[1]: *** [Makefile:17: jsregexp.so] Error 1
make: *** [Makefile:40: jsregexp] Error 2
make[1]: Leaving directory '/Users/baptiste/.local/share/nvim/lazy/LuaSnip/deps/jsregexp'

AFAIU, the mentioned gcc and clang are the one provided by the macos system.

L3MON4D3 commented 1 year ago

Ah, okay I think the issue is that both -shared and -bundle are passed. I updated the branch, could you try again?

gwarf commented 1 year ago

Looks good, thanks! Screenshot 2023-06-16 at 11 40 09

gwarf commented 1 year ago

Screenshot 2023-06-16 at 11 41 35

L3MON4D3 commented 1 year ago

Nice!

L3MON4D3 commented 1 year ago

Ookay, the fix is on master, closing this

gwarf commented 1 year ago

I confirm building is working OK with master, thanks a lot for having fixed this that quickly, should have reported this before ;)

L3MON4D3 commented 1 year ago

Oh for sure :D TBH I'm in luck that you reported your issue today, I was looking for testers of that patch, and getting people to do something after their issue is resolved seems hard :P