Question

I need to link a shared library (LuaSocket) I'm compiling against another special shared library, liblua5.1, that isn't in one of the normal locations. To do this I'm modifying the Makefile.

I cannot figure out what I'm doing wrong, but this particular step that I modified fails:

LIBRARY_PATH=/media/sda2/crank/lib gcc -O -shared -fpic -l liblua5.1 -o socket.so.2.0.2 [...]

(where [...] is a list of .o files that just got built). When I build, I get the error

/usr/lib/gcc/arm-poky-linux-gnueabi/4.8.1/../../../../arm-poky-linux-gnueabi/bin/ld: cannot find -lliblua5.1
collect2: error: ld returned 1 exit status
make: *** [socket.so.2.0.2] Error 1

Inspection of the LIBRARY_PATH confirms that the needed library is there:

# ls /media/sda2/crank/lib/
lgre.so  libgre.so  libgreio.a  liblua.so  liblua5.1.so  libsbexternal.so

What am I doing wrong?

Was it helpful?

Solution

Change -l liblua5.1 to -llua5.1.

Also, instead of setting LIBRARY_PATH, why not use the -L option? Example: -L/media/sda2/crank/lib.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top