homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_ctypes failed Python 2.6a2 Solaris 10 SUN C
Type: Stage:
Components: Tests Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, MrJean1, gregory.p.smith, jcea, loewis, theller
Priority: normal Keywords: patch

Created on 2008年04月04日 20:00 by MrJean1, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
setup.py.diff MrJean1, 2008年04月05日 21:01
Messages (18)
msg64941 - (view) Author: Jean Brouwers (MrJean1) Date: 2008年04月04日 20:00
The ctypes test failed since the _ctypes module did not compile for 32-
bit Python 2.6a2 on Solaris 10 (Opteron) built with the SUN C compiler.
...
cc -KPIC -xtarget=native -DNDEBUG -xO5 -I. -I/.../tools/Python-
2.6a2/./Include -Ibuild/temp.solaris-2.10-i86pc-2.6/libffi/include -
Ibuild/temp.solaris-2.10-i86pc-2.6/libffi -I/.../tools/Python-
2.6a2/Modules/_ctypes/libffi/src -I. -IInclude -I./Include -
I/.../tools/Python-2.6a2/Include -I/.../tools/Python-2.6a2 -c 
.../tools/Python-2.6a2/Modules/_ctypes/_ctypes.c -o build/temp.solaris-
2.10-i86pc-2.6/.../tools/Python-2.6a2/Modules/_ctypes/_ctypes.o
"build/temp.solaris-2.10-i86pc-2.6/libffi/include/ffitarget.h", line 67: 
undefined symbol: FFI_DEFAULT_ABI
"build/temp.solaris-2.10-i86pc-2.6/libffi/include/ffitarget.h", line 68: 
non-constant enumerator value
"build/temp.solaris-2.10-i86pc-2.6/libffi/include/ffi.h", line 255: 
syntax error before or at: __attribute__
"build/temp.solaris-2.10-i86pc-2.6/libffi/include/ffi.h", line 255: 
warning: old-style declaration or incorrect type for: __attribute__
"build/temp.solaris-2.10-i86pc-2.6/libffi/include/ffi.h", line 255: 
warning: syntax error: empty declaration
".../tools/Python-2.6a2/Modules/_ctypes/_ctypes.c", line 155: cannot 
recover from previous errors
cc: acomp failed for /.../tools/Python-2.6a2/Modules/_ctypes/_ctypes.c
...
msg64946 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008年04月04日 20:11
Are you interested in working on a patch?
msg64975 - (view) Author: Jean Brouwers (MrJean1) Date: 2008年04月05日 14:42
Yes, but the _ctypes module requires gcc, as Thomas Heller mentioned. The 
only thing which can be done is avoid building the _ctypes module if the 
compiler is not gcc. I did look at fixing that but have not found the 
proper way to do that.
msg64992 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008年04月05日 17:35
> Yes, but the _ctypes module requires gcc, as Thomas Heller mentioned.
So the proper fix for that would be to port it to SunPro, of course.
> The 
> only thing which can be done is avoid building the _ctypes module if the 
> compiler is not gcc.
I'm not sure whether that would be much better than the status quo,
though. People would continue to complain that the ctypes module is not
built.
Why do you consider the current behaviour incorrect?
> I did look at fixing that but have not found the 
> proper way to do that.
There are several ways. One is to skip compilation in setup.py, for
which you should then determine whether the compiler is gcc. For
that, you could look at ac_compiler_gnu in configure.in, and
set a variable in Makefile.pre.in if the compiler is GCC. Then,
in setup.py, you could look for that variable as parsed from
the Makefile, and skip _ctypes accordingly.
Alternatively, you could check for __GNUC__ when compiling
ctypes, and make the compiler produce a better-understandable
#error.
Regards,
Martin
msg64994 - (view) Author: Jean Brouwers (MrJean1) Date: 2008年04月05日 18:08
For ctypes to compile with the SUN's C compiler, there is quite a bit of 
tricky asm code which needs to be ported (and tested). Most of that is 
in libffi and that library is only supported with gcc, it seems. But 
that is not mentioned explicitly anywhere either, see 
<http://sources.redhat.com/libffi/>.
In any case, the _ctypes module does not compile with SUN C in the 
current situation. And it is not obvious why. Making that clear with 
some message that ctypes (rather _ctypes) requires gcc would help and 
might be sufficient.
However, leaving the _ctypes module out altogether would be better. Just 
like other modules which have environment-specific dependencies, for 
example _tkinter. I'll take a look how that is handled.
/Jean
msg64998 - (view) Author: Jean Brouwers (MrJean1) Date: 2008年04月05日 18:53
The setup.py module contains method detect_ctypes on line 1546 which 
handles the ctypes module building and testing. Would it be OK to not 
do any of that on Solaris, if the compiler is not gcc? 
Also, SUN Studio 12, the latest edition of the SUN C compiler has "... 
increased GCC __asm__ and __attribute__ compatibility ...", see 
<http://blogs.sun.com/tatkar/entry/sunstudio_12_is_released> and 
<http://developers.sun.com/sunstudio/documentation/ss12/whatsnew.html>. Maybe that one could compile libffi as is, for x86[_64]?
msg65000 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008年04月05日 19:02
> Would it be OK to not 
> do any of that on Solaris, if the compiler is not gcc? 
That would be fine.
msg65006 - (view) Author: Jean Brouwers (MrJean1) Date: 2008年04月05日 21:01
Attached is one attempt to avoid building the _ctypes module if the 
compiler is not gcc: a patch for Python 2.6a2 with just 2 changes for 
setup.py based on the value of config variable CC.
msg65007 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2008年04月05日 21:20
I'm curious: Why do you insist on using the sun compiler? Are there
political or technical reasons?
Another thing: in principle it should be possible to build a libffi
shared library with gcc, and use it in a sun-c compiled python build. 
At least this would avoid the need to port assembler code from gcc to sun c.
Python should be configured with './configure --with-systemffi' for that.
msg65008 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008年04月05日 21:25
I think this is incorrect; CC might also be "gcc -pipe" or
"/usr/local/bin/gcc", or some such, and would still be gcc (perhaps even
/usr/local/bin/cc).
msg65010 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2008年04月05日 22:00
agreed, do not check to see if the string is == 'gcc'. Instead,
actually execute the CC compiler with a -v flag and test if 'gcc
version' in output.
something like this (but split into a few statements for readability):
if 'gcc version' not in os.popen(sysconfig.get_config_vars().get('CC',
'gcc') + ' -v').read():
 # gcc is required for ctypes
msg65011 - (view) Author: Jean Brouwers (MrJean1) Date: 2008年04月05日 22:19
Well, so much for the first attempt. I'll see what it takes to use 
something else, like ac_compiler_gnu. Unless Gregory's suggestion 
qualifies.
Also, I am using SUN's compilers on Solaris 10 for 'political' and some 
technical reasons. And I am building alpha and beta Python releases 
mainly to help Python move forward.
msg65020 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008年04月06日 05:41
> Well, so much for the first attempt. I'll see what it takes to use 
> something else, like ac_compiler_gnu. Unless Gregory's suggestion 
> qualifies.
I would prefer to see the configure test for gcc be recorded and
passed through, over trying to detect gcc from its -v output, yes.
Who knows what other compilers will do when passed the -v option?
msg65036 - (view) Author: Jean Brouwers (MrJean1) Date: 2008年04月06日 14:05
Agreed. In addition, gcc -v writes to stderr and catching the output 
requires redirecting stderr or using os.popen3 or -4. The latter fail 
since the select module (needed by subprocess) is still missing at that 
time.
Going back to Thomas' comments and before getting into implementation 
details, the best way to address the issue might be the following.
If the compiler is not gcc then config option --with-system-ffi *must* 
be specified (and a libffi library must exist).
If option --with-system-ffi is not specified and if the compiler is not 
gcc, raise an error.
msg65039 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008年04月06日 14:25
> If option --with-system-ffi is not specified and if the compiler is not 
> gcc, raise an error.
Up to here, it all sounded fine. What do you mean by error? Abort?
That should not happen. Instead, setup.py skips modules if it doesn't
find the proper prerequisites - which here is the pre-existing FFI
implementation.
msg65041 - (view) Author: Jean Brouwers (MrJean1) Date: 2008年04月06日 14:47
Instead of ... raise an error, it should read ... report the _ctypes 
module as missing, do not run any tests, etc.
msg214537 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014年03月23日 02:23
Given the title is this still relevant given that Oracle Solaris 11 is closed source?
msg228590 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014年10月05日 17:03
Can we close this as I cannot see how a test failure against a 6.5 year old alpha build can still be relevant?
History
Date User Action Args
2022年04月11日 14:56:33adminsetgithub: 46804
2014年10月05日 17:05:14gregory.p.smithsetstatus: languishing -> closed
resolution: out of date
2014年10月05日 17:03:32BreamoreBoysetmessages: + msg228590
2014年05月13日 21:42:49skrahsetnosy: - skrah
2014年03月23日 02:23:18BreamoreBoysetnosy: + BreamoreBoy
messages: + msg214537
2013年10月25日 07:31:12christian.heimessetstatus: open -> languishing
2010年08月05日 01:15:31skrahsetnosy: + skrah
2010年08月05日 00:46:28terry.reedysetversions: + Python 2.7, - Python 2.6
2008年12月31日 00:02:11jceasetnosy: + jcea
2008年04月06日 14:47:15MrJean1setmessages: + msg65041
2008年04月06日 14:25:25loewissetmessages: + msg65039
2008年04月06日 14:05:22MrJean1setmessages: + msg65036
2008年04月06日 05:41:53loewissetmessages: + msg65020
2008年04月05日 22:19:24MrJean1setmessages: + msg65011
2008年04月05日 22:00:08gregory.p.smithsetnosy: + gregory.p.smith
messages: + msg65010
2008年04月05日 21:25:23loewissetmessages: + msg65008
2008年04月05日 21:20:31thellersetnosy: + theller
messages: + msg65007
2008年04月05日 21:01:13MrJean1setfiles: + setup.py.diff
keywords: + patch
messages: + msg65006
2008年04月05日 19:02:13loewissetmessages: + msg65000
2008年04月05日 18:53:20MrJean1setmessages: + msg64998
2008年04月05日 18:08:11MrJean1setmessages: + msg64994
2008年04月05日 17:35:57loewissetmessages: + msg64992
2008年04月05日 14:42:07MrJean1setmessages: + msg64975
2008年04月04日 20:11:29loewissetnosy: + loewis
messages: + msg64946
2008年04月04日 20:00:51MrJean1create

AltStyle によって変換されたページ (->オリジナル) /