Further problems extending Python (cerr undefined)
Pearu Peterson
pearu at cens.ioc.ee
Fri Dec 13 16:42:40 EST 2002
On 13 Dec 2002, JB wrote:
> I receive the following error message, when I am trying to
> load my extension module:
>
> bz at linux:~/python-programs/python-konstruktion> python
> extest.py
> Traceback (most recent call last):
> File "extest.py", line 1, in ?
> import pythongeo
> ImportError: ./pythongeo.so: undefined symbol: cerr
You need to link your extension module with std++ library.
Acctually, you should use g++ (instead of gcc) for linking C++ extension
modules.
To replace gcc with g++ in a setup.py file, I used to use the following
codelet in setup.py files:
#+++HACK: replace linker gcc with g++ +++++++++++
from distutils import sysconfig
save_init_posix = sysconfig._init_posix
def my_init_posix():
save_init_posix()
g = sysconfig._config_vars
if g['LDSHARED'][:3]=='gcc':
print 'my_init_posix: changing LDSHARED =',`g['LDSHARED']`,
g['LDSHARED'] = 'g++'+g['LDSHARED'][3:]
print 'to',`g['LDSHARED']`
sysconfig._init_posix = my_init_posix
#+++++++++++++++++++++++++++++++++++++++++++++++++
Pearu
More information about the Python-list
mailing list