My shared library
libnew.so uses some symbols form an already built third-party shared library
libold.so. I would like to build an executable binary file that should be only linked against
libnew.so. But it still needs to be linked against
libold.so too. Otherwise, the linker complains about
undefined reference to symbol... .
I used these commands to build
libnew.so and the executable file. For some reason, it is only allowed to use the current directory and I cannot put my files somewhere else.
nm libnew.so shows symbols from
libold.so as undefined.
ldd libnew.so also does not report any
libold.so. If I do not use
libold.so for building
libnew.so, the size of
libnew.so will not be changed!
For libnew.so :
gcc -Wall -fPIC -c libnew.c gcc -shared -Wl,-soname,libnew.so.1 -o libnew.so.1.0 *.o -L. -lold ln -sf libnew.so.1.0 libnew.so.1 ln -sf libnew.so.1.0 libnew.so
For the executable :
#this does not work and needs -lold as well. gcc -Wall main.c -L. -lnew -o prog
Is there anything missing? Thanks!