Problems embedding python (undefined symbol: stat)

Gerhard Häring gh_pythonlist at gmx.de
Mon Oct 1 20:37:32 EDT 2001


On Mon, Oct 01, 2001 at 06:19:03PM +0000, obscurity wrote:
> On Tue, 25 Sep 2001 00:04:24 GMT, obscurity <obscurity at obscure.org>
> wrote:
> >  I'm trying to embed python in a C++ app I'm writing (on linux). All
> >  I've added so far is a call to Py_Initialize, and when I run my app
> >  it dies somewhere in Py_Initialize with "undefined symbol: stat".
> >  Isn't stat a standard libc call?  If so, how the hell can it be
> >  undefined?  I'm coming to the conclusion that my python
> >  installation is broken in some way, but it was a simply
> >  ./comfigure;make;make install job, so I haven't done anything
> >  strange with it.
> >  
> >  Can anyone offer an advice in fixing this?
> 
> So, can *no-one* help me with this?  Not even a vague pointer to some
> documentation or something?  Anyone?  Pretty please?

Perhaps you haven't linked against all the required libraries. This was
just being discussed in the thread "Problem with linking embedding C
application".

For something quick and dirty, do a ldd $PYTHONROOT/bin/python and link
against these libraries:

gerhard at lilith:~ > ldd /usr/bin/python
        libpthread.so.0 => /lib/libpthread.so.0 (0x40025000)
        libdl.so.2 => /lib/libdl.so.2 (0x4003b000)
        libutil.so.1 => /lib/libutil.so.1 (0x40040000)
        libm.so.6 => /lib/libm.so.6 (0x40043000)
        libc.so.6 => /lib/libc.so.6 (0x40062000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

So I also link with -lpthread -ldl -lutil -lm.

HTH,

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))




More information about the Python-list mailing list