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

Linker error when configuring with "-sanitize fuzzer-no-link"

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 6.4
    • Fix Version/s: None
    • Component/s: Build System: CMake
    • Labels:
      None
    • Environment:
      Manjaro Linux

      Description

      1. Clone qt with submodule qtbase:
        git clone git://code.qt.io/qt/qt5.git
        cd qt5/
        perl init-repository --module-subset=qtbase
        
      2. Configure these sources to build for using libfuzzer:
        /tmp/qt5/configure -platform linux-clang -opensource -confirm-license -prefix $PWD/qtbase -sanitize fuzzer-no-link
        

        In case that matters, I used a shadow build directory.

      3. Try building this with clang 13:
        VERBOSE=1 cmake --build .
        

        Linking fails:

        [108/1535] : && /usr/bin/clang++ -fsanitize=fuzzer-no-link -DNDEBUG -O2 -Wl,--gc-sections -Wl,--enable-new-dtags qtbase/src/tools/tracegen/CMakeFiles/tracegen.dir/etw.cpp.o qtbase/src/tools/tracegen/CMakeFiles/tracegen.dir/helpers.cpp.o qtbase/src/tools/tracegen/CMakeFiles/tracegen.dir/lttng.cpp.o qtbase/src/tools/tracegen/CMakeFiles/tracegen.dir/panic.cpp.o qtbase/src/tools/tracegen/CMakeFiles/tracegen.dir/provider.cpp.o qtbase/src/tools/tracegen/CMakeFiles/tracegen.dir/qtheaders.cpp.o qtbase/src/tools/tracegen/CMakeFiles/tracegen.dir/tracegen.cpp.o -o qtbase/libexec/tracegen  -Wl,-rpath,"\$ORIGIN/../lib:"  qtbase/src/tools/bootstrap/libBootstrap.a  /usr/lib/libpcre2-16.so && :
        FAILED: qtbase/libexec/tracegen 
        : && /usr/bin/clang++ -fsanitize=fuzzer-no-link -DNDEBUG -O2 -Wl,--gc-sections -Wl,--enable-new-dtags qtbase/src/tools/tracegen/CMakeFiles/tracegen.dir/etw.cpp.o qtbase/src/tools/tracegen/CMakeFiles/tracegen.dir/helpers.cpp.o qtbase/src/tools/tracegen/CMakeFiles/tracegen.dir/lttng.cpp.o qtbase/src/tools/tracegen/CMakeFiles/tracegen.dir/panic.cpp.o qtbase/src/tools/tracegen/CMakeFiles/tracegen.dir/provider.cpp.o qtbase/src/tools/tracegen/CMakeFiles/tracegen.dir/qtheaders.cpp.o qtbase/src/tools/tracegen/CMakeFiles/tracegen.dir/tracegen.cpp.o -o qtbase/libexec/tracegen  -Wl,-rpath,"\$ORIGIN/../lib:"  qtbase/src/tools/bootstrap/libBootstrap.a  /usr/lib/libpcre2-16.so && :
        /usr/bin/ld: qtbase/src/tools/bootstrap/libBootstrap.a(qfile.cpp.o): in function `QFile::rename(QString const&)':
        qfile.cpp:(.text._ZN5QFile6renameERK7QString[_ZN5QFile6renameERK7QString]+0x8f9): undefined reference to `QTemporaryFileName::QTemporaryFileName(QString const&)'
        /usr/bin/ld: qfile.cpp:(.text._ZN5QFile6renameERK7QString[_ZN5QFile6renameERK7QString]+0x93b): undefined reference to `QTemporaryFileName::generateNext()'
        clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
        [109/1535] : && /usr/bin/clang++ -fsanitize=fuzzer-no-link -DNDEBUG -O2 -Wl,--gc-sections -Wl,--enable-new-dtags qtbase/src/tools/cmake_automoc_parser/CMakeFiles/cmake_automoc_parser.dir/main.cpp.o -o qtbase/libexec/cmake_automoc_parser  -Wl,-rpath,"\$ORIGIN/../lib:"  qtbase/src/tools/bootstrap/libBootstrap.a  /usr/lib/libpcre2-16.so && :
        FAILED: qtbase/libexec/cmake_automoc_parser 
        : && /usr/bin/clang++ -fsanitize=fuzzer-no-link -DNDEBUG -O2 -Wl,--gc-sections -Wl,--enable-new-dtags qtbase/src/tools/cmake_automoc_parser/CMakeFiles/cmake_automoc_parser.dir/main.cpp.o -o qtbase/libexec/cmake_automoc_parser  -Wl,-rpath,"\$ORIGIN/../lib:"  qtbase/src/tools/bootstrap/libBootstrap.a  /usr/lib/libpcre2-16.so && :
        /usr/bin/ld: qtbase/src/tools/bootstrap/libBootstrap.a(qfile.cpp.o): in function `QFile::rename(QString const&)':
        qfile.cpp:(.text._ZN5QFile6renameERK7QString[_ZN5QFile6renameERK7QString]+0x8f9): undefined reference to `QTemporaryFileName::QTemporaryFileName(QString const&)'
        /usr/bin/ld: qfile.cpp:(.text._ZN5QFile6renameERK7QString[_ZN5QFile6renameERK7QString]+0x93b): undefined reference to `QTemporaryFileName::generateNext()'
        clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
        [110/1535] /usr/bin/clang++ -DQT_BOOTSTRAPPED -DQT_LEAN_HEADERS=1 -DQT_MOC -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_FOREACH -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_USE_QSTRINGBUILDER -DQT_VERSION_MAJOR=6 -DQT_VERSION_MINOR=4 -DQT_VERSION_PATCH=0 -DQT_VERSION_STR=\"6.4.0\" -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/tmp/qt5/qtbase/src/tools/moc -I/tmp/build-qt/qtbase/src/tools/moc -I/tmp/qt5/qtbase/src/tools/moc/../../3rdparty/tinycbor/src -I/tmp/qt5/qtbase/src/tools/moc/../shared -I/tmp/build-qt/qtbase/src/corelib/Core_autogen/include -I/tmp/build-qt/qtbase/include -I/tmp/build-qt/qtbase/include/QtCore -I/tmp/qt5/qtbase/src/corelib -I/tmp/build-qt/qtbase/src/corelib -I/tmp/build-qt/qtbase/src/corelib/global -I/tmp/build-qt/qtbase/src/corelib/kernel -I/tmp/qt5/qtbase/src/corelib/../3rdparty/tinycbor/src -I/tmp/build-qt/qtbase/include/QtCore/6.4.0 -I/tmp/build-qt/qtbase/include/QtCore/6.4.0/QtCore -I/tmp/qt5/qtbase/src/corelib/../3rdparty/forkfd -I/tmp/build-qt/qtbase/src/corelib/.rcc -I/tmp/build-qt/qtbase/mkspecs/linux-clang -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -fsanitize=fuzzer-no-link -DNDEBUG -O2 -fPIE -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -fno-exceptions -ffunction-sections -fdata-sections -std=c++17 -MD -MT qtbase/src/tools/moc/CMakeFiles/moc.dir/moc.cpp.o -MF qtbase/src/tools/moc/CMakeFiles/moc.dir/moc.cpp.o.d -o qtbase/src/tools/moc/CMakeFiles/moc.dir/moc.cpp.o -c /tmp/qt5/qtbase/src/tools/moc/moc.cpp
        ninja: build stopped: subcommand failed.
        

      I tried this with clang 13 from Manjaro Linux' repository. Doing the same on Ubuntu 20.04 with clang 10 succeeds.

        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:
            rlohning Robert Löhning
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes