Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 736908 - dev-qt/qtcore fail to cross compile with: configure: line 847: /usr/armv7a-unknown-linux-gnueabihf/tmp/portage/dev-qt/qtcore-5.14.2/work/qtbase-everywhere-src-5.14.2_build/bin/qmake: cannot execute binary file: Exec format error
Summary: dev-qt/qtcore fail to cross compile with: configure: line 847: /usr/armv7a-un...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Qt Bug Alias
Depends on:
Reported: 2020-08-12 19:42 UTC by tt_1
Modified: 2023-01-03 00:52 UTC (History)
4 users (show)

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

compressed build log (build.log.gz,5.41 KB, application/gzip)
2020-08-12 19:42 UTC, tt_1
output from cross-emerge --info (emerge-info,4.85 KB, text/plain)
2020-08-12 19:47 UTC, tt_1
modified eclass (qt5-build.eclass,29.50 KB, text/plain)
2021-05-27 12:33 UTC, Bruno MATEU
compressed build log from armv7-cross (qtcore-5.15.2-r14-failed-cross.log.gz,7.62 KB, application/gzip)
2022-04-01 13:38 UTC, tt_1
build.log for aarch64-unknown-linux-gnu (qtcore-aarch64-build.log,213.06 KB, application/octet-stream)
2023-01-03 00:48 UTC, tgyt
aarch64-unknown-linux-gnu-emerge --info (aarch64.txt,6.57 KB, text/plain)
2023-01-03 00:48 UTC, tgyt
build.log for armv7a-unknown-linux-gnueabihf (qtcore-armv7a-build.log,224.68 KB, application/octet-stream)
2023-01-03 00:51 UTC, tgyt
armv7a-unknown-linux-gnueabihf --info (armv7a.txt,6.20 KB, text/plain)
2023-01-03 00:52 UTC, tgyt

Note You need to log in before you can comment on or make changes to this bug.
Description tt_1 2020-08-12 19:42:38 UTC
Created attachment 654376 [details]
compressed build log

it is very difficult to find any information on how to cross compile any dev-qt/* stuff, so I just tried it and the cross-emerge wrappers fail as they rely on target /usr/bin/qmake rather than hosts binary: 

armv7a-unknown-linux-gnueabihf-g++ -o "../bin/qmake" main.o meta.o option.o project.o property.o ioutils.o proitems.o qmakebuiltins.o qmakeevaluator.o qmakeglobals.o qmakeparser.o qmakevfs.o pbuilder_pbx.o makefile.o makefiledeps.o metamakefile.o projectgenerator.o unixmake2.o unixmake.o mingw_make.o msbuild_objectmodel.o msvc_nmake.o msvc_objectmodel.o msvc_vcproj.o msvc_vcxproj.o winmakefile.o xmloutput.o qutfcodec.o qendian.o qglobal.o qlogging.o qmalloc.o qnumeric.o qoperatingsystemversion.o qrandom.o qabstractfileengine.o qbuffer.o qdatastream.o qdebug.o qdir.o qdiriterator.o qfile.o qfiledevice.o qfileinfo.o qfilesystemengine.o qfilesystementry.o qfsfileengine.o qfsfileengine_iterator.o qiodevice.o qsettings.o qtemporaryfile.o qtextstream.o qjsonarray.o qjson.o qjsondocument.o qjsonobject.o qjsonparser.o qjsonvalue.o qmetatype.o qsystemerror.o qvariant.o quuid.o qarraydata.o qbitarray.o qbytearray.o qbytearraylist.o qbytearraymatcher.o qcalendar.o qgregoriancalendar.o qromancalendar.o qcryptographichash.o qdatetime.o qhash.o qlist.o qlocale.o qlocale_tools.o qmap.o qregexp.o qringbuffer.o qstringbuilder.o qstring.o qstringlist.o qversionnumber.o qvsnprintf.o qxmlstream.o qxmlutils.o qcore_unix.o qfilesystemengine_unix.o qfilesystemiterator_unix.o qfsfileengine_unix.o qlocale_unix.o  qlibraryinfo.o  -Wl,-O1 -Wl,--as-needed -Wl,--gc-sections
/usr/armv7a-unknown-linux-gnueabihf/tmp/portage/dev-qt/qtcore-5.14.2/work/qtbase-everywhere-src-5.14.2/configure: line 847: /usr/armv7a-unknown-linux-gnueabihf/tmp/portage/dev-qt/qtcore-5.14.2/work/qtbase-everywhere-src-5.14.2_build/bin/qmake: cannot execute binary file: Exec format error
 * ERROR: dev-qt/qtcore-5.14.2::gentoo failed (configure phase):
Comment 1 tt_1 2020-08-12 19:47:58 UTC
Created attachment 654378 [details]
output from cross-emerge --info
Comment 2 tt_1 2020-08-12 19:50:35 UTC
is there a way to disable the bootstrap of qmake? I'm very unfamiliar with the qt5-build eclass
Comment 3 Bruno MATEU 2021-05-22 23:39:29 UTC
I dig
Comment 4 Bruno MATEU 2021-05-22 23:53:11 UTC
I've dug into the qt5-build eclass and the eclass is not cross-compile friendly.

According to, cross-compiling qt packages requires a specialized qmake build dedicated to cross-compilation. The current eclass build the qmake tool with the cross-compiler which is not working. 

Changing the eclass to detect the cross-compiling situation to make a suitable qmake tool might work, however it will not be possible to build qt packages natively on the target as the target qmake tool would not exist. Maybe fixing both `-xplatform` and `-platform` options to match the target when configuring the qmake tool would work. I'll try to have a look and tinker with the eclass to see if i can make cross-compilation work.

Also, i think this bug should blocks
Comment 5 Davide Pesavento (RETIRED) gentoo-dev 2021-05-23 01:25:55 UTC
Indeed, cross compilation has never been supported in qt5-build.eclass unfortunately.
Comment 6 Bruno MATEU 2021-05-27 12:33:33 UTC
Created attachment 711729 [details]
modified eclass

I modified the qt5-build eclass to make it cross-compile friendly. I managed to cross compile dev-qt/qtcore as well as other dev-qt packages with QT5_MODULE variable set to qtbase and qttools.

However there is an issue with this modified version: it installs tools built for the host in the target directory /usr/${CHOST} (moc, qlalr, qmake, rcc), and as these tools are required to emerge some other dev-qt/ packages, it is not possible to natively compile these packages.

I think it is possible to install those binaries in a separate folder of the target directory, like /usr/${CHOST}/usr/${CBUILD}/qt5/bin/, and cross-build qmake & co for the target, but i think the tools compiled for the build system should never end up in the target dir, and I don't know the "right" way to manage this problem.
Comment 7 tgyt 2022-04-01 12:55:18 UTC
/usr/aarch64-unknown-linux-gnu/tmp/portage/dev-qt/qtcore-5.15.2-r14/work/qtbase-f4ac0b55c37f2b594ffbe639db43dac365825c7c/configure: line 858: /usr/aarch64-unknown-linux-gnu/tmp/portage/dev-qt/qtcore-5.15.2-r14/work/qtbase-f4ac0b55c37f2b594ffbe639db43dac365825c7c_build/bin/qmake: cannot execute binary file: Exec format error
Comment 8 tgyt 2022-04-01 12:55:43 UTC
On upstream(not patched) portage tree
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-01 13:01:24 UTC
(In reply to tgyt from comment #8)
> On upstream(not patched) portage tree

As I said on the other bug, a fresh build.log and emerge --info please (on one bug, not both).
Comment 10 tt_1 2022-04-01 13:38:01 UTC
Created attachment 768367 [details]
compressed build log from armv7-cross

please find the compressed build log attached, here is the most interesting part of it: 

/usr/armv7a-unknown-linux-gnueabihf/tmp/portage/dev-qt/qtcore-5.15.2-r14/work/qtbase-f4ac0b55c37f2b594ffbe639db43dac365825c7c/configure: line 858: /usr/armv7a-unknown-linux-gnueabihf/tmp/portage/dev-qt/qtcore-5.15.2-r14/work/qtbase-f4ac0b55c37f2b594ffbe639db43dac365825c7c_build/bin/qmake: cannot execute binary file: Exec format error
Comment 11 tgyt 2023-01-03 00:48:31 UTC
Created attachment 846798 [details]
build.log for aarch64-unknown-linux-gnu
Comment 12 tgyt 2023-01-03 00:48:52 UTC
Created attachment 846800 [details]
aarch64-unknown-linux-gnu-emerge --info
Comment 13 tgyt 2023-01-03 00:51:50 UTC
Created attachment 846802 [details]
build.log for armv7a-unknown-linux-gnueabihf
Comment 14 tgyt 2023-01-03 00:52:24 UTC
Created attachment 846804 [details]
armv7a-unknown-linux-gnueabihf --info