Embedding problem, undefined symbols

Rick Wagner rjwagner at writeme.com
Wed Aug 1 13:16:37 EDT 2001


I'm trying to embed Python (v1.5.2) in a C application and having
trouble with importing modules.  The C app compiles fine, but the
Python interpreter chokes when it gets the import command.  Here's a
simplified file that shows the problem.

File "test.c":

#include "Python.h"
int main( int argc, char* argv[] )
{
	Py_Initialize();
	PyRun_SimpleString( "import math" );
	return 0;
}

I compile with the following command (on a Linux, Redhat 6.2ish
system):

gcc -Wall -o test test.c /usr/lib/python1.5/config/libpython1.5.a
-I/usr/include/python1.5/ -ldl -lpthread

The output I get is:

  File "<string>", line 1, in ?
ImportError: /usr/lib/python1.5/lib-dynload/mathmodule.so: undefined
symbol: fabs

Sorry if this is a newbie question, but I scoured the FAQ and
newsgroup archives and couldn't find a working solution.  Any help is
appreciated.

Rick Wagner



More information about the Python-list mailing list