Compilation of Qt5.3.1 on Ubuntu 20.04.1
-
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.
-
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.
@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.
-
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