rkd77 / elinks

Fork of elinks
Other
335 stars 35 forks source link

undefined reference to `lua_strlen' with new lua versions #46

Open ovitters opened 4 years ago

ovitters commented 4 years ago

I'm trying to change the Mageia elinks package over to this fork. The compilation fails on the following:

/bin/ld: lib.o: in function `script_hook_pre_format_html':
/home/src/pkgs/elinks/BUILD/felinks-0.13.1/src/scripting/lua/hooks.c:147: undefined reference to `lua_strlen'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:41: elinks] Error 1

I googled for the problem, seems that the function in newer LUA versions is called lua_rawlen.

I found a commit whereby another project fixed the error using the following commit: https://github.com/ValyriaTear/ValyriaTear/commit/05f87f375a3ce8336c7b7a157cda49abbc76c2f1

Relevant bit of the change:

#if LUA_VERSION_NUM > 501
        return std::string(lua_tostring(L, index), lua_rawlen(L, index));
#else
        return std::string(lua_tostring(L, index), lua_strlen(L, index));
#endif

Could a similar change be made to src/scripting/lua/hooks.c ? Thanks for forking elinks and continuing its development!

rkd77 commented 4 years ago

I guess, it is compilable now. I'm going to release 0.13.2 next Sunday