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: failed to build ctypes in Python2.6.1 (even with gcc)
Type: compile error Stage:
Components: Versions: Python 2.6
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: akineko, loewis, matumot
Priority: normal Keywords:

Created on 2009-01-09 21:15 by akineko, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (8)
msg79508 - (view) Author: Aki (akineko) Date: 2009-01-09 21:15
I'm trying to build Python 2.6.1 on Solaris/x86 machine but it puked.

gcc -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall
-Wstrict-prototypes -I. -I/home/neko/gnu/Python-2.6.1/./Include
-Ibuild/temp.solaris-2.10-i86pc-2.6/libffi/include
-Ibuild/temp.solaris-2.10-i86pc-2.6/libffi
-I/home/neko/gnu/Python-2.6.1/Modules/_ctypes/libffi/src -I. -IInclude
-I./Include -I/usr/local/include -I/home/neko/gnu/Python-2.6.1/Include
-I/home/neko/gnu/Python-2.6.1 -c
/home/neko/gnu/Python-2.6.1/Modules/_ctypes/libffi/src/x86/sysv.S -o
build/temp.solaris-2.10-i86pc-2.6/home/neko/gnu/Python-2.6.1/Modules/_ctypes/libffi/src/x86/sysv.o
Assembler:
    "/usr/tmp/ccF9sUxS.s", line 215 : Syntax error
    Near line: " movl ((10 + 3) & ~3)(%eax), %esi"
    "/usr/tmp/ccF9sUxS.s", line 215 : Illegal character: <7e>
    "/usr/tmp/ccF9sUxS.s", line 216 : Syntax error
    Near line: " movl ((((10 + 3) & ~3) + 4) + 4)(%eax), %edx"
    "/usr/tmp/ccF9sUxS.s", line 216 : Illegal character: <7e>
    "/usr/tmp/ccF9sUxS.s", line 223 : Syntax error
    Near line: " call *(((10 + 3) & ~3) + 4)(%eax)"
    "/usr/tmp/ccF9sUxS.s", line 223 : Illegal character: <7e>

Failed to build these modules:
_ctypes            _curses            _curses_panel

//

I'm using gcc 3.4.6 and Solaris 10/x86.

I try to identify the problem but I couldn't figure out what went wrong.
I'm using Python 2.6.1 on Solaris/SPARC and I didn't see any problem.
msg79509 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-01-09 21:18
Run the gcc command line with --save-temps (-fsave-temps if the former
doesn't work), and inspect the assembler file around the line where the
assembler complains. Is this inline assembler code possibly?
msg79514 - (view) Author: Aki (akineko) Date: 2009-01-09 21:41
Hello Martin,

Thank you for your prompt response.
I recompiled the source with --save-temps.
I examined the assembler source and found that it was complaining about '~'!

movl ((((10 + 3) & ~3) + 4) + 4)(%eax), %edx
                   ^ this one

The source was compiled and assembled through 'gcc'.
But I don't see gas in my machine so that I assumed it was assembled by
as (Sun's assembler) and as seems not supporting '~'.

I will try several things, such as installing gas to my machine.
I will update when I have something to report.

Thank you!
Aki-
msg79516 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-01-09 22:00
> movl ((((10 + 3) & ~3) + 4) + 4)(%eax), %edx

I'm really puzzled; gcc would normally not generate assembler code
like this. Instead, with the expression being constant, gcc should
normally compute its result, and fill that into the assembler code.

To study this further, one would need to compare preprocessor output
and assembler output, to correlate them.
msg79517 - (view) Author: Aki (akineko) Date: 2009-01-09 22:14
I have installed GNU binutil package to my machine to use GNU as.
I re-run configure but configure somehow always found Sun as rather than
GNU as even I saw GNU as first from my csh environment.

I temporalily renamed Sun as so that configure was forced to use GNU as.
With such brute force trick, I finally managed to build Python 2.6.1 on
Solaris/x86.

It would be nice if ctypes module and configure handle this elegantly
and amicably, instaed of arguing that Sun as is too old-fashined. 

But I don't have any good idea to deal with this so I need to leave this
to Python developers.
msg79518 - (view) Author: Aki (akineko) Date: 2009-01-09 22:20
> I'm really puzzled; gcc would normally not generate assembler code
like this.

This is because an assembler source (sysv.S) was given.

Python-2.6.1/Modules/_ctypes/libffi/src/x86/sysv.S

It was created by Red Hat.
A macro, RAW_CLOSURE_CIF_OFFSET, contains '~'.
msg79522 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-01-09 23:08
Ah, ok. ctypes can indeed only build with GNU tools. This is a known
issue, and nobody has volunteered to fix it yet. Closing it as such, then.
msg82261 - (view) Author: Takahiro Matsumoto (matumot) Date: 2009-02-16 18:28
I could solve this with following procedures.

- prepare binutil package under /somewhere/
  (i.e. GNU ld, GNU as is available under /somewhere/bin/)

- prepare your local gcc script below and set path for use.
#!/bin/sh

/your_path_to_gcc/gcc -B/somewhere/bin $*

- use this local gcc for your compile.
History
Date User Action Args
2022-04-11 14:56:44adminsetgithub: 49152
2009-02-16 18:28:52matumotsetnosy: + matumot
messages: + msg82261
2009-01-09 23:08:05loewissetstatus: open -> closed
resolution: wont fix
messages: + msg79522
2009-01-09 22:20:12akinekosetmessages: + msg79518
2009-01-09 22:14:37akinekosetmessages: + msg79517
2009-01-09 22:00:06loewissetmessages: + msg79516
2009-01-09 21:41:45akinekosetmessages: + msg79514
2009-01-09 21:18:52loewissetnosy: + loewis
messages: + msg79509
2009-01-09 21:15:12akinekocreate