Compilation of Qt5.3.1 on Ubuntu 20.04.1
-
Hello,
I'm trying to compile Qt5.3.1 from Buildroot on Ubuntu 20.04.1 (I know that it is a pretty old Qt version but I have to stick with this version).
I used to build it on Ubuntu 14.04 and I had no problem.
On Ubuntu 20.04.1, I have this issue coming from the execution of the ./configure script just after qmake is built:
Running configuration tests... Failed to process makespec for platform 'devices/linux-buildroot-g++' Cannot find feature spec_pre.prf Error processing project file: /dev/null
I've run the same command used to perform the test using the qmake that I get from compiling Qt5.3.1 on Ubuntu 14.04 and it works fine. So, the runtime environment does not seem to be the problem. It must be something to do with the configuration when building qmake, but when I compare both configure command lines, they look the same.
So now I'm a bit stuck and I would appreciate your help. Maybe something was changed within qmake code that I need to backport to make it run on Ubuntu 20.04.1?
Let me know if you need information on anything else, and I'll be happy to provide.
Thanks for your help.
-
Hi and welcome to devnet,
Turn on the verbose flag, you should get some more information about what is happening.
-
Hi,
Yes, that's what I've done.
From the non-working qmake:
$ /home/lco/BSP/buildroot-output/dev/A/build/qt5base-5.3.1/bin/qmake -d -E -nocache -recursive -spec /home/lco/BSP/buildroot-output/dev/A/build/qt5base-5.3.1/mkspecs/devices/linux-buildroot-g++ QT= /dev/null DEBUG 1: Resetting dir to: /home/lco DEBUG 1: Changing dir to: /dev Cannot find feature spec_pre.prf Error processing project file: /dev/null
From the working qmake obtained from Ubuntu 14.04 and run on Ubuntu 20.01.4:
$ /home/lco/tmp/qmake -d -E -nocache -recursive -spec /home/lco/BSP/buildroot-output/dev/A/build/qt5base-5.3.1/mkspecs/devices/linux-buildroot-g++ QT= / dev/null DEBUG 1: Resetting dir to: /home/lco DEBUG 1: Changing dir to: /dev DEBUG 1: visiting file /home/lco/BSP/buildroot-output/dev/A/build/qt5base-5.3.1/mkspecs/features/spec_pre.prf
And it carries on...
-
Are you building from a clean source or reusing something that already contained build artifacts ?
Are you doing out of source builds ?
-
Can you explain the procedure you are using with buildroot ?
-
After quite a bit of debugging by adding debug messages in qmake source code, I found that the problem is related to this foreach in qmake/library/qmakeevaluator.cpp, l.1506
QStringList ret; foreach (const QString &root, feature_roots) if (IoUtils::exists(root)) ret << root; m_featureRoots = new QMakeFeatureRoots(ret);
For some reason, this foreach does not iterate through the whole list (made of 2 elements, only the first gets iterated).
Replacing this foreach by a standard for loop makes it work.Out of curiosity, I've looked at the latest source code, and this line was changed for a for loop at commit e31541fa6f5f4 with comment "qmake: eradicate Q_FOREACH loops [needing qAsConst()] ".
No idea why this foreach would work differently on Ubuntu 20.04.1, but here you go.
Thanks for your help anyway.
-
Nice !
Glad you found out and thanks for sharing the results :-)
As for why, I do not know either, it's a pretty interesting bug.
-
@laurent-c said in Compilation of Qt5.3.1 on Ubuntu 20.04.1:
No idea why this foreach would work differently on Ubuntu 20.04
I imagine this is a compilation code issue. It's not the OS version per se, given the same Qt version it's that you're using a very different
gcc
version now from 6 years ago? -
Just adding here what I found until I could fully compile Qt5.3.1.
I actually had to patch 3 other tools : moc, qdbusxml2cpp and uic which all had problems with foreach loops! I found the patches from the same person in the git repo of qtbase and adapted them to work on Qt5.3.1 source code.
Note that you also have to enable c++11 in order to compile with those patches. In buildroot-2015.05, this is done through package/qt5/qt5base/qt5base.mk by adding -c++11 flag to QT5BASE_CONFIGURE_CMDS (l. 163).
Then I could compile.
-
Assuming you run
configure
in qt source directory, you can specifyQMAKEFEATURES
like this:QMAKEFEATURES=$PWD/qtbase/mkspecs/features \ ./configure