Link problem embedding Python, gcc, Python 2.1, Suse7.3

Michael Grabietz michael.grabietz at img-online.de
Thu Jul 18 13:44:30 EDT 2002


Hi,

OS:     Linux SuSe 7.3
gcc:    V2.95.3
Python:  2.1
Numeric: V21

I have a problem while linking a small test application which embeds 
Python via high level embedding in a C program. I am rather new to C and 
Python. Under Windows I could link the program with Python using MS C++ 
without problems. Under Linux some references could not be resolved.

Hope anybody out there can help me or has an idea how to go on.

Regards,

Michael



-----------------------------------------------------------------------
C-Code:

#include <Python.h>
#include <stdio.h>

extern void sub2_c(void)
{

     printf("Hallo von sub2_c !\n");

       PyRun_SimpleString("from Numeric import *\n" 

                          "from type3000_script_test01 import *\n" 

                          "inpt=zeros((3),Float)\n" 

                         ); 


// Funktionierte noch nicht ! 17.07.2002
//    PyRun_SimpleFile("main__type3000_script_test01.py"); 


}
-----------------------------------------------------------------------

Command line:

gcc main1_c.c sub1_c.c libpython2.1.a -I/usr/include/python


-----------------------------------------------------------------------


Error message:

libpython2.1.a(posixmodule.o): In function `posix_tmpnam':
posixmodule.o(.text+0x3206): the use of `tmpnam_r' is dangerous, better 
use `mkstemp'
libpython2.1.a(posixmodule.o): In function `posix_tempnam':
posixmodule.o(.text+0x3122): the use of `tempnam' is dangerous, better 
use `mkstemp'
libpython2.1.a(floatobject.o): In function `float_pow':
floatobject.o(.text+0xe4e): undefined reference to `pow'
libpython2.1.a(dynload_shlib.o): In function `_PyImport_GetDynLoadFunc':
dynload_shlib.o(.text+0x18a): undefined reference to `dlopen'
dynload_shlib.o(.text+0x19b): undefined reference to `dlerror'
dynload_shlib.o(.text+0x1f5): undefined reference to `dlsym'
libpython2.1.a(thread.o): In function `PyThread_start_new_thread':
thread.o(.text+0x71): undefined reference to `pthread_create'
thread.o(.text+0x86): undefined reference to `pthread_detach'
libpython2.1.a(posixmodule.o): In function `posix_openpty':
posixmodule.o(.text+0x15c3): undefined reference to `openpty'
libpython2.1.a(posixmodule.o): In function `posix_forkpty':
posixmodule.o(.text+0x163d): undefined reference to `forkpty'
libpython2.1.a(complexobject.o): In function `_Py_c_pow':
complexobject.o(.text+0x33d): undefined reference to `pow'
complexobject.o(.text+0x37a): undefined reference to `exp'
complexobject.o(.text+0x38e): undefined reference to `log'
complexobject.o(.text+0x3ae): undefined reference to `cos'
complexobject.o(.text+0x3c4): undefined reference to `sin'
collect2: ld returned 1 exit status





More information about the Python-list mailing list