lua-users home
lua-l archive

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

Am 25.04.2013 03:34 schröbte Matt Eisan:
Thanks for the reply, Drake.

When I tried adding -shared to the compile line, I got a strange error:

matt@matt-BM412AA-ABA-CQ5600Y:~/Downloads/lua-5.2.0/src$ g++ dir.cpp -o -llua -shared
/usr/bin/ld: /usr/local/lib/liblua.a(lapi.o): relocation R_X86_64_32
against `luaO_nilobject_' can not be used when making a shared object;
recompile with -fPIC
/usr/local/lib/liblua.a: could not read symbols: Bad value
collect2: ld returned 1 exit status

It says to recompile with fPIC (whatever that is?), but I tried that and
still got the same exact error.

That's because the error is in a static library which you obviously didn't recompile. But luckily you probably don't need this library anyway (if you compiled Lua with the default flags on Linux), so try adding -fPIC and removing -llua.

Btw., "PIC" means "position independent code", and refers to code that can end up at different addresses at runtime due to being loaded as a shared library.