Problem with linking embedding C application

Olivier Deme olivier.deme at airtel-atn.com
Mon Oct 1 08:36:06 EDT 2001


Hi,

We have written an application written in C, which invokes sometimes the Python 
interpreter for executing Python methods.

So, I am trying to statically link our application with libpython*.*.a., but this result in various 
undefined symbols (see below).

Now, it looks like I am missing symbols defined in the math and posix thread library! I don't
understand this since we are not using any symbols defined in these libraries.
Could anybody tell me what is going on and how I can fix this problem?

Thanks!

Here is the output of "ld":

/lib/libpython.a(posixmodule.o): In function `posix_tmpnam':
/home/odeme/Python-2.1.1/./Modules/posixmodule.c:4212: the use of `tmpnam_r' is dangerous, better use `mkstemp'
/lib/libpython.a(posixmodule.o): In function `posix_tempnam':
/home/odeme/Python-2.1.1/./Modules/posixmodule.c:4168: the use of `tempnam' is dangerous, better use `mkstemp'
/lib/libpython.a(floatobject.o): In function `float_pow':
/home/odeme/Python-2.1.1/Objects/floatobject.c:532: undefined reference to `pow'
/lib/libpython.a(dynload_shlib.o): In function `_PyImport_GetDynLoadFunc':
/home/odeme/Python-2.1.1/Python/dynload_shlib.c:86: undefined reference to `dlopen'
/home/odeme/Python-2.1.1/Python/dynload_shlib.c:94: undefined reference to `dlerror'
/home/odeme/Python-2.1.1/Python/dynload_shlib.c:99: undefined reference to `dlsym'
/lib/libpython.a(thread.o): In function `PyThread_start_new_thread':
/home/odeme/Python-2.1.1/Python/thread_pthread.h:135: undefined reference to `pthread_create'
/home/odeme/Python-2.1.1/Python/thread_pthread.h:159: undefined reference to `pthread_detach'
/lib/libpython.a(posixmodule.o): In function `posix_openpty':
/home/odeme/Python-2.1.1/./Modules/posixmodule.c:1754: undefined reference to `openpty'
/lib/libpython.a(posixmodule.o): In function `posix_forkpty':
/home/odeme/Python-2.1.1/./Modules/posixmodule.c:1785: undefined reference to `forkpty'
/lib/libpython.a(complexobject.o): In function `_Py_c_pow':
/home/odeme/Python-2.1.1/Objects/complexobject.c:139: undefined reference to `pow'
/home/odeme/Python-2.1.1/Objects/complexobject.c:143: undefined reference to `exp'
/home/odeme/Python-2.1.1/Objects/complexobject.c:144: undefined reference to `log'
/home/odeme/Python-2.1.1/Objects/complexobject.c:146: undefined reference to `cos'
/home/odeme/Python-2.1.1/Objects/complexobject.c:147: undefined reference to `sin'
collect2: ld returned 1 exit status



More information about the Python-list mailing list