Qt 5.10.0 compile with clang on ubuntu 17.10



  • Hi all,

    cause I'm going to develop mobile app using Qt I want to recompile Qt sources using clang due to Google's decision to get rid of GCC support in Android's NDK. But as a first step I just want to compile Qt for desktop ubuntu 17.10 using clang.
    I have installed clang 5.0

    My configure command:

    ../configure -c++std c++1z -platform linux-clang -opensource -nomake examples -nomake tests
    

    Unfortunately it fails with error:
    ERROR: C++11 <random> is required and is missing or failed to compile.
    in output messages I can also find:

    Checking for C++14 support... yes
    Checking for C++1z support... yes
    ...
    Checking for C++11 <future>... no
    Checking for C++11 <random>... no
    

    which makes me quite confused... but output message encourages to check out config.log file for details, so:

    executing config test cxx11_random
    + cd /home/tomek/workspace/qt-dev/qt5/build-5.10.0_x86_64_clang/config.tests/unix/cxx11_random && /home/tomek/workspace/qt-dev/qt5/build-5.10.0_x86_64_clang/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared use_gold_linker warn_off console single_arch" /home/tomek/workspace/qt-dev/qt5/qtbase/config.tests/unix/cxx11_random
    + cd /home/tomek/workspace/qt-dev/qt5/build-5.10.0_x86_64_clang/config.tests/unix/cxx11_random && MAKEFLAGS= /usr/bin/make
    > clang++ -c -pipe -O2 -w -fPIC  -I/home/tomek/workspace/qt-dev/qt5/qtbase/config.tests/unix/cxx11_random -I. -I/home/tomek/workspace/qt-dev/qt5/qtbase/mkspecs/linux-clang -o cxx11_random.o /home/tomek/workspace/qt-dev/qt5/qtbase/config.tests/unix/cxx11_random/cxx11_random.cpp
    > In file included from /home/tomek/workspace/qt-dev/qt5/qtbase/config.tests/unix/cxx11_random/cxx11_random.cpp:29:
    > In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/random:35:
    > /usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/bits/c++0x_warning.h:32:2: error: This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
    > #error This file requires compiler and library support \
    >  ^
    > /home/tomek/workspace/qt-dev/qt5/qtbase/config.tests/unix/cxx11_random/cxx11_random.cpp:33:5: error: use of undeclared identifier 'std'
    >     std::mt19937 mt(0);
    >     ^
    > 2 errors generated.
    

    and second similar log about c++11_future test.
    As log says there is no -std=c++11 or -std=gnu++11 option specified, which can be confirmed few lines above. But I've specified -c++std c++1z option for configure script which should satisfy that build command...
    That make me think there might be a bug somewhere in build system but before I create a ticket I want to ask if anybody see if I'm doing something wrong, or maybe somebody has already observed the same issue?

    Thanks in advance,
    osmial



  • I use QMake and use things like:

    CONFIG += c++17
    

    Perhaps try c++17 instead of c++1z - https://clang.llvm.org/cxx_status.html

    C++17 implementation status
    Clang 5 and later implement all the features of the C++ 2017 Draft International Standard.
    
    You can use Clang in C++17 mode with the -std=c++17 option (use -std=c++1z in Clang 4 and earlier).
    


  • Yes, that's next interesting thing I forgot to mention about in first post.
    When I'm trying with -c++std c++17 (passing this flag to configure script) the output ends with:

    ERROR: Invalid argument c++17 to command line parameter c++std
    
    > clang++ -v
    clang version 5.0.0-3 (tags/RELEASE_500/final)
    Target: x86_64-pc-linux-gnu
    Thread model: posix
    InstalledDir: /usr/bin
    Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/7
    Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/7.2.0
    Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
    Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.1
    Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6
    Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.4.0
    Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
    Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0
    Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/7
    Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/7.2.0
    Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
    Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.1
    Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
    Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.4.0
    Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
    Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.2.0
    Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0
    Candidate multilib: .;@m64
    Selected multilib: .;@M64 
    

    Anybody has tried building latest releases with clang?


  • Moderators

    @osmial said in Qt 5.10.0 compile with clang on ubuntu 17.10:

    c++17

    Then try with c++14



  • I've started without passing this flag to configure script at all. But it failed. Then I've started to experiment with versions - I've tried all from c++11 to c++17.
    For flags c++11 - c++1z output is build error, for c++17 it says this argument is being not recognized.


  • Moderators

    @osmial And what about c++14?



  • By writing c++11 - c++1z I was thinking about range:
    c++11, c++14, c++1z:
    ERROR: C++11 <random> is required and is missing or failed to compile.

    for c++17:
    ERROR: Invalid argument c++17 to command line parameter c++std


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.