[Python-Dev] Compiling Python on a biarch (PPC/PPC64)

Sérgio Durigan Júnior sergiodj at linux.vnet.ibm.com
Wed Apr 9 22:44:14 CEST 2008


Hi everybody :-)

I'm running a PPC64 biarch here (i.e., a 64-bit kernel with 32-bit
userspace), and trying to compile Python on it. Well, as I have a GCC
compiler that generates natively 32-bit executables, everything goes
well when I *don't* use any specific 64-bit flag (./configure
--enable-shared && make && make test && make install).

My problem happens when I try to compile Python for PPC64 using some
configure flags and environment variables, like --target and CFLAGS. To
be more specific, that's what I tried:

./configure --enable-shared --target=powerpc64-unknown-linux
CFLAGS='-m64'

The configure runs fine. But when I do a "make":

sergio at elm3b188 ~/work/w/Python-2.5.2 $ make
gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall
-Wstrict-prototypes  -I. -IInclude -I./Include  -fPIC -DPy_BUILD_CORE -o
Modules/python.o ./Modules/python.c
In file included from Include/Python.h:57,
                 from ./Modules/python.c:3:
Include/pyport.h:761:2: error: #error "LONG_BIT definition appears wrong
for platform (bad gcc/glibc config?)."
make: *** [Modules/python.o] Error 1

Well, now starts the part where I try to understand things, so please
correct me if I'm wrong ;-). After some investigation, I thought that
the error was the (absence of) detection of the building target, so I
wrote a little piece of code in configure.in which detects PPC64 in the
$target variable and appends to $BASECFLAGS the string '-m64'. It seems
to be more than that, though (because that approach didn't work
completely)... Can anyone give me a hand on this? As far as I could
investigate, I must change setup.py in order to get this issue fixed,
right?

Thanks in advance,

-- 
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil



More information about the Python-Dev mailing list