Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Compiling Qt5 from source for Clang
Forum Updated to NodeBB v4.3 + New Features

Compiling Qt5 from source for Clang

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
3 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jdenozi
    wrote on 24 Aug 2022, 09:52 last edited by jdenozi
    #1

    Qt 5.15.2 for clang
    I'm trying to compile the Qt5.15.2 from source code for clang usage (need C++20 for the project).
    I already done it on Ubuntu 20 and know trying on Ubuntu 22 without any success.

    What I've done :

    (1) LLVM installation :

    • Getting source code :
    git clone https://github.com/llvm/llvm-project.git
    
    • Configure and build:
    cd llvm-project &&
    mkdir build     &&
    cd build        &&
    cmake -S ../llvm                           \\
    -B .                                       \\
    -G Ninja                                   \\
    -DLLVM_ENABLE_PROJECTS=clang               \\
    -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"  \\
    -DCMAKE_INSTALL_PREFIX=/usr/local/         \\
    -DCMAKE_BUILD_TYPE=Release                 \\
    
    cmake --build . parallel
    

    (2) Qt installation

    • Download : https://download.qt.io/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz
    • Download dependencies like xorg etc...
    • Setting installation prefix to
    /opt/qt5
    
    • Then configure
    ./configure -prefix /opt/qt5 -platform linux-clang-libc++ -linker ldd
    

    (3) Error encountered
    Unfortunately I can't configure because I have linker error.

    Creating qmake...
    ./usr/bin/ld : /usr/bin/ld: DWARF error: invalid or unhandled FORM value: 0x23
    qlogging.o : dans la fonction « std::__throw_bad_array_new_lengthabi:v15000 » :
    qlogging.cpp:(.text._ZSt28__throw_bad_array_new_lengthB6v15000v[_ZSt28__throw_bad_array_new_lengthB6v15000v]+0x1a) : référence indéfinie vers « std::bad_array_new_length::bad_array_new_length() »
    /usr/bin/ld : /usr/bin/ld: DWARF error: invalid or unhandled FORM value: 0x23
    qsettings.o : dans la fonction « std::__1::unique_lock<QMutex>::unlock() » :
    qsettings.cpp:(.text._ZNSt3__111unique_lockI6QMutexE6unlockEv[_ZNSt3__111unique_lockI6QMutexE6unlockEv]+0x2b) : référence indéfinie vers « std::__1::__throw_system_error(int, char const*) »
    /usr/bin/ld : qsettings.o : dans la fonction « std::__1::unique_lock<QMutex>::lock() » :
    qsettings.cpp:(.text._ZNSt3__111unique_lockI6QMutexE4lockEv[_ZNSt3__111unique_lockI6QMutexE4lockEv]+0x2b) : référence indéfinie vers « std::__1::__throw_system_error(int, char const*) »
    /usr/bin/ld : qsettings.cpp:(.text._ZNSt3__111unique_lockI6QMutexE4lockEv[_ZNSt3__111unique_lockI6QMutexE4lockEv]+0x4a) : référence indéfinie vers « std::__1::__throw_system_error(int, char const*) »
    /usr/bin/ld : /usr/bin/ld: DWARF error: invalid or unhandled FORM value: 0x23
    qstring.o : dans la fonction « void std::__1::__sort_impl[abi:v15000]<std::__1::_ClassicAlgPolicy, int*, std::__1::__less<int, int> >(int*, int*, std::__1::__less<int, int>&) » :
    qstring.cpp:(.text.ZNSt3__111__sort_implB6v15000INS_17_ClassicAlgPolicyEPiNS_6__lessIiiEEEEvT0_S5_RT1[ZNSt3__111__sort_implB6v15000INS_17_ClassicAlgPolicyEPiNS_6__lessIiiEEEEvT0_S5_RT1]+0x53) : référence indéfinie vers « void std::__1::__sort<std::__1::__less<int, int>&, int*>(int*, int*, std::__1::__less<int, int>&) »
    clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
    

    My gcc seems to be ok:

    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
    OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
    OFFLOAD_TARGET_DEFAULT=1
    Target: x86_64-linux-gnu
    Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.2.0-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-gBFGDP/gcc-11-11.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-gBFGDP/gcc-11-11.2.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
    Thread model: posix
    Supported LTO compression algorithms: zlib zstd
    gcc version 11.2.0 (Ubuntu 11.2.0
    

    What should I do ?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kkoehne
      Moderators
      wrote on 24 Aug 2022, 12:17 last edited by
      #2

      Does it succeed if you don't pass -linker ldd to configure?

      Director R&D, The Qt Company

      J 1 Reply Last reply 24 Aug 2022, 12:39
      0
      • K kkoehne
        24 Aug 2022, 12:17

        Does it succeed if you don't pass -linker ldd to configure?

        J Offline
        J Offline
        jdenozi
        wrote on 24 Aug 2022, 12:39 last edited by
        #3

        @kkoehne No ... doesn't change anything unfortunately. Seems ldd isn't called at all and ld is call by default.

        1 Reply Last reply
        0

        1/3

        24 Aug 2022, 09:52

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved