Problems embedding python (undefined symbol: stat)

Andrew MacIntyre andymac at bullseye.apana.org.au
Mon Oct 1 20:38:48 EDT 2001


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.

>From what you have said, I infer that the Python lib is a shared object,
and the failure is happening when the dynamic loader attempts to bind the
Python SO.

This being the case, I expect that either the Python SO hasn't been linked
with all other required library dependencies, or ditto the calling
program, or there is some problem with finding libc.

You probably should create a simple test SO with the same entry point and
a call to stat() in that routine to verify whether its a Python build
issue or a compiler/linker issue.  If the latter, you will probably need
to find a forum with suitable Linux specialists.

--
Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au  | Snail: PO Box 370
        andymac at pcug.org.au            |        Belconnen  ACT  2616
Web:    http://www.andymac.org/        |        Australia





More information about the Python-list mailing list