Bug 257051 - editors/neovim: neovim-0.5.0 fails to link if luajit is not enabled
Summary: editors/neovim: neovim-0.5.0 fails to link if luajit is not enabled
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Adam Weinberger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-08 09:46 UTC by snafu
Modified: 2021-07-27 06:57 UTC (History)
3 users (show)

See Also:
linimon: maintainer-feedback? (adamw)


Attachments
Switch to luajit-openresty (2.77 KB, patch)
2021-07-21 22:01 UTC, Adam Weinberger
no flags Details | Diff
poudriere fail (359.68 KB, text/plain)
2021-07-27 06:57 UTC, Dave Cottlehuber
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description snafu 2021-07-08 09:46:36 UTC
While first looking similar to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251818 it seems to be different as I have build libluv without luajit.

Afaict it is related to rds parser which seems to be built against lua51 (statically and without option to change that) and the build trying to use lua52.

The relevant error messages seem to be:

ld: error: undefined symbol: luaL_register
>>> referenced by executor.c
>>>               lto.tmp:(nlua_enter.llvm.6927564360673786163)
>>> referenced by treesitter.c
>>>               lto.tmp:(tslua_init)
>>> referenced by treesitter.c
>>>               lto.tmp:(tslua_init)
>>> referenced 4 more times

ld: error: undefined symbol: lua_setfenv
>>> referenced by treesitter.c
>>>               lto.tmp:(push_tree)
>>> referenced by treesitter.c
>>>               lto.tmp:(parser_parse)
>>> referenced by treesitter.c
>>>               lto.tmp:(tree_root)
>>> referenced 11 more times

ld: error: undefined symbol: lua_objlen
>>> referenced by treesitter.c
>>>               lto.tmp:(parser_set_ranges)
>>> referenced by treesitter.c
>>>               lto.tmp:(parser_set_ranges)

ld: error: undefined symbol: lua_getfenv
>>> referenced by treesitter.c
>>>               lto.tmp:(tree_root)
>>> referenced by treesitter.c
>>>               lto.tmp:(node_field)
>>> referenced by treesitter.c
>>>               lto.tmp:(node_child)
>>> referenced 8 more times
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2021-07-09 12:00:57 UTC
^Triage: give complete Summary and assign.
Comment 2 Adam Weinberger freebsd_committer 2021-07-21 21:53:54 UTC
(Adding in luv's maintainer)

Sorry about the long silence, IRL happened.

Thanks for the sleuthing here. Simply switching neovim (and luv) to lua:51 isn't enough to fix the build.

lua51: error loading module 'mpack' from file './mpack.so':
        ./mpack.so: Undefined symbol "luaL_setfuncs"
stack traceback:
        [C]: ?
        [C]: in function 'require'
        ...eovim-0.5.0/src/nvim/generators/gen_api_dispatch.lua:1: in main chunk
        [C]: ?

lua51: error loading module 'mpack' from file './mpack.so':
        ./mpack.so: Undefined symbol "luaL_setfuncs"
stack traceback:
        [C]: ?
        [C]: in function 'require'
        ...ovim-0.5.0/src/nvim/generators/gen_api_ui_events.lua:1: in main chunk
        [C]: ?

I know this is a bit of a sledgehammer fix, but what if we dropped the lua option entirely and switched neovim (and luv) to luajit-openresty? It's a drop-in replacement, and the Openresty fork should work nearly everywhere that luajit doesn't. The only casualty of this would be riscv64.

Neovim pushes luajit pretty hard and seems to make no effort or guarantee of PUC lua compatibility. Is there a strong use case for PUC lua here?
Comment 3 Adam Weinberger freebsd_committer 2021-07-21 22:01:43 UTC
Created attachment 226597 [details]
Switch to luajit-openresty

I'm attaching a patch that removes the LUAJIT option (essentially disabling PUC lua support) and switches to luajit-openresty.
Comment 4 Dave Cottlehuber freebsd_committer 2021-07-27 06:57:07 UTC
Created attachment 226733 [details]
poudriere fail

thanks for the patch; this doesn't link yet on arm64 13.0-RELEASE against latest ports tree.


ld: error: /usr/local/lib/libluv.so: undefined reference to lua_absindex [--no-allow-shlib-undefined]
ld: error: /usr/local/lib/libluv.so: undefined reference to lua_callk [--no-allow-shlib-undefined]
ld: error: /usr/local/lib/libluv.so: undefined reference to lua_getglobal [--no-allow-shlib-undefined]
ld: error: /usr/local/lib/libluv.so: undefined reference to lua_pcallk [--no-allow-shlib-undefined]
ld: error: /usr/local/lib/libluv.so: undefined reference to lua_rawlen [--no-allow-shlib-undefined]
cc: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
*** Error code 1

full log attached.