Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-95803

CMake multi-config-ninja always compiles all libs as debug

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 6.3
    • Fix Version/s: None
    • Component/s: Build System: CMake
    • Labels:
      None

      Description

      Configured with:

      cmake /home/tjmaciei/src/qt/qt6/qtbase '-GNinja Multi-Config'  \
      '-DCMAKE_INSTALL_PREFIX=/home/tjmaciei/obj/qt/qt6/qtbase' \
      '-DBUILD_TESTING=ON' '-DBUILD_WITH_PCH=OFF' \
      '-DCMAKE_DEFAULT_BUILD_TYPE:STRING=Debug' \
      '-DCMAKE_CONFIGURATION_TYPES:STRING=Release;RelWithDebInfo;Debug' \
      '-DCMAKE_CXX_COMPILER:STRING=g++' '-DCMAKE_CXX_FLAGS:STRING=-march=tigerlake -mprefer-vector-width=256 -maes -mno-rdseed' \
      '-DCMAKE_CXX_FLAGS_DEBUG:STRING=-O0 -g3' \
      '-DCMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -g1' \
      '-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O3 -g' \
      '-DCMAKE_C_COMPILER:STRING=gcc' \
      '-DCMAKE_C_FLAGS:STRING=-march=tigerlake -mprefer-vector-width=256 -maes -mno-rdseed' \
      '-DCMAKE_C_FLAGS_DEBUG:STRING=-O0 -g' \
      '-DCMAKE_CXX_FLAGS=-O0 -g3 ' \
      '-DCMAKE_C_COMPILER=gcc' \
      '-DCMAKE_C_FLAGS_RELEASE:STRING=-O3 -g1' \
      '-DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O3 -g' \
      '-DCMAKE_EXE_LINKER_FLAGS=-Wl,-O1 -Wl,--as-needed' \
      '-DCMAKE_MAKE_PROGRAM=/usr/bin/ninja' \
      '-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-O1 -Wl,--as-needed' \
      '-DFEATURE_dbus_linked=OFF' \
      '-DFEATURE_developer_build=ON' \
      '-DFEATURE_journald=ON' \
      '-DFEATURE_libproxy=ON' \
      '-DFEATURE_optimize_debug=OFF' \
      '-DFEATURE_openssl_linked=ON' \
      '-DFEATURE_reduce_relocations=ON' \
      '-DFEATURE_sctp=ON' \
      '-DFEATURE_system_sqlite=ON' \
      '-DQT_LIBINFIX=.t' \
      '-DQT_BUILD_EXAMPLES=ON' \
      '-DQT_BUILD_EXAMPLES_BY_DEFAULT=OFF' \
      '-DQT_BUILD_BENCHMARKS=OFF' \
      '-DQT_BUILD_MANUAL_TESTS=OFF' \
      '-DQT_BUILD_TESTS=ON' \
      '-DQT_BUILD_TESTS_BY_DEFAULT=OFF' \
      '-DQT_QMAKE_TARGET_MKSPEC=linux-g++-optimised' \
      -DQT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS=ON
      

      When compiling the target "moc:Release", it's compiled as release:

      $ ninja -v moc:Release
      [1/106] /home/tjmaciei/bin/g++ -DHAVE_CONFIG_H -DQT_BOOTSTRAPPED -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_FOREACH -DQT_TYPESAFE_FLAGS -DQT_USE_QSTRINGBUILDER -DQT_VERSION_MAJOR=6 -DQT_VERSION_MINOR=2 -DQT_VERSION_PATCH=0 -DQT_VERSION_STR=\"6.2.0\" -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DCMAKE_INTDIR=\"Release\" -I/home/tjmaciei/obj/qt/qt6/qtbase/src/corelib/Core_autogen/include_Release -I/home/tjmaciei/obj/qt/qt6/qtbase/include -I/home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore -I/home/tjmaciei/src/qt/qt6/qtbase/src/corelib -I/home/tjmaciei/obj/qt/qt6/qtbase/src/corelib -I/home/tjmaciei/obj/qt/qt6/qtbase/src/corelib/global -I/home/tjmaciei/obj/qt/qt6/qtbase/src/corelib/kernel -I/home/tjmaciei/src/qt/qt6/qtbase/src/corelib/../3rdparty/tinycbor/src -I/home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/6.2.0 -I/home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/6.2.0/QtCore -I/home/tjmaciei/src/qt/qt6/qtbase/src/corelib/../3rdparty/forkfd -I/home/tjmaciei/obj/qt/qt6/qtbase/src/corelib/.rcc -I/home/tjmaciei/obj/qt/qt6/qtbase/mkspecs/linux-g++-optimised -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/home/tjmaciei/obj/qt/qt6/qtbase/src/xml/Xml_autogen/include_Release -I/home/tjmaciei/obj/qt/qt6/qtbase/include/QtXml -I/home/tjmaciei/src/qt/qt6/qtbase/src/xml -I/home/tjmaciei/obj/qt/qt6/qtbase/src/xml -I/home/tjmaciei/obj/qt/qt6/qtbase/include/QtXml/6.2.0 -I/home/tjmaciei/obj/qt/qt6/qtbase/include/QtXml/6.2.0/QtXml -I/home/tjmaciei/src/qt/qt6/qtbase/src/tools/bootstrap/.. -I/home/tjmaciei/src/qt/qt6/qtbase/src/tools/bootstrap/../../3rdparty/tinycbor/src -O0 -g3 -O3 -g1 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -ffunction-sections -fdata-sections -pthread -std=gnu++17 -MD -MT src/tools/bootstrap/CMakeFiles/Bootstrap.dir/Release/__/__/corelib/global/qmalloc.cpp.o -MF src/tools/bootstrap/CMakeFiles/Bootstrap.dir/Release/__/__/corelib/global/qmalloc.cpp.o.d -o src/tools/bootstrap/CMakeFiles/Bootstrap.dir/Release/__/__/corelib/global/qmalloc.cpp.o -c /home/tjmaciei/src/qt/qt6/qtbase/src/corelib/global/qmalloc.cpp
      [...]
      [106/106] : && /home/tjmaciei/bin/g++ -O0 -g3 -O3 -g1 -Wl,-O1 -Wl,--as-needed     -Wl,--gc-sections -Wl,--enable-new-dtags src/tools/moc/CMakeFiles/moc.dir/Release/collectjson.cpp.o src/tools/moc/CMakeFiles/moc.dir/Release/generator.cpp.o src/tools/moc/CMakeFiles/moc.dir/Release/main.cpp.o src/tools/moc/CMakeFiles/moc.dir/Release/moc.cpp.o src/tools/moc/CMakeFiles/moc.dir/Release/parser.cpp.o src/tools/moc/CMakeFiles/moc.dir/Release/preprocessor.cpp.o src/tools/moc/CMakeFiles/moc.dir/Release/token.cpp.o -o libexec/moc  -Wl,-rpath,"\$ORIGIN/../lib:"  src/tools/bootstrap/Release/libBootstrap.a  /usr/lib64/libpcre2-16.so  /usr/lib64/libz.so  -pthread && :
      

      But the "Core:Release" target is actually debug:

      $ ninja -v Core:Release
      [1/337] cd /home/tjmaciei/obj/qt/qt6/qtbase && /usr/bin/cmake "-DIN_FILES=/home/tjmaciei/obj/qt/qt6/qtbase/mkspecs/preliminary/qmodule.pri;/home/tjmaciei/obj/qt/qt6/qtbase/mkspecs/preliminary/Release/qmodule.cmake;/home/tjmaciei/obj/qt/qt6/qtbase/mkspecs/preliminary/RelWithDebInfo/qmodule.cmake;/home/tjmaciei/obj/qt/qt6/qtbase/mkspecs/preliminary/Debug/qmodule.cmake" -DOUT_FILE=/home/tjmaciei/obj/qt/qt6/qtbase/mkspecs/qmodule.pri "-DLIBRARY_PREFIXES=lib;lib" "-DLIBRARY_SUFFIXES=.so;.a" -DLINK_LIBRARY_FLAG=-l "-DCONFIGS=Release;RelWithDebInfo;Debug" "-DIMPLICIT_LINK_DIRECTORIES=/usr/lib64/gcc/x86_64-suse-linux/11;/usr/lib64;/lib64;/usr/x86_64-suse-linux/lib" -P /home/tjmaciei/src/qt/qt6/qtbase/cmake/QtGenerateLibPri.cmake
      [2/337] /home/tjmaciei/bin/g++ -DHAVE_CONFIG_H -DQT_BOOTSTRAPPED -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_FOREACH -DQT_TYPESAFE_FLAGS -DQT_USE_QSTRINGBUILDER -DQT_VERSION_MAJOR=6 -DQT_VERSION_MINOR=2 -DQT_VERSION_PATCH=0 -DQT_VERSION_STR=\"6.2.0\" -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DCMAKE_INTDIR=\"Debug\" -I/home/tjmaciei/obj/qt/qt6/qtbase/src/corelib/Core_autogen/include_Debug -I/home/tjmaciei/obj/qt/qt6/qtbase/include -I/home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore -I/home/tjmaciei/src/qt/qt6/qtbase/src/corelib -I/home/tjmaciei/obj/qt/qt6/qtbase/src/corelib -I/home/tjmaciei/obj/qt/qt6/qtbase/src/corelib/global -I/home/tjmaciei/obj/qt/qt6/qtbase/src/corelib/kernel -I/home/tjmaciei/src/qt/qt6/qtbase/src/corelib/../3rdparty/tinycbor/src -I/home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/6.2.0 -I/home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/6.2.0/QtCore -I/home/tjmaciei/src/qt/qt6/qtbase/src/corelib/../3rdparty/forkfd -I/home/tjmaciei/obj/qt/qt6/qtbase/src/corelib/.rcc -I/home/tjmaciei/obj/qt/qt6/qtbase/mkspecs/linux-g++-optimised -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/home/tjmaciei/obj/qt/qt6/qtbase/src/xml/Xml_autogen/include_Debug -I/home/tjmaciei/obj/qt/qt6/qtbase/include/QtXml -I/home/tjmaciei/src/qt/qt6/qtbase/src/xml -I/home/tjmaciei/obj/qt/qt6/qtbase/src/xml -I/home/tjmaciei/obj/qt/qt6/qtbase/include/QtXml/6.2.0 -I/home/tjmaciei/obj/qt/qt6/qtbase/include/QtXml/6.2.0/QtXml -I/home/tjmaciei/src/qt/qt6/qtbase/src/tools/bootstrap/.. -I/home/tjmaciei/src/qt/qt6/qtbase/src/tools/bootstrap/../../3rdparty/tinycbor/src -O0 -g3 -O0 -g3 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -ffunction-sections -fdata-sections -pthread -std=gnu++17 -MD -MT src/tools/bootstrap/CMakeFiles/Bootstrap.dir/Debug/__/__/corelib/text/qbytearraymatcher.cpp.o -MF src/tools/bootstrap/CMakeFiles/Bootstrap.dir/Debug/__/__/corelib/text/qbytearraymatcher.cpp.o.d -o src/tools/bootstrap/CMakeFiles/Bootstrap.dir/Debug/__/__/corelib/text/qbytearraymatcher.cpp.o -c /home/tjmaciei/src/qt/qt6/qtbase/src/corelib/text/qbytearraymatcher.cpp
      [...]
      [336/337] cd /home/tjmaciei/src/qt/qt6/qtbase/src/corelib && /usr/bin/perl /home/tjmaciei/src/qt/qt6/qtbase/mkspecs/features/data/unix/findclasslist.pl < /home/tjmaciei/obj/qt/qt6/qtbase/src/corelib/Core.version.in > /home/tjmaciei/obj/qt/qt6/qtbase/src/corelib/Core.version && cd /home/tjmaciei/obj/qt/qt6/qtbase && /home/tjmaciei/bin/g++ -fPIC -O0 -g3 -O0 -g3  -Wl,-O1 -Wl,--as-needed   -Wl,-Bsymbolic-functions -Wl,--version-script,/home/tjmaciei/obj/qt/qt6/qtbase/src/corelib/Core.version -Wl,--no-undefined -Wl,-e,qt_core_boilerplate -Wl,--dynamic-list=/home/tjmaciei/src/qt/qt6/qtbase/src/corelib/QtCore.dynlist -Wl,--enable-new-dtags -shared -Wl,-soname,libQt6Core.t.so.6 -o lib/libQt6Core.t.so.6.2.0 src/corelib/CMakeFiles/Core.dir/Debug/Core_autogen/mocs_compilation_Debug.cpp.o src/corelib/CMakeFiles/Core.dir/Debug/compat/removed_api.cpp.o src/corelib/CMakeFiles/Core.dir/Debug/global/archdetect.cpp.o src/corelib/CMakeFiles/Core.dir/Debug/global/qendian.cpp.o src/corelib/CMakeFiles/Core.dir/Debug/global/qfloat16.cpp.o src/corelib/CMakeFiles/Core.dir/Debug/global/qglobal.cpp.o [...]  -Wl,-rpath,"\$ORIGIN:"  -lm  /usr/lib64/libicui18n.so  /usr/lib64/libicuuc.so  /usr/lib64/libicudata.so  /usr/lib64/libzstd.so  -ldl  /usr/lib64/libglib-2.0.so  -pthread  /usr/lib64/libsystemd.so  /usr/lib64/libz.so  /usr/lib64/libdouble-conversion.so.3.1.5  /usr/lib64/libb2.so  /usr/lib64/libpcre2-16.so  /usr/lib64/libgthread-2.0.so  /usr/lib64/librt.so && :
      [337/337] /usr/bin/cmake -E cmake_symlink_library lib/libQt6Core.t.so.6.2.0  lib/libQt6Core.t.so.6 lib/libQt6Core.t.so && :
      

      "uic:Release" is again release:

      $ ninja -v uic:Release
      [1/18] cd /home/tjmaciei/obj/qt/qt6/qtbase/src/tools/uic && /usr/bin/cmake -E cmake_autogen /home/tjmaciei/obj/qt/qt6/qtbase/src/tools/uic/CMakeFiles/uic_autogen.dir/AutogenInfo.json Release && /usr/bin/cmake -E cmake_autogen /home/tjmaciei/obj/qt/qt6/qtbase/src/tools/uic/CMakeFiles/uic_autogen.dir/AutogenInfo.json RelWithDebInfo && /usr/bin/cmake -E cmake_autogen /home/tjmaciei/obj/qt/qt6/qtbase/src/tools/uic/CMakeFiles/uic_autogen.dir/AutogenInfo.json Debug && /usr/bin/cmake -E touch /home/tjmaciei/obj/qt/qt6/qtbase/src/tools/uic/uic_autogen/timestamp && /usr/bin/cmake -E cmake_transform_depfile "Ninja Multi-Config" gccdepfile /home/tjmaciei/src/qt/qt6/qtbase /home/tjmaciei/src/qt/qt6/qtbase/src/tools/uic /home/tjmaciei/obj/qt/qt6/qtbase /home/tjmaciei/obj/qt/qt6/qtbase/src/tools/uic /home/tjmaciei/obj/qt/qt6/qtbase/src/tools/uic/uic_autogen/deps /home/tjmaciei/obj/qt/qt6/qtbase/CMakeFiles/d/6d3aeeca377121d517e00504f4d98b21fd6db9114f454ca86b7261aba71ead9d.d
      [2/18] /home/tjmaciei/bin/g++ -DQT_CORE_LIB -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_FOREACH -DQT_UIC -DQT_USE_QSTRINGBUILDER -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DCMAKE_INTDIR=\"Release\" -I/home/tjmaciei/obj/qt/qt6/qtbase/src/tools/uic/uic_autogen/include_Release -I/home/tjmaciei/src/qt/qt6/qtbase/src/tools/uic -I/home/tjmaciei/obj/qt/qt6/qtbase/src/tools/uic -I/home/tjmaciei/src/qt/qt6/qtbase/src/tools/uic/cpp -I/home/tjmaciei/src/qt/qt6/qtbase/src/tools/uic/python -I/home/tjmaciei/src/qt/qt6/qtbase/src/tools/uic/shared -I/home/tjmaciei/obj/qt/qt6/qtbase/include -I/home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore -I/home/tjmaciei/obj/qt/qt6/qtbase/mkspecs/linux-g++-optimised -O0 -g3 -O3 -g1 -fPIE -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -fno-exceptions -fPIC -pthread -Werror -Wno-error=cpp -Wno-error=deprecated-declarations -Wno-error=strict-overflow -Wno-error=implicit-fallthrough -Wno-error=deprecated-copy -Wno-error=redundant-move -Wno-error=init-list-lifetime -Wno-error=format-overflow -Wno-error=stringop-overflow -Wno-error=deprecated-enum-enum-conversion -Wno-error=deprecated-enum-float-conversion -no-integrated-cpp -Wno-implicit-fallthrough -std=c++17 -MD -MT src/tools/uic/CMakeFiles/uic.dir/Release/uic_autogen/mocs_compilation_Release.cpp.o -MF src/tools/uic/CMakeFiles/uic.dir/Release/uic_autogen/mocs_compilation_Release.cpp.o.d -o src/tools/uic/CMakeFiles/uic.dir/Release/uic_autogen/mocs_compilation_Release.cpp.o -c /home/tjmaciei/obj/qt/qt6/qtbase/src/tools/uic/uic_autogen/mocs_compilation_Release.cpp
      [...]
      [18/18] : && /home/tjmaciei/bin/g++ -O0 -g3 -O3 -g1 -Wl,-O1 -Wl,--as-needed     -Wl,--enable-new-dtags src/tools/uic/CMakeFiles/uic.dir/Release/uic_autogen/mocs_compilation_Release.cpp.o src/tools/uic/CMakeFiles/uic.dir/Release/cpp/cppwritedeclaration.cpp.o src/tools/uic/CMakeFiles/uic.dir/Release/cpp/cppwriteincludes.cpp.o src/tools/uic/CMakeFiles/uic.dir/Release/cpp/cppwriteinitialization.cpp.o src/tools/uic/CMakeFiles/uic.dir/Release/customwidgetsinfo.cpp.o src/tools/uic/CMakeFiles/uic.dir/Release/databaseinfo.cpp.o src/tools/uic/CMakeFiles/uic.dir/Release/driver.cpp.o src/tools/uic/CMakeFiles/uic.dir/Release/main.cpp.o src/tools/uic/CMakeFiles/uic.dir/Release/python/pythonwritedeclaration.cpp.o src/tools/uic/CMakeFiles/uic.dir/Release/python/pythonwriteimports.cpp.o src/tools/uic/CMakeFiles/uic.dir/Release/shared/language.cpp.o src/tools/uic/CMakeFiles/uic.dir/Release/shared/writeincludesbase.cpp.o src/tools/uic/CMakeFiles/uic.dir/Release/treewalker.cpp.o src/tools/uic/CMakeFiles/uic.dir/Release/ui4.cpp.o src/tools/uic/CMakeFiles/uic.dir/Release/uic.cpp.o src/tools/uic/CMakeFiles/uic.dir/Release/validator.cpp.o -o libexec/uic  -Wl,-rpath,"\$ORIGIN/../lib:/home/tjmaciei/obj/qt/qt6/qtbase/lib:"  lib/libQt6Core.t.so.6.2.0  -pthread && :
      

      The same applies to plugins too.

      This does not happen if you compile using the build-Release.ninja file.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            qtbuildsystem Qt Build System Team
            Reporter:
            thiago Thiago Macieira
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes