Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 454176 - dev-lang/python - LONG_BIT error cross-building from 64-bit to 32-bit
Summary: dev-lang/python - LONG_BIT error cross-building from 64-bit to 32-bit
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Embedded Gentoo Team
Keywords: PATCH
Depends on:
Reported: 2013-01-26 15:57 UTC by James Le Cuirot
Modified: 2018-12-30 09:50 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---

python-long-bit-fix.patch (python-long-bit-fix.patch,443 bytes, patch)
2013-01-26 15:57 UTC, James Le Cuirot
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Le Cuirot gentoo-dev 2013-01-26 15:57:22 UTC
Created attachment 336922 [details, diff]

Trying to cross-compile dev-lang/python-3.2.3-r2 for armv7a-hardfloat-linux-gnueabi on x86_64-pc-linux-gnu results in...

LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)

This happens at the "cross-configure" step. I believe it happens because even though ./configure is called with --{build,host}=${CBUILD}, the CHOST environment variable still retains its old value. When /usr/share/ (part of crossdev) gets executed, it sets values based on the wrong target and that causes the build to fail. The fix is simply to set CHOST="${CBUILD}". The attached patch is against 3.2.3-r2 or just use sed to apply it to all the ebuilds.

sed 's/OPT="-O1"/CHOST="${CBUILD}" \0/g' *.ebuild

This alone may not be enough to successfully cross-build Python but I am about to release a set of scripts that makes it possible.
Comment 1 James Le Cuirot gentoo-dev 2013-01-26 17:13:24 UTC
It turns out this was happening because I had set CONFIG_SITE. Normally ./configure loads /usr/share/ when this is unset but that isn't happening in this instance. I need to determine why. This fix may still be a good idea because setting CONFIG_SITE isn't an unreasonable thing to do in general.
Comment 2 James Le Cuirot gentoo-dev 2013-01-26 18:17:25 UTC
Aha. If CONFIG_SITE is not explicitly set, it tries PREFIX/share/, or if --prefix wasn't given, it tries /usr/local/share/, which usually doesn't exist. The cross-configure step is one of those rare occasions when ./configure is called in an ebuild without --prefix. Since our is only used for cross-compiling, it shouldn't be needed here, but I still think it's a bad idea for ./configure to be called with CHOST set to the wrong value. This isn't the only thing that potentially break as a result so please apply the fix.
Comment 3 SpanKY gentoo-dev 2013-03-19 04:06:18 UTC
should probably try and fix this in itself
Comment 4 James Le Cuirot gentoo-dev 2013-03-19 21:32:31 UTC
You can avoid this in by checking [ "${prefix}" == "/usr" ] but it's not ideal. I believe applying the patch is the correct and less ugly thing to do.

Having said that, gcc is also affected by this (see bug #454138) but ./configure is called within its own build system. The aforementioned hack might be easier than patching in that case.
Comment 5 James Le Cuirot gentoo-dev 2018-12-30 09:50:14 UTC
This has been resolved for a while by avoiding pgen.