classification
Title: _ctypes fails to build on Solaris x86 32-bit (Sun compiler)
Type: crash Stage:
Components: Build, ctypes Versions: Python 2.6, Python 2.5, Python 2.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: theller Nosy List: casevh, dchud, edsu, mmueller, nick, skip.montanaro, theller (7)
Priority: normal Keywords

Created on 2006-08-22 04:28 by casevh, last changed 2009-07-29 11:53 by nick.

Files
File name Uploaded Description Edit Remove
ctype.txt casevh, 2006-08-22 04:28
ffitarget-error.txt nick, 2009-07-29 11:53 Compiler and pre-processor error.
Messages (7)
msg29607 - (view) Author: Case Van Horsen (casevh) Date: 2006-08-22 04:28
The _ctypes modules fails to compile on Solaris 10 x86
32-bit using the Sun Studio 11 compiler. _ctypes does
compile successfully using gcc. The error messages are
attached. If needed, I can provide access to the machine.
msg29608 - (view) Author: Case Van Horsen (casevh) Date: 2006-10-13 02:57
Logged In: YES 
user_id=1212585

I have tracked down two issues. First Sun's cc compiler does
defines __386 instead of __386__. This causes problems in
ffitarget.h 

Second, Sun's cc compiler fails on the following line in ffi.h:
} ffi_closure __attribute__((aligned (8)));

This is a problem in Sun's cc compiler. It is fixed in the
Sun Studio Express August 2006 release. I don't think there
is a patch for the "official" Sun Studio 11 compiler.

With these two changes, ctypes does compile but "make test"
still fails. I am still researching the "make test" failure.
test_crypt
test_csv
test_ctypes
sh: objdump: not found
*** Signal 11 - core dumped
make: Fatal error: Command failed for target `test'
bash-3.00$



msg29609 - (view) Author: Thomas Heller (theller) Date: 2007-01-24 20:53
You can at least see which test(s) crashes when you run the ctypes tests in this way:

./python Lib/ctypes/test/runtests.py -v
msg75316 - (view) Author: Skip Montanaro (skip.montanaro) Date: 2008-10-29 14:38
FWIW, ctypes builds on trunk and all its tests
pass with Sun Studio 12.  I suspect this issue
can be closed but will leave that for Thomas to
decide.
msg75317 - (view) Author: Skip Montanaro (skip.montanaro) Date: 2008-10-29 14:49
Though I should note that ctypes 1.0.2 won't build with Sun Studio 12
on Python 2.4 without some patches for the __i386 macro in
ffitarget.h.  I added this check near the top of ffitarget.h:

    #ifdef __i386
    /* Sun Studio 12 */
    #define __i386__
    #endif
msg75318 - (view) Author: Skip Montanaro (skip.montanaro) Date: 2008-10-29 14:53
*argh* segfault running tests w/ Sun Studio 12 compiled version
of ctypes 1.0.2:

% python ctypes/test/runtests.py -v
sh: objdump: not found
        find_library('c') -> sh: objdump: not found
 None
        find_library('m') -> sh: objdump: not found
 None
test_anon (ctypes.test.test_anon.AnonTest) ... ok
test_anon_nonmember (ctypes.test.test_anon.AnonTest) ... ok
test_anon_nonseq (ctypes.test.test_anon.AnonTest) ... ok
test_nested (ctypes.test.test_anon.AnonTest) ... ok
test (ctypes.test.test_array_in_pointer.Test) ... ok
test_2 (ctypes.test.test_array_in_pointer.Test) ... ok
test_classcache (ctypes.test.test_arrays.ArrayTestCase) ... ok
test_from_address (ctypes.test.test_arrays.ArrayTestCase) ... ok
test_from_addressW (ctypes.test.test_arrays.ArrayTestCase) ... ok
test_numeric_arrays (ctypes.test.test_arrays.ArrayTestCase) ... ok
test_simple (ctypes.test.test_arrays.ArrayTestCase) ... ok
test_byval
(ctypes.test.test_as_parameter.AsParamPropertyWrapperTestCase) ...
oktest_callbacks
(ctypes.test.test_as_parameter.AsParamPropertyWrapperTestCase) ...
Segmentation Fault

Beginning of backtrace:

#0  0xfeb50ad4 in ffi_closure_SYSV_inner ()
   from
/export/home/skipm/python-sunstudio/lib/python2.4/site-packages/_ctypes.so
#1  0xfeb50cca in ffi_closure_SYSV ()
   from
/export/home/skipm/python-sunstudio/lib/python2.4/site-packages/_ctypes.so
#2  0xfe9d141f in _testfunc_callback_i_if ()
   from
/export/home/skipm/python-sunstudio/lib/python2.4/site-packages/_ctypes_test.so
#3  0xfeb50c4f in ffi_call_SYSV ()
   from
/export/home/skipm/python-sunstudio/lib/python2.4/site-packages/_ctypes.so
#4  0xfeb50aa4 in ffi_call ()
   from
/export/home/skipm/python-sunstudio/lib/python2.4/site-packages/_ctypes.so
#5  0xfeb4b440 in _call_function_pointer ()
   from
/export/home/skipm/python-sunstudio/lib/python2.4/site-packages/_ctypes.so
#6  0xfeb4baa0 in _CallProc ()
   from
/export/home/skipm/python-sunstudio/lib/python2.4/site-packages/_ctypes.so
#7  0xfeb483ea in CFuncPtr_call ()
   from
/export/home/skipm/python-sunstudio/lib/python2.4/site-packages/_ctypes.so
#8  0xfeeb23ba in PyObject_Call ()
   from /export/home/skipm/python-sunstudio/lib/libpython2.4.so.1.0
#9  0xfef16c38 in do_call ()
   from /export/home/skipm/python-sunstudio/lib/libpython2.4.so.1.0
msg91036 - (view) Author: Nick (nick) Date: 2009-07-29 11:53
I've stumbled head-first into this bug trying to build ctypes 1.0.2, as 
required by the python Shapely GIS library for an important Zope project 
I've been working on.

It's a real surprise to see this bug even exists (since 2006!).  I don't 
understand the cause, but it's totally preventing me from deploying code 
using Shapely (and therefore ctypes) to a new Solaris x86 server that 
otherwise runs on Windows and Linux right now.

How come no progress - is it too hard to solve?

I'm using Sun Studio 12.1.  Out of a bunch of core libraries we're using 
(numpy, geos etc), this little package that has been "accepted" into the 
main Python distro seems to be the only one we've had problems with. :-(

Is there really no way around this?
History
Date User Action Args
2009-07-29 11:53:38nicksetfiles: + ffitarget-error.txt
versions: + Python 2.4
nosy: + nick

messages: + msg91036

components: + ctypes
2009-03-27 15:38:34dchudsetnosy: + dchud
2008-10-31 20:28:32edsusetnosy: + edsu
2008-10-29 14:54:00skip.montanarosetmessages: + msg75318
2008-10-29 14:49:51skip.montanarosetmessages: + msg75317
2008-10-29 14:38:51skip.montanarosetnosy: + skip.montanaro
messages: + msg75316
2008-09-09 08:55:07mmuellersetnosy: + mmueller
2008-01-12 05:07:53christian.heimessetassignee: theller
type: crash
versions: + Python 2.6
2006-08-22 04:28:12casevhcreate