I am a C noob, so this may be a stupid question. I am trying to compile a .so file (shared library, if I have my terminology correct) of C objects (.o files), for the express purpose of importing them into Python via ctypes
. I first compiled the *.so with
gcc -shared -o libvARAM.so ARAM.o ARAM_io.o io.o pre.o rule.o stat.o ART.o vARAM.o
This worked, except that when I tried loading via ctypes I was rewarded with:
OSError: ./libvARAM.so: undefined symbol: max
After some digging, I realized that max is not a standard C function. Calling ldd libvARAM.so
informed me that one of the dependencies is libc.so.6
. I created a symlink libc.so
to libc.so.6
and then tried recompiling my .so as
gcc -shared -o libvARAM.so ARAM.o ARAM_io.o io.o pre.o rule.o stat.o ART.o vARAM.o -llibc
which generated
/usr/bin/ld: cannot find -llibc
The same error is generated if I also try -L/lib/i386-linux-gnu/ -llibc
. I am aware of this thread, but feel it is not relevant to my situation, as the solution there is for a makefile. I am using Xubuntu if this matters.
Any help is sincerely appreciated!