Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 581304 - dev-lang/python:3.5 when cross-compiling: Parser/pgen: Parser/pgen: cannot execute binary file
Summary: dev-lang/python:3.5 when cross-compiling: Parser/pgen: Parser/pgen: cannot ex...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-26 22:15 UTC by Peter Levine
Modified: 2016-05-12 00:59 UTC (History)
1 user (show)

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


Attachments
armv7a-hardfloat-linux-gnueabi-emerge --info (armv7a-hardfloat-linux-gnueabi-emerge-info.txt,14.89 KB, text/plain)
2016-04-26 22:16 UTC, Peter Levine
Details
dev-lang/python-3.5.1-r2 build log (dev-lang:python-3.5.1-r2:20160426-220103.log,236.94 KB, text/x-log)
2016-04-26 22:18 UTC, Peter Levine
Details
python-3.5-crosscompile.patch (python-3.5-crosscompile.patch,4.63 KB, patch)
2016-04-26 22:22 UTC, Peter Levine
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Levine 2016-04-26 22:15:56 UTC
Cross-compiling dev-lang/python:3.5 fails with "Parser/pgen: Parser/pgen: cannot execute binary file" (CBUILD="x86_64-pc-linux-gnu" and CHOST="armv7a-hardfloat-linux-gnueabi").

Reproducible: Always

Steps to Reproduce:
1. "armv7a-hardfloat-linux-gnueabi-emerge -1 =python-3.5.1-r2" or "armv7a-hardfloat-linux-gnueabi-emerge -1 =python-3.5.1-r2" or "armv7a-hardfloat-linux-gnueabi-emerge -1 =python-3.5.0-r2"
Actual Results:  
Parser/pgen: Parser/pgen: cannot execute binary file

Expected Results:  
Successful merge.

dev-lang/python:3.5 requires "pgen" and "_freeze_importlib" to be compiled and executed at build time. Otherwise, it fails with "Parser/pgen: Parser/pgen: cannot execute binary file".
Comment 1 Peter Levine 2016-04-26 22:16:39 UTC
Created attachment 432194 [details]
armv7a-hardfloat-linux-gnueabi-emerge --info
Comment 2 Peter Levine 2016-04-26 22:18:44 UTC
Created attachment 432196 [details]
dev-lang/python-3.5.1-r2 build log
Comment 3 Peter Levine 2016-04-26 22:22:38 UTC
Created attachment 432198 [details, diff]
python-3.5-crosscompile.patch

This is a patch to successful cross-compile python-3.5.1-r2 and python-3.5.0-r2.  It uses the native compiler to build the "pgen" and "_freeze_importlib" make targets.
Comment 4 Mike Gilbert gentoo-dev 2016-04-28 14:29:30 UTC
Thanks for the patch. Has it been submitted for inclusion upstream?
Comment 5 Peter Levine 2016-04-28 16:09:54 UTC
(In reply to Mike Gilbert from comment #4)
> Thanks for the patch. Has it been submitted for inclusion upstream?

No. If someone wants to submit it though, go ahead.
Comment 6 Mike Gilbert gentoo-dev 2016-04-28 16:51:45 UTC
(In reply to Peter Levine from comment #5)

I'm not a big fan of playing middle-man on patch management. I also prefer not to take on maintenance of distro-specific patches.

Please submit this upstream, and we can backport it if is accepted.
Comment 7 Peter Levine 2016-04-29 16:36:20 UTC
(In reply to Mike Gilbert from comment #6)
> (In reply to Peter Levine from comment #5)
> 
> I'm not a big fan of playing middle-man on patch management. I also prefer
> not to take on maintenance of distro-specific patches.
> 
> Please submit this upstream, and we can backport it if is accepted.

OK.

http://bugs.python.org/issue26886
Comment 8 Peter Levine 2016-04-29 19:48:31 UTC
Apparently neither "pgen" nor "_freeze_importlib" needs to be run during cross-compilation. The issue was reported and resolved: http://bugs.python.org/issue22359

The patch was applied upstream 6 days ago: https://hg.python.org/cpython/raw-rev/66e40df31fac

It applies cleanly and works with python-3.5.0-r2 and python-3.5.1-r2.

There exist a 2.7 version of the patch: https://hg.python.org/cpython/rev/0f7a299c6d50

It does not apply cleanly, but I have no problem cross-compiling python-2.7.11-r2 anyway.
Comment 9 Mike Gilbert gentoo-dev 2016-04-29 20:55:12 UTC
Nice! I'll try to get this applied this weekend.
Comment 10 Mike Gilbert gentoo-dev 2016-05-12 00:59:49 UTC
commit 3f74e0196b4719fb8f10118c80de15fa823797a6
Author: Mike Gilbert <floppym@gentoo.org>
Date:   Wed May 11 20:58:45 2016 -0400

    dev-lang/python: fix cross-compiles for 3.5.1
    
    Bug: https://bugs.gentoo.org/581304
    
    Package-Manager: portage-2.2.28_p106

 dev-lang/python/files/3.5.1-cross-compile.patch | 75 +++++++++++++++++++++++++
 dev-lang/python/python-3.5.1-r2.ebuild          |  7 +--
 2 files changed, 76 insertions(+), 6 deletions(-)