Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lua woes #13

Open
wwood opened this issue Nov 9, 2015 · 7 comments
Open

lua woes #13

wwood opened this issue Nov 9, 2015 · 7 comments

Comments

@wwood
Copy link

wwood commented Nov 9, 2015

Hi,

I'm trying to package newick_utils for the guix package manager, and I'm having some issues building the lua stream editor. First, I think it may require lua <5.2 because luaL_openlib is no longer a thing - see for instance http://stackoverflow.com/questions/19041215/lual-openlib-replacement-for-lua-5-2 .

When using lua-5.1 I get this error:

lua_tree_editor.c:623:37: error: ‘LUA_RIDX_GLOBALS’ undeclared (first use in this function)
   lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);

Any idea?

I've not personally used the lua editor before, I tend to only use the (very useful) C shell tools. I put a full build log at https://gist.github.com/wwood/349e75ed8e0ec627ed77 - there are some deprecation warnings you may or may not be aware of.

Thanks,
ben

@tjunier
Copy link
Owner

tjunier commented Nov 30, 2015

Hi, sorry for the late reply - I have been very busy with other projects these days - I'll look into this ASAP.

Thomas

@wwood
Copy link
Author

wwood commented Nov 30, 2015

No problem. Alternatively, should I just package the shell tools?

@tjunier
Copy link
Owner

tjunier commented Dec 1, 2015

Certainly. nw_luaed is more experimental (though it can be pretty handy), from my experience hardly anyone uses it (apart from myself, that is). I'd definitely rather see a package witohut nw_luaed than no package at all.

tThat being said, and having had the time to look into the issue in more detail, I can say that nw_luaed can be linked to liblua5.2, in fact it requires it (I remember trying to support both 5.1 and 5.2 and deciding it wasn't worth it):

$ ldd $(which nw_luaed)
    linux-vdso.so.1 =>  (0x00007ffe3a9eb000)
    libnw.so.0 => /usr/local/lib/libnw.so.0 (0x00007f36b3e82000)
    liblua5.2.so.0 => /usr/lib/x86_64-linux-gnu/liblua5.2.so.0 (0x00007f36b3c51000)

Do you get an error if you try Lua 5.2?

@tjunier
Copy link
Owner

tjunier commented Dec 1, 2015

BTW, thank you for packaging the Newick utils - that's something I always knew I should do, but never got the time to actually get done.

Thomas

@alephreish
Copy link

@tjunier you are not alone using nw_luaed :)
Compiles OK with lua5.2 on my machine.

@wwood
Copy link
Author

wwood commented Apr 24, 2016

Hi again,

Apologies for the delay, but time hasn't provided a solution. I'm wondering how it might be possible that it seems to work with 5.2 since, according to the 5.1 (let alone 5.2) manual at http://www.lua.org/manual/5.1/manual.html#7

Function luaL_openlib was replaced by luaL_register.

The specific error I am getting when compiling is

...
/gnu/store/b1yqjimbdh5bf9jnizd4h7yf110744j2-bash-4.3.42/bin/bash ../libtool  --tag=CC   --mode=link gcc  -g -O2   -o nw_luaed lua_tree_editor.o libnw.la -llua -lpthread -lxml2 -lm 
libtool: link: gcc -g -O2 -o .libs/nw_luaed lua_tree_editor.o  ./.libs/libnw.so -llua -lpthread /gnu/store/7lxgrhmfgdd303gslaxazmmdv6n1nf77-libxml2-2.9.3/lib/libxml2.so -ldl -lz /gnu/store/z8vgpay1q450ndgil902xxxz5mq0b1qr-xz-5.2.2/lib/liblzma.so -lm -pthread -Wl,-rpath -Wl,/gnu/store/w492hpzd0gmq64w1pa93h9bkq9rilz8y-newick-utils-1.6.1.da12115/lib -Wl,-rpath -Wl,/gnu/store/7lxgrhmfgdd303gslaxazmmdv6n1nf77-libxml2-2.9.3/lib -Wl,-rpath -Wl,/gnu/store/z8vgpay1q450ndgil902xxxz5mq0b1qr-xz-5.2.2/lib
lua_tree_editor.o: In function `luaopen_lnode':
/tmp/nix-build-newick-utils-1.6.1.da12115.drv-1/source/src/lua_tree_editor.c:1000: undefined reference to `luaL_openlib'
collect2: error: ld returned 1 exit status
...

Any ideas? I'm afraid I know next to nothing about lua. It is finding `-llua because previous steps work e.g.

/gnu/store/b1yqjimbdh5bf9jnizd4h7yf110744j2-bash-4.3.42/bin/bash ../libtool  --tag=CC   --mode=link gcc  -g -O2   -o nw_stats stats.o libnw.la -llua -lpthread -lxml2 -lm 
libtool: link: gcc -g -O2 -o .libs/nw_stats stats.o  ./.libs/libnw.so -llua -lpthread /gnu/store/7lxgrhmfgdd303gslaxazmmdv6n1nf77-libxml2-2.9.3/lib/libxml2.so -ldl -lz /gnu/store/z8vgpay1q450ndgil902xxxz5mq0b1qr-xz-5.2.2/lib/liblzma.so -lm -pthread -Wl,-rpath -Wl,/gnu/store/w492hpzd0gmq64w1pa93h9bkq9rilz8y-newick-utils-1.6.1.da12115/lib -Wl,-rpath -Wl,/gnu/store/7lxgrhmfgdd303gslaxazmmdv6n1nf77-libxml2-2.9.3/lib -Wl,-rpath -Wl,/gnu/store/z8vgpay1q450ndgil902xxxz5mq0b1qr-xz-5.2.2/lib
gcc -DHAVE_CONFIG_H -I. -I..   -I/gnu/store/7lxgrhmfgdd303gslaxazmmdv6n1nf77-libxml2-2.9.3/include/libxml2    -g -O2 -MT lua_tree_editor.o -MD -MP -MF .deps/lua_tree_editor.Tpo -c -o lua_tree_editor.o lua_tree_editor.c
mv -f .deps/lua_tree_editor.Tpo .deps/lua_tree_editor.Po

@tjunier
Copy link
Owner

tjunier commented May 2, 2016

Unfortunaltely, I'm not sure either. On my machine (Ubuntu 14.04), GCC 4.8.4, I get:

/bin/bash ../libtool  --tag=CC   --mode=link gcc  -g -O2   -o nw_luaed lua_tree_editor.o libnw.la 
-llua5.2 -lpthread -lxml2 -lm 
libtool: link: gcc -g -O2 -o .libs/nw_luaed lua_tree_editor.o  ./.libs/libnw.so -llua5.2 
-lpthread -lxml2 -lm

I have -llua5.2 instead of -llua. That might be the reason. Perhaps you could run the same command manually, substituing -llua52 for -llua, and see what happens.

Thomas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants