lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Not really going anywhere here

On the build machine (which has lua installed) with -static
$ cc -o here.Linux.x86_64 boot.c -Wall -Werror -fPIC -ansi -static -O3 -DLUA_C89_NUMBERS -I/usr/include/lua5.3/ -llua5.3 -lm -ldl
$ ./here.Linux.x86_64 (2M file)
here/boot.lua:31: ./here/lib/socket/core.so: undefined symbol: lua_gettop

On the build machine (which has lua installed) without -static
$ cc -o here.Linux.x86_64 boot.c -Wall -Werror -fPIC -ansi -O3 -DLUA_C89_NUMBERS -I/usr/include/lua5.3/ -llua5.3 -lm -ldl
$ ./here.Linux.x86_64 (8k file)
Runs just fine

On a target machine that does not have lua installed
$ ./here.Linux.x86_64
./here.Linux.x86_64: error while loading shared libraries: liblua5.3.so.0: cannot open shared object file: No such file or directory

Basically dropping -static will make it runable on the development machine where all the shared libraries are installed but on the target machine where they are not it fails, the 8k file size was a hint here. The advice on the internet around -Wl,static or -Bstatic does not address it

If I add -Wl,/usr/lib/x86_64-linux-gnu/liblua5.3.a it compiles with a size comparable to using -static and behave the same way
here/boot.lua:31: ./here/lib/socket/core.so: undefined symbol: lua_gettop

Kind of feels like I need to get the .a versions of the .so files that where created by the luarocks install and simply include them in the cc command. Which doesn't sound like a fun task

Or perhaps just copy the liblua5.2.so files into the application and get the system to point to them when the application runs

Anyhow, thanks for your time but this has become a C issue more than a Lua one.