Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 184308

Summary: dev-lang/python-{2.4.4-r4,2.5.1-r2} cross-compile problems
Product: Gentoo Linux Reporter: Jack Kelly <endgame.dos>
Component: New packagesAssignee: Python Gentoo Team <python>
Status: RESOLVED FIXED    
Severity: normal CC: bugs+gentoo, embedded, kanaka, mpytasz, wk
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 239110    
Attachments: Python 2.5.1 cross-compile patch
Corresponding changes to python-2.5.1 ebuild
patch to fix "cannot test when crosscompiling"

Description Jack Kelly 2007-07-05 14:27:44 UTC
The version check on line 59 reads
[[ $(python -V) != ${PV} ]] && \
python -V returns strings like "Python x.y.z"
${PV} only contains "x.y.z"


Further, python -V writes to stderr, so the check should read:
[[ "$(python -V 2>&1)" != "Python ${PV}" ]] && \

Reproducible: Always

Steps to Reproduce:
1.emerge python with CHOST != CBUILD
2.watch it break
3.

Actual Results:  
 * 
 * ERROR: dev-lang/python-2.4.4-r4 failed.
 * Call stack:
 *   ebuild.sh, line 1642:   Called dyn_unpack
 *   ebuild.sh, line 768:   Called qa_call 'src_unpack'
 *   ebuild.sh, line 44:   Called src_unpack
 *   python-2.4.4-r4.ebuild, line 59:   Called die
 * 
 * Crosscompiling requires the same host and build versions.
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/tmp/portage/dev-lang/python-2.4.4-r4/temp/build.log'.

Expected Results:  
Python would merge because I'm running Python 2.4.4 on the host and merging Python 2.4.4
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-07-06 08:39:40 UTC
*** Bug 184394 has been marked as a duplicate of this bug. ***
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2007-07-07 20:42:32 UTC
*** Bug 184527 has been marked as a duplicate of this bug. ***
Comment 3 Philipp Riegger 2007-07-07 21:01:59 UTC
from Bug 184527:

When trying to cross-compile the latest python it always fails due to a wrong
check. "python -V" does not only print the version but also "Python " in front
of it and it prints to stderr. The following patch should fix this:

<quote>
--- python-2.4.4-r4.ebuild.orig 2007-07-07 18:22:57.000000000 +0000
+++ python-2.4.4-r4.ebuild      2007-07-07 18:23:41.000000000 +0000
@@ -56,7 +56,7 @@
        cd ${S}

        if tc-is-cross-compiler ; then
-               [[ $(python -V) != ${PV} ]] && \
+               [[ "$(python -V 2>&1)" != "Python ${PV}" ]] && \
                        die "Crosscompiling requires the same host and build
versions."
        else
                rm "${WORKDIR}/${PV}"/*_all_crosscompile.patch
</quote>

Cross compiling fails never the less, but that's another thing.
Comment 4 Joel Martin (RETIRED) gentoo-dev 2007-09-11 19:35:06 UTC
I've applied the version check fix for cross-compile. I've also applied a small patch to the test code which was giving a unicode error during cross-compile. I applied these to all 2.4.4 and greater versions. I've gotten 2.4.4* to cross-compile this way.

However, 2.5.1 is still problematic. A bigger patch is needed to get it to cross-compile. I wandered across a 2.5 cross-compile fix on a gobo-linux site somewhere and modified it so that it works. However, I have not yet applied this more heavy handed patch to the python-2.5.1 ebuild (it replaces the in-utero host python and pgen cross-compile hackery in the ebuild). I will attach the ebuild diff and the patch shortly. I won't commit this bigger change right away in case there is any feedback from the python team.
Comment 5 Joel Martin (RETIRED) gentoo-dev 2007-09-11 19:40:48 UTC
Created attachment 130627 [details, diff]
Python 2.5.1 cross-compile patch
Comment 6 Joel Martin (RETIRED) gentoo-dev 2007-09-11 19:41:28 UTC
Created attachment 130629 [details, diff]
Corresponding changes to python-2.5.1 ebuild
Comment 7 Joel Martin (RETIRED) gentoo-dev 2007-09-11 19:42:53 UTC
Change summary to reflect that this is tracking python cross-compiles issues generally.
Comment 8 Karl Zollner 2007-10-11 12:39:35 UTC
Created attachment 133131 [details, diff]
patch to fix "cannot test when crosscompiling"
Comment 9 Karl Zollner 2007-10-11 12:41:18 UTC
x86-64 profile crosscompiling for i686-pc-gnu-linux

An additional problem pops up when attempting to cross compile python..
configure hangs with a message:


checking for %zd printf()...configure cannot test when cross-compiling

I looked around a bit and found:
https://svn.openwrt.org/openwrt/packages/lang/python/patches/030-cant_check_files.patch

I then renamed this 13_all_cant-check-files.patch

and bzipped this into python-gentoo-patches-2.5.1.tar.bz2

unfortunately this didn't solve all the problems....

Compiling /var/tmp/portage/dev-lang/python-2.5.1-r2/image//usr/lib/python2.5/xmllib.py ...
Compiling /var/tmp/portage/dev-lang/python-2.5.1-r2/image//usr/lib/python2.5/xmlrpclib.py ...
Compiling /var/tmp/portage/dev-lang/python-2.5.1-r2/image//usr/lib/python2.5/zipfile.py ...
make: *** [libinstall] Error 1
 * 
 * ERROR: dev-lang/python-2.5.1-r2 failed.
 * Call stack:
 *   ebuild.sh, line 1654:   Called dyn_install
 *   ebuild.sh, line 1089:   Called qa_call 'src_install'
 *   ebuild.sh, line 44:   Called src_install
 *   python-2.5.1-r2.ebuild, line 186:   Called die
 * 
 * (no error message)
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/tmp/portage/dev-lang/python-2.5.1-r2/temp/build.log'.