Qt5.15.2 app fails to build after building copy in Qt6.
-
I am porting an application to Qt6 so working on copies of the application (Kubuntu 22.04). After building the application in Qt6 the Qt5.15.2 version will fail to build even when leaving the same terminal window open then rerunning build. No change to source or CMakeLists.txt.
First line error example:
In file included from /home/<USER>/Qt/5.15.2/gcc_64/include/QtCore/QString:1,/home/<USER>/Qt/5.15.2/gcc_64/include/QtCore/qstring.h:1677:25: error: ‘QVector<QStringRef> QStringRef::split(const QString&, Qt::SplitBehavior, Qt::CaseSensitivity) const’ cannot be overloaded with ‘QVector<QStringRef> QStringRef::split(const QString&, Qt::SplitBehavior, Qt::CaseSensitivity) const’ 1677 | QVector<QStringRef> split(const QString &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Then after reinstalling Qt5.15.2 using the online installer it will build under the same exact terminal window. make clean make..done.
Is there some environmental variable that is getting set that I need to reset somehow?
qtchooser output:
qtchooser -qt=qt5 -print-env QT_SELECT="qt5" QTTOOLDIR="/home/<USER>/Qt/5.15.2/gcc_64/bin" QTLIBDIR="/home/<USER>/Qt/5.15.2/gcc_64/lib"
-
@Protonical I think this is what you are doing:
- Obtain copy of source code. This is clean.
- Build it in-place with Qt6.
- Without cleaning out the build folder, build it with Qt5
Am I correct?
-
@ChrisW67
Negative.Two copies of source code different locations. Modify the qt6 to build with qt6, leave qt5 alone. (Working on migration)
First build qt5 (its own terminal window, own directory), it builds an executable. Then in another terminal window attempt build on qt6.
After qt6 is built (it fails, expected). Go to try to walk through qt5 and build it again (after another cmake .. then make), it will fail. Reinstall Qt5 and it builds.
These are done on Linux and my theory is there is something that has gotten left behind somewhere and/or I mucked up some config somewhere, or the projects are somehow shadowing one another (same names, etc) that I cannot seem to find.
What is weird to me is it appears the QtCore library is causing the first failures.
-
@Protonical said in Qt5.15.2 app fails to build after building copy in Qt6.:
qtchooser
qtchooser seems to be a deprecated tool. And it may not be reliable. I guess it may be easier to take a look at your make files and make sure the right version of qt libs and plugins is applied. If you use cmake, cmake-gui might be a good tool to check if the right version of Qt is used. I do not think you have any build issue with qmake.
-
Hi,
If you want to work properly in a separated way, use the full path to qmake version you want to use.
And use out of source builds, that way you can keep a single source and build for both set of Qt libraries.That is basically what Qt Creator does.
-
Hi @Protonical
Do you get it why it was happening??
I am facing similar kind of issue. If you found something , could you please share?? It will be helpful for me to resolve my issue.
Thanks -
Shadow build directories. Here is the CMake version for a simple program: identical source, two different binaries, no cross-contamination.
chrisw@newton:/tmp/dummy$ ls src/ CMakeLists.txt main.cpp chrisw@newton:/tmp/dummy$ mkdir qt5_build qt6_build chrisw@newton:/tmp/dummy$ cd qt5_build/ chrisw@newton:/tmp/dummy/qt5_build$ CMAKE_PREFIX_PATH=/home/chrisw/Qt/5.15.2/gcc_64/ cmake ../src -- The CXX compiler identification is GNU 13.3.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done (0.1s) -- Generating done (0.0s) -- Build files have been written to: /tmp/dummy/qt5_build chrisw@newton:/tmp/dummy/qt5_build$ make [ 0%] Built target test_autogen_timestamp_deps [ 20%] Automatic MOC and UIC for target test [ 20%] Built target test_autogen [ 40%] Building CXX object CMakeFiles/test.dir/test_autogen/mocs_compilation.cpp.o [ 60%] Building CXX object CMakeFiles/test.dir/main.cpp.o [ 80%] Linking CXX executable test [100%] Built target test chrisw@newton:/tmp/dummy/qt5_build$ ldd test | grep Qt libQt5Core.so.5 => /home/chrisw/Qt/5.15.2/gcc_64/lib/libQt5Core.so.5 (0x000073a612600000) libicui18n.so.56 => /home/chrisw/Qt/5.15.2/gcc_64/lib/libicui18n.so.56 (0x000073a611600000) libicuuc.so.56 => /home/chrisw/Qt/5.15.2/gcc_64/lib/libicuuc.so.56 (0x000073a611000000) libicudata.so.56 => /home/chrisw/Qt/5.15.2/gcc_64/lib/libicudata.so.56 (0x000073a60f400000) chrisw@newton:/tmp/dummy/qt5_build$ cd ../qt6_build/ chrisw@newton:/tmp/dummy/qt6_build$ CMAKE_PREFIX_PATH=/home/chrisw/Qt/6.8.1/gcc_64/ cmake ../src -- The CXX compiler identification is GNU 13.3.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Performing Test HAVE_STDATOMIC -- Performing Test HAVE_STDATOMIC - Success -- Found WrapAtomic: TRUE -- Configuring done (0.3s) -- Generating done (0.0s) -- Build files have been written to: /tmp/dummy/qt6_build chrisw@newton:/tmp/dummy/qt6_build$ make [ 0%] Built target test_autogen_timestamp_deps [ 20%] Automatic MOC and UIC for target test [ 20%] Built target test_autogen [ 40%] Building CXX object CMakeFiles/test.dir/test_autogen/mocs_compilation.cpp.o [ 60%] Building CXX object CMakeFiles/test.dir/main.cpp.o [ 80%] Linking CXX executable test [100%] Built target test chrisw@newton:/tmp/dummy/qt6_build$ ldd test | grep Qt libQt6Core.so.6 => /home/chrisw/Qt/6.8.1/gcc_64/lib/libQt6Core.so.6 (0x00007c84dd200000) libicui18n.so.73 => /home/chrisw/Qt/6.8.1/gcc_64/lib/libicui18n.so.73 (0x00007c84dc600000) libicuuc.so.73 => /home/chrisw/Qt/6.8.1/gcc_64/lib/libicuuc.so.73 (0x00007c84dc200000) libicudata.so.73 => /home/chrisw/Qt/6.8.1/gcc_64/lib/libicudata.so.73 (0x00007c84da200000)