[New-bugs-announce] [issue5404] Cross-compiling Python

Joshua Kinard report at bugs.python.org
Mon Mar 2 10:03:49 CET 2009

New submission from Joshua Kinard <kumba at gentoo.org>:

I'm attempting to get Python to cross-compile, and I'm not sure if this
is an actual flaw in the build system or not, but thought I'd detail
what I can here and seek comment from those in the know.

What happens is under a cross-environment setup on a Gentoo installation
(using our sys-devel/crossdev and sys-devel/crossdev-wrappers package),
when cross-compiling from x86_64-pc-linux-gnu to
mipsel-unknown-linux-gnu, the Python build process fails to build
several modules/extensions.

I believe that part of the problem with building the extensions is on
our end, and is a separate item I'll track down myself.  But there is
one module in particular that looks tied to Python's core that's getting
a cross-compile error: _socket.

What happens is, somehow, the configure script (or setup.py) is defining
HAVE_SYS_PARAM_H, which pulls in sys/param.h -- I think this is normal,
but for socketmodule.c, that particular call by the Makefile passes in
-I/usr/include along with the other -I calls defining the cross-include
directories.  The mipsel cross-compiler then references x86_64-specific
assembler code within the sys/param.h copy in /usr/include, and fails.

Generally, our crossdev-wrappers package sets up the buil environment
and overrides a lot of the common variables to use the cross-toolchain.
 So far, it looks like only socketmodule.c is affected with the rogue
-I/usr/include getting pulled in.  I haven't had much luck trying to
track down just how Python's build system is tied into autotools to see
where it's picking up /usr/include from.  Already tried patching
setup.py some, as well as passing --oldincludedir to configure, but
neither approach worked.

I'm hoping that this is either a minor bug in the build system, or we're
missing a specific variable to be passed to the make process so that
-I/usr/include doesn't get defined.  Not sure which, so if there's any
other ideas to try, I'm all ears!

components: Build
messages: 83008
nosy: kumba
severity: normal
status: open
title: Cross-compiling Python
type: compile error
versions: Python 2.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list