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

Building qtbase statically with tests fails

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 6.0.0, 6.1
    • Build System: CMake
    • None
    • cmake 3.19.3
    • Linux/X11
    • 74f549b4026710b484f17cd99dbafb074854bd11 (qt/qtbase/dev)

    Description

      when building qtbase static:

      /usr/bin/cmake -DFEATURE_developer_build=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/bin/gcc-10 -DCMAKE_CXX_COMPILER=/usr/bin/g++-10 -G Ninja -DCMAKE_CXX_FLAGS=-Wfatal-errors /home/andreasbuhr/development/qtdev/qtbase 2>&1 | tee buildlog.txt

      it fails to build with errors like

      FAILED: tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2 
      : && /usr/bin/g++-10 -Wfatal-errors -g -Wl,--gc-sections -Wl,--enable-new-dtags tests/auto/corelib/io/qprocess/testProcessEcho2/CMakeFiles/testProcessEcho2.dir/testProcessEcho2_autogen/mocs_compilation.cpp.o tests/auto/corelib/io/qprocess/testProcessEcho2/CMakeFiles/testProcessEcho2.dir/main.cpp.o -o tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2  lib/libQt6Core.a  lib/libQt6Core_qobject.a  -lpthread  /usr/lib/x86_64-linux-gnu/libz.so  /usr/lib/x86_64-linux-gnu/libdouble-conversion.so  -lm  /usr/lib/x86_64-linux-gnu/libicui18n.so  /usr/lib/x86_64-linux-gnu/libicuuc.so  /usr/lib/x86_64-linux-gnu/libicudata.so  /usr/lib/x86_64-linux-gnu/libpcre2-16.so  -ldl  /usr/lib/x86_64-linux-gnu/libglib-2.0.so  /usr/lib/x86_64-linux-gnu/libgthread-2.0.so  /usr/lib/x86_64-linux-gnu/librt.so  src/corelib/CMakeFiles/Core_resources_1.dir/./.rcc/qrc_mimetypes.cpp.o && :
      /usr/bin/ld: src/corelib/CMakeFiles/Core_resources_1.dir/./.rcc/qrc_mimetypes.cpp.o: in function `qResourceFeatureZlib()':
      /home/andreasbuhr/development/qtdev/qtbase-staticbuild/src/corelib/.rcc/qrc_mimetypes.cpp:21203: undefined reference to `qt_resourceFeatureZlib'
      /usr/bin/ld: src/corelib/CMakeFiles/Core_resources_1.dir/./.rcc/qrc_mimetypes.cpp.o: in function `qInitResources_mimetypes()':
      /home/andreasbuhr/development/qtdev/qtbase-staticbuild/src/corelib/.rcc/qrc_mimetypes.cpp:21218: undefined reference to `qRegisterResourceData(int, unsigned char const*, unsigned char const*, unsigned char const*)'
      /usr/bin/ld: src/corelib/CMakeFiles/Core_resources_1.dir/./.rcc/qrc_mimetypes.cpp.o: in function `qCleanupResources_mimetypes()':
      /home/andreasbuhr/development/qtdev/qtbase-staticbuild/src/corelib/.rcc/qrc_mimetypes.cpp:21228: undefined reference to `qUnregisterResourceData(int, unsigned char const*, unsigned char const*, unsigned char const*)'
      collect2: error: ld returned 1 exit status
      

      The reason is that the order in the linker command line is wrong:

      On the command line,

      src/corelib/CMakeFiles/Core_resources_1.dir/./.rcc/qrc_mimetypes.cpp.o

      appears after

      lib/libQt6Core.a

      . This cannot work, as qrc_mimetypes relies on libQt6Core.a. Changing the linker command line manually from

      /usr/bin/g++-10 -Wfatal-errors -g -Wl,--gc-sections -Wl,--enable-new-dtags tests/auto/corelib/io/qprocess/testProcessEcho2/CMakeFiles/testProcessEcho2.dir/testProcessEcho2_autogen/mocs_compilation.cpp.o tests/auto/corelib/io/qprocess/testProcessEcho2/CMakeFiles/testProcessEcho2.dir/main.cpp.o -o tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2  lib/libQt6Core.a  lib/libQt6Core_qobject.a  -lpthread  /usr/lib/x86_64-linux-gnu/libz.so  /usr/lib/x86_64-linux-gnu/libdouble-conversion.so  -lm  /usr/lib/x86_64-linux-gnu/libicui18n.so  /usr/lib/x86_64-linux-gnu/libicuuc.so  /usr/lib/x86_64-linux-gnu/libicudata.so  /usr/lib/x86_64-linux-gnu/libpcre2-16.so  -ldl  /usr/lib/x86_64-linux-gnu/libglib-2.0.so  /usr/lib/x86_64-linux-gnu/libgthread-2.0.so  /usr/lib/x86_64-linux-gnu/librt.so  src/corelib/CMakeFiles/Core_resources_1.dir/./.rcc/qrc_mimetypes.cpp.o

      to

      /usr/bin/g++-10 -Wfatal-errors -g -Wl,--gc-sections -Wl,--enable-new-dtags tests/auto/corelib/io/qprocess/testProcessEcho2/CMakeFiles/testProcessEcho2.dir/testProcessEcho2_autogen/mocs_compilation.cpp.o tests/auto/corelib/io/qprocess/testProcessEcho2/CMakeFiles/testProcessEcho2.dir/main.cpp.o -o tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2 src/corelib/CMakeFiles/Core_resources_1.dir/./.rcc/qrc_mimetypes.cpp.o lib/libQt6Core.a  lib/libQt6Core_qobject.a  -lpthread  /usr/lib/x86_64-linux-gnu/libz.so  /usr/lib/x86_64-linux-gnu/libdouble-conversion.so  -lm  /usr/lib/x86_64-linux-gnu/libicui18n.so  /usr/lib/x86_64-linux-gnu/libicuuc.so  /usr/lib/x86_64-linux-gnu/libicudata.so  /usr/lib/x86_64-linux-gnu/libpcre2-16.so  -ldl  /usr/lib/x86_64-linux-gnu/libglib-2.0.so  /usr/lib/x86_64-linux-gnu/libgthread-2.0.so  /usr/lib/x86_64-linux-gnu/librt.so

      solves the problem. But one cannot fix each linker command manually.

      Attachments

        1. buildlog.txt
          61 kB
        2. configurelog.txt
          75 kB

        Issue Links

          Activity

            People

              jbornema Joerg Bornemann
              andreasbuhr Andreas Buhr
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: