lua-users home
lua-l archive

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


Thank you, I got it working now and I'll be sure to read that. Thank you so much, I've been trying to get this working for over a week now.


On Wed, Apr 24, 2013 at 9:57 PM, Drake Wilson <drake@dasyatidae.net> wrote:
Quoth Matt Eisan <mattjeisan@gmail.com>, on 2013-04-24 21:34:08 -0400:
> 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
> test.so -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

Yes, that's right.  You need position-independent code on Linux x86-64 for
shared libraries, and also you shouldn't be linking the Lua core into the
shared library, so no -llua (and it seems customary to put the -shared at
the beginning of the command line, though I'm not sure whether it matters
for GCC); that's trying to pull in an entire static Lua, which is wrong.

You should read http://lua-users.org/wiki/BuildingModules if you haven't
already.

   ---> Drake Wilson