luastatic
luastatic copied to clipboard
Getting couple of undefined_reference errors
./luastatic.lua lpm.lua src/reader.lua src/parser.lua -I/usr/include/lua5.3/
cc -Os lpm.lua.c -rdynamic -lm -o lpm -I/usr/include/lua5.3/
/usr/bin/ld: /tmp/ccvKVuNz.o: in function lstop': lpm.lua.c:(.text+0x32): undefined reference to
lua_sethook'
/usr/bin/ld: /tmp/ccvKVuNz.o: in function msghandler': lpm.lua.c:(.text+0x56): undefined reference to
lua_tolstring'
/usr/bin/ld: lpm.lua.c:(.text+0x6f): undefined reference to luaL_callmeta' /usr/bin/ld: lpm.lua.c:(.text+0x80): undefined reference to
lua_type'
/usr/bin/ld: lpm.lua.c:(.text+0x8a): undefined reference to lua_typename' /usr/bin/ld: lpm.lua.c:(.text+0x9e): undefined reference to
lua_pushfstring'
/usr/bin/ld: lpm.lua.c:(.text+0xab): undefined reference to lua_type' /usr/bin/ld: lpm.lua.c:(.text+0xc7): undefined reference to
lua_getglobal'
/usr/bin/ld: lpm.lua.c:(.text+0xd9): undefined reference to lua_getfield' /usr/bin/ld: lpm.lua.c:(.text+0xe9): undefined reference to
lua_rotate'
/usr/bin/ld: lpm.lua.c:(.text+0xf6): undefined reference to lua_settop' /usr/bin/ld: lpm.lua.c:(.text+0x101): undefined reference to
lua_pushstring'
/usr/bin/ld: lpm.lua.c:(.text+0x111): undefined reference to lua_rotate' /usr/bin/ld: lpm.lua.c:(.text+0x11e): undefined reference to
lua_settop'
/usr/bin/ld: lpm.lua.c:(.text+0x12b): undefined reference to lua_pushinteger' /usr/bin/ld: lpm.lua.c:(.text+0x142): undefined reference to
lua_callk'
Any idea how to solve this?
You need to link with the Lua library. For example, try adding -l/usr/lib/x86_64-linux-gnu/liblua5.3.a
to the command line.
Run this command to search for liblua.a on your system: find /usr/lib -name liblua*
See: https://github.com/ers35/luastatic#examples