Summary: | sys-devel/bc: 1.07.1 cross-compilation fails with "cannot execute binary file: Exec format error" | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Andrej Rode <mail> |
Component: | Current packages | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED FIXED | ||
Severity: | minor | CC: | chewi, jstein |
Priority: | Normal | Keywords: | Bug, REGRESSION, UPSTREAM |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 662714 | ||
Attachments: | build.log of cross compiled bc-1.07.1 |
Description
Andrej Rode
2017-08-05 20:02:32 UTC
I encountered the same problem while cross compiling aarch64 too. My workaround was to add aarch64 to QEMU_USER_TARGETS and QEMU_SOFTMMU_TARGETS in /usr/portage/make.conf. Then I recompiled QEMU and ran the following commands as root: modprobe binfmt_misc echo ':aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-aarch64-wrapper:' > /proc/sys/fs/binfmt_misc/register cat > /usr/local/bin/qemu-aarch64-wrapper << END #!/bin/sh firstarg=${1} shift exec /usr/bin/qemu-aarch64 -L /usr/aarch64-unknown-linux-gnu "${firstarg}" "${@}" END chmod 755 /usr/local/bin/qemu-aarch64-wrapper Then I reran the build and it worked. The idea is to (ab)use QEMU-user's dynamic binary translation to treat the aarch64 binary like a script. :/ The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=35e6708437937e606a718be756ba8a7988652323 commit 35e6708437937e606a718be756ba8a7988652323 Author: Mike Frysinger <vapier@chromium.org> AuthorDate: 2018-09-18 03:47:29 +0000 Commit: Mike Frysinger <vapier@gentoo.org> CommitDate: 2018-09-18 03:48:36 +0000 sys-devel/bc: fix cross-compile builds #627126 Fixes: https://bugs.gentoo.org/627126 sys-devel/bc/bc-1.07.1-r2.ebuild | 3 +++ sys-devel/bc/files/bc-1.07.1-use-system-bc.patch | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) Hmm. Mike, although it is likely to be installed, bc isn't in @system. Better than nothing I suppose. When we brought HDEPEND into EAPI 7 as BDEPEND, I wanted to include the targetroot USE flag as that would have helped in this case but I was told that ebuilds should bootstrap themselves instead. They were willing to reconsider it after seeing how things pan out but this case probably could be fixed by bootstrapping with a little effort. |