Python 2.2.1 vs. gcc 3.1?

Martin v. Löwis loewis at
Fri Jun 7 21:44:45 CEST 2002

Andrew Koenig <ark at> writes:

> ImportError: ./python: fatal: relocation error: file /tmp/build-python/Python-2.2.1/build/lib.solaris-2.8-sun4u-2.2/ symbol PyString_Type: referenced symbol not found
> So apparently the shared libraries are not being built properly.
> Any more ideas?

The typical cause of this problem is that you are using GNU binutils,
in which case the compiler needs the option -Wl,--export-dynamic when
linking the Python executable. 

Now, there is machinery in to determine whether this flag
is needed. Traditionally (up to Python 2.2.1), this machinery invokes
'gcc -Xlinker -V' and expects to find 'BFD' in its output if it is GNU
ld, such as

GNU ld version 2.11.2 (with BFD 2.11.2)
  Supported emulations:

Starting with binutils 2.12, GNU ld stops printing BFD in its -V
output, so that this detection mechanism fails.

This has been fixed in the CVS, by checking presence of the
--export-dynamic linker option directly (, for
the 2.2 branch).


More information about the Python-list mailing list