FAQ
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?

--
obscurity.

"Only the great masters of style ever succeed in being obscure." - Oscar Wilde

Search Discussions

  • Obscurity at Oct 1, 2001 at 6:19 pm

    On Tue, 25 Sep 2001 00:04:24 GMT, obscurity 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?

    --
    obscurity.

    "Only the great masters of style ever succeed in being obscure." - Oscar Wilde
  • Gerhard Häring at Oct 2, 2001 at 12:37 am

    On Mon, Oct 01, 2001 at 06:19:03PM +0000, obscurity wrote:
    On Tue, 25 Sep 2001 00:04:24 GMT, obscurity 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')))
  • Andrew MacIntyre at Oct 2, 2001 at 12:38 am

    On Mon, 1 Oct 2001, obscurity 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.
    It isn't particularly clear what the circumstances are, as you haven't
    told us (that I can see):
    - the Python version (always give this, even though it probably doesn't
    have much to do with this problem);
    - whether it is built as a shared object or a static library;
    - the compiler details (version, etc);
    - the compiler command line used to link the executable.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedSep 25, '01 at 12:04a
activeOct 2, '01 at 12:38a
posts4
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase