[ python-Bugs-1563807 ] _ctypes built with GCC on AIX 5.3 fails with ld ffi error
SourceForge.net
noreply at sourceforge.net
Tue Nov 14 19:28:32 CET 2006
Bugs item #1563807, was opened at 2006-09-22 20:07
Message generated for change (Comment added) made by memotype
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1563807&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Build
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Daniel Clark (djbclark)
Assigned to: Thomas Heller (theller)
Summary: _ctypes built with GCC on AIX 5.3 fails with ld ffi error
Initial Comment:
Build of Python 2.5 on AIX 5.3 with GCC (tried
multiple versions: 3.3.2 from Bull Freeware, 4.1.0 and
4.1.1 from UCLA) fails with the below error message.
Tried various configure lines, which all get to the
same error, the most simple being:
./configure --disable-ipv6 --with-gcc --with-cxx=g++
(With gcc 3.3.2 I also needed --without-threads)
[...]
building '_ctypes' extension
./Modules/ld_so_aix gcc -pthread -bI:Modules/
python.exp build/temp.aix-5.3-2.5/usr/local/src/python-
2.5/Python-2.5/Modules/_ctypes/_ctypes.o build/
temp.aix-5.3-2.5/usr/local/src/python-2.5/Python-2.5/
Modules/_ctypes/callbacks.o build/temp.aix-5.3-2.5/usr/
local/src/python-2.5/Python-2.5/Modules/_ctypes/
callproc.o build/temp.aix-5.3-2.5/usr/local/src/python-
2.5/Python-2.5/Modules/_ctypes/stgdict.o build/
temp.aix-5.3-2.5/usr/local/src/python-2.5/Python-2.5/
Modules/_ctypes/cfield.o build/temp.aix-5.3-2.5/usr/
local/src/python-2.5/Python-2.5/Modules/_ctypes/
malloc_closure.o build/temp.aix-5.3-2.5/usr/local/src/
python-2.5/Python-2.5/Modules/_ctypes/libffi/src/
prep_cif.o build/temp.aix-5.3-2.5/usr/local/src/python-
2.5/Python-2.5/Modules/_ctypes/libffi/src/powerpc/
ffi_darwin.o build/temp.aix-5.3-2.5/usr/local/src/
python-2.5/Python-2.5/Modules/_ctypes/libffi/src/
powerpc/aix.o build/temp.aix-5.3-2.5/usr/local/src/
python-2.5/Python-2.5/Modules/_ctypes/libffi/src/
powerpc/aix_closure.o -L/usr/local/lib -o build/
lib.aix-5.3-2.5/_ctypes.so
ld: 0711-317 ERROR: Undefined
symbol: .ffi_prep_cif_machdep
ld: 0711-317 ERROR: Undefined symbol: .ffi_call
ld: 0711-317 ERROR: Undefined symbol: .ffi_prep_closure
ld: 0711-317 ERROR: Undefined
symbol: .ffi_closure_helper_DARWIN
ld: 0711-345 Use the -bloadmap or -bnoquiet option to
obtain more information.
collect2: ld returned 8 exit status
*** WARNING: renaming "_ctypes" since importing it
failed: Could not load module build/lib.aix-5.3-2.5.
System error: No such file or directory
error: No such file or directory
gmake: *** [sharedmods] Error 1
Re-running the failing stanza with -Wl,-bnoquiet gives:
(ld): halt 4
(ld): setopt r/o->w
(ld): setopt nodelcsect
(ld): setfflag 4
(ld): savename build/lib.aix-5.3-2.5/_ctypes.so
(ld): filelist 17 3
(ld): setopt noprogram
(ld): entry init_ctypes
ENTRY: Entry point set to init_ctypes
(ld): i /lib/crt0_r.o
(ld): i /tmp//ccigrpfq.o
(ld): lib /usr/lib/libm.a
(ld): i build/temp.aix-5.3-2.5/usr/local/src/python-
2.5/Python-2.5/Modules/_ctypes/_ctypes.o
(ld): i build/temp.aix-5.3-2.5/usr/local/src/python-
2.5/Python-2.5/Modules/_ctypes/callbacks.o
(ld): i build/temp.aix-5.3-2.5/usr/local/src/python-
2.5/Python-2.5/Modules/_ctypes/callproc.o
(ld): i build/temp.aix-5.3-2.5/usr/local/src/python-
2.5/Python-2.5/Modules/_ctypes/stgdict.o
(ld): i build/temp.aix-5.3-2.5/usr/local/src/python-
2.5/Python-2.5/Modules/_ctypes/cfield.o
(ld): i build/temp.aix-5.3-2.5/usr/local/src/python-
2.5/Python-2.5/Modules/_ctypes/malloc_closure.o
(ld): i build/temp.aix-5.3-2.5/usr/local/src/python-
2.5/Python-2.5/Modules/_ctypes/libffi/src/prep_cif.o
(ld): i build/temp.aix-5.3-2.5/usr/local/src/python-
2.5/Python-2.5/Modules/_ctypes/libffi/src/powerpc/
ffi_darwin.o
(ld): i build/temp.aix-5.3-2.5/usr/local/src/python-
2.5/Python-2.5/Modules/_ctypes/libffi/src/powerpc/aix.o
(ld): i build/temp.aix-5.3-2.5/usr/local/src/python-
2.5/Python-2.5/Modules/_ctypes/libffi/src/powerpc/
aix_closure.o
(ld): i /usr/local/encap/gcc-4.1.1/bin/../lib/gcc/
powerpc-ibm-aix5.3.0.0/4.1.1/pthread/libgcc.a
(ld): i /usr/local/encap/gcc-4.1.1/bin/../lib/gcc/
powerpc-ibm-aix5.3.0.0/4.1.1/pthread/libgcc_eh.a
(ld): lib /usr/lib/libpthreads.a
(ld): lib /usr/lib/libc.a
LIBRARY: Shared object libpthreads.a[shr_comm.o]: 173
symbols imported.
LIBRARY: Shared object libpthreads.a[shr_xpg5.o]: 161
symbols imported.
LIBRARY: Shared object libc.a[shr.o]: 2820 symbols
imported.
LIBRARY: Shared object libc.a[meth.o]: 2 symbols
imported.
LIBRARY: Shared object libc.a[posix_aio.o]: 20 symbols
imported.
LIBRARY: Shared object libc.a[aio.o]: 14 symbols
imported.
LIBRARY: Shared object libc.a[pse.o]: 5 symbols
imported.
LIBRARY: Shared object libc.a[dl.o]: 4 symbols
imported.
LIBRARY: Shared object libc.a[pty.o]: 1 symbols
imported.
FILELIST: Number of previously inserted files
processed: 17
(ld): imports Modules/python.exp
IMPORTS: Symbols imported from import file Modules/
python.exp: 1034
(ld): exports _ctypes.exp
EXPORTS: Symbols exported: 57
(ld): initfini _GLOBAL__FI__ctypes_so
_GLOBAL__FD__ctypes_so
(ld): resolve
RESOLVE: 895 of 7035 symbols were kept.
(ld): addgl /usr/lib/glink.o
ADDGL: Glink code added for 125 symbols.
(ld): er full
ld: 0711-318 ERROR: Undefined symbols were found.
The following symbols are in error:
Symbol Inpndx TY CL Source-
File(Object-File) OR Import-File{Shared-object}
RLD: Address Section
Rld-type Referencing Symbol
------------------------------------------------------
----------------------------------------
.ffi_prep_cif_machdep [8] ER PR /usr/local/
src/python-2.5/Python-2.5/Modules/_ctypes/libffi/src/
prep_cif.c(build/temp.aix-5.3-2.5/usr/local/src/python-
2.5/Python
-2.5/Modules/_ctypes/libffi/src/prep_cif.o)
00000a44 .text
R_RBR [556] .ffi_prep_cif
.ffi_call [140] ER PR /usr/local/
src/python-2.5/Python-2.5/Modules/_ctypes/
callproc.c(build/temp.aix-5.3-2.5/usr/local/src/python-
2.5/Python-2.5/Module
s/_ctypes/callproc.o)
00001888 .text
R_RBR [913] ._CallProc
00001980 .text
R_RBR [913] ._CallProc
.ffi_prep_closure [36] ER PR /usr/local/
src/python-2.5/Python-2.5/Modules/_ctypes/
callbacks.c(build/temp.aix-5.3-2.5/usr/local/src/
python-2.5/Python-2.5/Modul
es/_ctypes/callbacks.o)
00000274 .text
R_RBR [621] .AllocFunctionCallback
.ffi_closure_helper_DARWIN [2] ER PR
aix_closure.S(build/temp.aix-5.3-2.5/usr/local/src/
python-2.5/Python-2.5/Modules/_ctypes/libffi/src/
powerpc/aix_closure.o)
00000070 .text
R_RBR [6] .ffi_closure_ASM
ER: The return code is 8.ld: 0711-317 ERROR: Undefined
symbol: .ffi_prep_cif_machdep
ld: 0711-317 ERROR: Undefined symbol: .ffi_call
ld: 0711-317 ERROR: Undefined symbol: .ffi_prep_closure
ld: 0711-317 ERROR: Undefined
symbol: .ffi_closure_helper_DARWIN
collect2: ld returned 8 exit status
----------------------------------------------------------------------
Comment By: Memotype (memotype)
Date: 2006-11-14 13:28
Message:
Logged In: YES
user_id=1645242
Originator: NO
That seems to have done the trick actually. __aix__ is in fact not defined
on AIX 5.2 (cannot varify on 5.3) and removing the #ifdefs in the suggested
file allows for a clean build:
~/Python-2.5 $ ./python
Python 2.5 (r25:51908, Nov 14 2006, 13:19:33)
[GCC 2.9-aix51-020209] on aix5
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> dir (ctypes)
['ARRAY', 'ArgumentError', 'Array', 'BigEndianStructure', 'CDLL',
'CFUNCTYPE', 'DEFAULT_MODE', 'LibraryLoader', 'LittleEndianStructure',
'POINTER', 'PYFUNCTYPE', 'PyDLL', 'RTLD_GLOBAL', 'RTLD_LOCAL',
'SetPointerType', 'Structure', 'Union', '_CFuncPtr', '_FUNCFLAG_CDECL',
'_FUNCFLAG_PYTHONAPI', '_Pointer', '_SimpleCData', '__builtins__',
'__doc__', '__file__', '__name__', '__path__', '__version__',
'__warningregistry__', '_c_functype_cache', '_calcsize', '_cast',
'_cast_addr', '_ctypes_version', '_dlopen', '_endian', '_memmove_addr',
'_memset_addr', '_os', '_pointer_type_cache', '_string_at',
'_string_at_addr', '_sys', '_wstring_at', '_wstring_at_addr', 'addressof',
'alignment', 'byref', 'c_buffer', 'c_byte', 'c_char', 'c_char_p',
'c_double', 'c_float', 'c_int', 'c_int16', 'c_int32', 'c_int64', 'c_int8',
'c_long', 'c_longlong', 'c_short', 'c_size_t', 'c_ubyte', 'c_uint',
'c_uint16', 'c_uint32', 'c_uint64', 'c_uint8', 'c_ulong', 'c_ulonglong',
'c_ushort', 'c_void_p', 'c_voidp', 'c_wchar', 'c_wchar_p', 'cast', 'cdll',
'create_string_buffer', 'create_unicode_buffer', 'memmove', 'memset',
'pointer', 'py_object', 'pydll', 'pythonapi', 'resize',
'set_conversion_mode', 'sizeof', 'string_at', 'wstring_at']
>>>
----------------------------------------------------------------------
Comment By: Memotype (memotype)
Date: 2006-11-14 13:28
Message:
Logged In: YES
user_id=1645242
Originator: NO
That seems to have done the trick actually. __aix__ is in fact not defined
on AIX 5.2 (cannot varify on 5.3) and removing the #ifdefs in the suggested
file allows for a clean build:
~/Python-2.5 $ ./python
Python 2.5 (r25:51908, Nov 14 2006, 13:19:33)
[GCC 2.9-aix51-020209] on aix5
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> dir (ctypes)
['ARRAY', 'ArgumentError', 'Array', 'BigEndianStructure', 'CDLL',
'CFUNCTYPE', 'DEFAULT_MODE', 'LibraryLoader', 'LittleEndianStructure',
'POINTER', 'PYFUNCTYPE', 'PyDLL', 'RTLD_GLOBAL', 'RTLD_LOCAL',
'SetPointerType', 'Structure', 'Union', '_CFuncPtr', '_FUNCFLAG_CDECL',
'_FUNCFLAG_PYTHONAPI', '_Pointer', '_SimpleCData', '__builtins__',
'__doc__', '__file__', '__name__', '__path__', '__version__',
'__warningregistry__', '_c_functype_cache', '_calcsize', '_cast',
'_cast_addr', '_ctypes_version', '_dlopen', '_endian', '_memmove_addr',
'_memset_addr', '_os', '_pointer_type_cache', '_string_at',
'_string_at_addr', '_sys', '_wstring_at', '_wstring_at_addr', 'addressof',
'alignment', 'byref', 'c_buffer', 'c_byte', 'c_char', 'c_char_p',
'c_double', 'c_float', 'c_int', 'c_int16', 'c_int32', 'c_int64', 'c_int8',
'c_long', 'c_longlong', 'c_short', 'c_size_t', 'c_ubyte', 'c_uint',
'c_uint16', 'c_uint32', 'c_uint64', 'c_uint8', 'c_ulong', 'c_ulonglong',
'c_ushort', 'c_void_p', 'c_voidp', 'c_wchar', 'c_wchar_p', 'cast', 'cdll',
'create_string_buffer', 'create_unicode_buffer', 'memmove', 'memset',
'pointer', 'py_object', 'pydll', 'pythonapi', 'resize',
'set_conversion_mode', 'sizeof', 'string_at', 'wstring_at']
>>>
----------------------------------------------------------------------
Comment By: Thomas Heller (theller)
Date: 2006-11-14 12:05
Message:
Logged In: YES
user_id=11105
Well, there is certainly a diff in noctypes.diff. If your
patch program cannot handle it, you may want to apply it
manually (basically you have to remove/comment out two
sections of code in setup.py).
It seems that there are actually two bugs:
1. setup.py doesn't continue after trying to import the
_ctypes extension. No idea why, but somewhere something
exists the process.
2. _ctypes.so does not build (or better fails to load)
because of missing symbols:
ld: 0711-317 ERROR: Undefined symbol: .ffi_prep_cif_machdep
ld: 0711-317 ERROR: Undefined symbol: .ffi_call
ld: 0711-317 ERROR: Undefined symbol: .ffi_prep_closure
ld: 0711-317 ERROR: Undefined symbol: .ffi_closure_helper_DARWIN
I have no access to an AIX system, do I cannot try this out
myself. One thing that comes to mind:
These functions are implemented in the file
Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c. This file
is compiled, without errors. One problem could be that the
whole file contents are included in an #ifdef block like this:
#ifdef __ppc__
...
#endif
Can it be that __ppc__ is not defined on this system? Can
someone try out to build with these two lines removed?
Thanks.
----------------------------------------------------------------------
Comment By: Memotype (memotype)
Date: 2006-11-14 10:55
Message:
Logged In: YES
user_id=1645242
What is the status on this bug? I tried the work around, but
patch doesn't like the diff file provided, says
"Processing... I cannot find a patch in there anywhere."
----------------------------------------------------------------------
Comment By: Daniel Clark (djbclark)
Date: 2006-09-23 08:55
Message:
Logged In: YES
user_id=129055
Build finished running; full log attached as python-2.5-
ctypes.log.gz. Relevent lines are:
ld: 0711-317 ERROR: Undefined symbol: .ffi_prep_cif_machdep
[... more ld errors ...]
collect2: ld returned 8 exit status
*** WARNING: renaming "_ctypes" since importing it failed:
Could not load module build/lib.aix-5.3-2.5.
System error: No such file or directory
error: No such file or directory
gmake: *** [sharedmods] Error 1
And at this point gmake exits and the build stops. Running
gmake again just causes the same error to pop up.
----------------------------------------------------------------------
Comment By: Daniel Clark (djbclark)
Date: 2006-09-23 08:29
Message:
Logged In: YES
user_id=129055
Ah, well there is a bug then... setup.py does not continue
on its own. I've added an attachement of a successful full
build log (built with the noctypes patch), and will attach
a second full build log that shows the build failing on the
error when it finishes running in 10-20 minutes...
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2006-09-23 08:14
Message:
Logged In: YES
user_id=21627
No; setup.py should continue on its own. If it doesn't,
that's a bug.
----------------------------------------------------------------------
Comment By: Daniel Clark (djbclark)
Date: 2006-09-23 08:06
Message:
Logged In: YES
user_id=129055
loewis: No, the ctypes error messages cause the build to
fail. Are you saying to use "gmake -k" or something like that?
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2006-09-23 07:15
Message:
Logged In: YES
user_id=21627
You don't need to disable it. It will print error messages,
but you can just ignore them if you don't need the ctypes
module.
----------------------------------------------------------------------
Comment By: Daniel Clark (djbclark)
Date: 2006-09-22 23:44
Message:
Logged In: YES
user_id=129055
The only way I could figure out to disable ctypes was via a
patch to setup.py (included as noctypes.diff). With this
patch applied, Python 2.5 compiles without issues on AIX
5.3 / GCC 4.1.1, and seems to work fine (except for ctypes
of course, and probably some things that depend on ctypes
are also broken). (For the exact build paramaters used, see
attached python-2.5.ep)
----------------------------------------------------------------------
Comment By: Daniel Clark (djbclark)
Date: 2006-09-22 22:07
Message:
Logged In: YES
user_id=129055
As a temporary workaround, is there any way to just disable
building of the ctypes module?
----------------------------------------------------------------------
Comment By: Daniel Clark (djbclark)
Date: 2006-09-22 20:48
Message:
Logged In: YES
user_id=129055
Did a search of the bug database, and found some simular
bugs:
http://python.org/sf/1530448
http://python.org/sf/1544339
http://python.org/sf/1529269
Also tried with --with-system-ffi and some other options,
but got same error:
./configure --disable-ipv6 --with-gcc --with-cxx=g++ --
disable-universalsdk --disable-framework --disable-toolbox-
glue --with-system-ffi --without-threads
Tried adding -Wl,-mimpure-text as in r51113, but that just
caused an error (I might be doing it wrong or something,
specifics below)
# ./Modules/ld_so_aix gcc -Wl,-mimpure-text -bI:Modules/
python.exp build/temp.aix-5.3-2.5/usr/local/src/python-2.5/
Python-2.5/Modules/_ctypes/_ctypes.o build/temp.aix-5.3-2.5/
usr/local/src/python-2.5/Python-2.5/Modules/_ctypes/
callbacks.o build/temp.aix-5.3-2.5/usr/local/src/python-2.5/
Python-2.5/Modules/_ctypes/callproc.o build/temp.aix-5.3-
2.5/usr/local/src/python-2.5/Python-2.5/Modules/_ctypes/
stgdict.o build/temp.aix-5.3-2.5/usr/local/src/python-2.5/
Python-2.5/Modules/_ctypes/cfield.o build/temp.aix-5.3-2.5/
usr/local/src/python-2.5/Python-2.5/Modules/_ctypes/
malloc_closure.o build/temp.aix-5.3-2.5/usr/local/src/
python-2.5/Python-2.5/Modules/_ctypes/libffi/src/prep_cif.o
build/temp.aix-5.3-2.5/usr/local/src/python-2.5/Python-2.5/
Modules/_ctypes/libffi/src/powerpc/ffi_darwin.o build/
temp.aix-5.3-2.5/usr/local/src/python-2.5/Python-2.5/
Modules/_ctypes/libffi/src/powerpc/aix.o build/temp.aix-5.3-
2.5/usr/local/src/python-2.5/Python-2.5/Modules/_ctypes/
libffi/src/powerpc/aix_closure.o -L/usr/local/lib -o build/
lib.aix-5.3-2.5/_ctypes.so
ld: 0706-027 The -i flag is ignored.
ld: 0706-012 The -p flag is not recognized.
collect2: ld returned 255 exit status
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1563807&group_id=5470
More information about the Python-bugs-list
mailing list