[C++-sig] linking with non-python libraries

Ben Veal benveal92 at hotmail.com
Wed Feb 8 02:22:49 CET 2006

>On Mon, Feb 06, 2006 at 09:23:16PM -0500, Stefan Seefeld wrote:
>>Ben Veal wrote:
> >
> >> I manage to build the extension OK (both manually and using 
>pyplusplus), >> however when I try to import it, I get the following 
> >> >> ImportError: /usr/lib/python2.3/MyClient.so: undefined symbol: >> 
> >> >> I suppose it can't find the library containing the base class. I use 
>the >> following lines in my Jamfile to link with the appropriate 
>>The error message is emitted at runtime, not link time. Therefor, you
>>should instruct the loader how to find the library, not the linker.
>>Since you mention linux, I suggest you set the LD_LIBRARY_PATH variable
>>to contain the path to your library. (Running 'ldd' on your extension
>>module will tell you what third-party libraries it depends on and whether
>>and where it finds them.)
>i'm not sure that setting LD_LIBRARY_PATH would solve the problem. this
>is because the loader can't load a library that has not been linked at
>link time. i'm instead pretty sure that ldd does not print about any
>missing library for your module. go ahead and link it.

You're right, ldd says that it is linked OK.
When I build normal c++ executables (not python extensions) I have no 
Here is the relevant linking command that is produced by my makefile:

g++ -o output.exe input.o -L. -s /usr/lib/libBaseClass.so -lpthread

I notice that there is no -l preceeding '/usr/lib/libBaseClass.so' is this 
Could it be anything to do with the '-s' option? (what is the equivalent 
Jamfile requirement?)


Also, in reply to the comments from Roman Yakovenko:

>Congratulation! What do you mean "both manually and using pyplusplus"?

I mean with & without using pyplusplus (I was unsure of my initial attempt 
so I used pyplusplus aswell)

>Also could you provide link to your project? If you don't mind I will add 
>to the "who is using pyplusplus" list.

Eventually, if I can get it to work properly.

More information about the Cplusplus-sig mailing list