Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-31458

Duplicate symbols when building with QTC_STATIC_BUILD under flto

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • None
    • Qt Creator 15.0.0
    • Building Qt Creator
    • None
    • Clear Linux, Clang 18.1.6.
    • Linux/X11
    • 30989b807 (master)

    Description

      When building Qt Creator with CMake's QTC_STATIC_BUILD option and using Clang 18.1.6 with LTO:

      mkdir builddir
      export CC=clang
      export CXX=clang++
      export AR=/usr/bin/llvm-ar
      export RANLIB=/usr/bin/llvm-ranlib
      export NM=/usr/bin/llvm-nm
      export CFLAGS="-O3 -flto=thin -fno-plt -fno-semantic-interposition -ffat-lto-objects -fuse-ld=lld -Wl,--lto-O3 -Wl,-O3 -Wno-unused-command-line-argument"
      export LDFLAGS="${CFLAGS}"
      export CXXFLAGS="-fvisibility-inlines-hidden ${CFLAGS}"
      cmake -G Ninja \
        -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
        -DCMAKE_C_FLAGS_RELEASE="${CFLAGS}" \
        -DCMAKE_CXX_FLAGS_RELEASE="${CXXFLAGS}" \
        -DCMAKE_AR=/usr/bin/llvm-ar \
        -DCMAKE_NM=/usr/bin/llvm-nm \
        -DCMAKE_RANLIB=/usr/bin/llvm-ranlib \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_LIBDIR=lib64 \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DWITH_TESTS=OFF \
        -DQTC_STATIC_BUILD=ON \
        -S . \
        -B builddir/
      
      cmake --build builddir/
      

      We get duplicate symbol linking errors:

      ld.lld: error: duplicate symbol: log() in modelindexer.cpp.o
      ld.lld: error: duplicate symbol: log() in qtcreatorintegration.cpp.o
      

      Attachments

        For Gerrit Dashboard: QTCREATORBUG-31458
        # Subject Branch Project Status CR V

        Activity

          People

            con Eike Ziller
            fboni Francisco Boni Neto
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes