Getting an unexpected compiler flag



  • hi, all -

    I recently began experimentation with building the MySQL driver plugin. One leftover problem from that effort is that, somehow I'm getting a compiler flag that I don't want, and makes building impossible.

    The flag is "-std=c++1z". My version (4.9.2) of the compiler doesn't support it. I have absolutely no idea where this flag is coming from. I'm building from the command line instead of the .pro file (I have a different issue with trying to use Creator; I'll start a thread on that later if necessary.)

    Here's my mysql.pro file:

    TARGET = qsqlmysql
    
    HEADERS += $$PWD/qsql_mysql_p.h
    SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp
    
    QMAKE_USE += mysql
    
    OTHER_FILES += mysql.json
    
    PLUGIN_CLASS_NAME = QMYSQLDriverPlugin
    include(../qsqldriverbase.pri)
    

    I'm really at a loss on this one. Can anyone proffer a suggestion?

    Thank you.


  • Qt Champions 2016

    @mzimmers said in Getting an unexpected compiler flag:

    -std=c++1z"

    Ehh is that not >2014 c++ ?
    How can you get that flag with gcc 4.9 ??

    Did you check qsqldriverbase.pri ?



  • Yes, that flag demands the very latest version of the compiler. I asked about updating my compiler, and was told that could be a bad idea.

    Here's the contents of the .pri file:

    QT  = core core-private sql-private
    
    PLUGIN_TYPE = sqldrivers
    load(qt_plugin)
    
    DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
    

    I don't know what that load(qt_plugin) does, but I don't think that's where this flag is being generated.


  • Qt Champions 2016

    @mzimmers

    Hmm nothing funky there.
    If you are on linux, why not try to grep for -std=c++1z in all files ?
    grep --include=*.{c,h} -rnw '/path/to/somewhere/' -e "pattern"
    or
    grep -Ril "text-to-find-here" /

    It must be there. also strace can show files it loads ( if via system)?

    It must be there somewhere :)



  • @mrjj this is all I found:

    mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ sudo grep --include=*.{c,h} -rnw '/' -e "-std=c++1z"
    [sudo] password for mzimmers: 
    /opt/arm-toolchain/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/6.2.1/plugin/include/options.h:6509:  OPT_std_c__1z = 1294,                      /* -std=c++1z */
    mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ sudo grep --include=*.{c,h} -rnw '/' -e "OPT_std_c__1z"
    /opt/arm-toolchain/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/6.2.1/plugin/include/options.h:6509:  OPT_std_c__1z = 1294,                      /* -std=c++1z */
    mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ 
    

    The line that the first search found is in an area I only use for cross development. I ran the second search for OPT_std_c__1z just to see if that showed up anywhere, but as you can see, nothing additional was found. Your 2nd grep command didn't work:

    mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ grep -Ril "-std=c++1z" /
    grep: invalid option -- 't'
    Usage: grep [OPTION]... PATTERN [FILE]...
    Try 'grep --help' for more information.
    mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ 
    

    I'm not sure how strace would be used to help with this...


  • Qt Champions 2016

    @mzimmers
    oh sorry. didn't have lin box to test on :)

    Hmm so your cross compiler is 6.2?

    Just to be clear. The 4.9 u are using is not for cross compile and for some reason
    it gets the flag?



  • I'm using 4.9.2 for everything now. That directory is leftover (somehow didn't get removed when I uninstalled 6.2.1) and I should probably get rid of it, but I don't think that's causing this problem.

    I ran this grep (note the added files searched):

    mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ sudo grep --include=*.{c,cpp,h,conf} -rnw '/' -e "QMAKE_CXXFLAGS_CXX1Z"
    /home/mzimmers/QtStuff/qtbase/mkspecs/linux-icc/qmake.conf:63:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /home/mzimmers/QtStuff/qtbase/mkspecs/macx-icc/qmake.conf:57:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /home/mzimmers/QtStuff/qtbase/mkspecs/win32-g++/qmake.conf:63:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /home/mzimmers/QtStuff/qtbase/mkspecs/win32-icc/qmake.conf:61:#QMAKE_CXXFLAGS_CXX1Z    = -Qstd=c++1z
    /home/mzimmers/QtStuff/qtbase/mkspecs/common/clang.conf:31:QMAKE_CXXFLAGS_CXX1Z             = -std=c++1z
    /home/mzimmers/QtStuff/qtbase/mkspecs/common/android-base-tail.conf:41:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /home/mzimmers/QtStuff/qtbase/mkspecs/common/g++-base.conf:32:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /home/mzimmers/QtStuff/qtbase/mkspecs/common/qcc-base-qnx.conf:47:QMAKE_CXXFLAGS_CXX1Z    = -Wc,-std=gnu++1z
    /opt/Qt/5.8/src/qtbase/mkspecs/linux-icc/qmake.conf:63:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/Qt/5.8/src/qtbase/mkspecs/macx-icc/qmake.conf:57:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/Qt/5.8/src/qtbase/mkspecs/win32-g++/qmake.conf:63:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/Qt/5.8/src/qtbase/mkspecs/win32-icc/qmake.conf:61:#QMAKE_CXXFLAGS_CXX1Z    = -Qstd=c++1z
    /opt/Qt/5.8/src/qtbase/mkspecs/common/clang.conf:31:QMAKE_CXXFLAGS_CXX1Z             = -std=c++1z
    /opt/Qt/5.8/src/qtbase/mkspecs/common/android-base-tail.conf:41:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/Qt/5.8/src/qtbase/mkspecs/common/g++-base.conf:32:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/Qt/5.8/src/qtbase/mkspecs/common/qcc-base-qnx.conf:47:QMAKE_CXXFLAGS_CXX1Z    = -Wc,-std=gnu++1z
    /opt/Qt/5.8/Src/qtbase/mkspecs/linux-icc/qmake.conf:63:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/Qt/5.8/Src/qtbase/mkspecs/macx-icc/qmake.conf:57:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/Qt/5.8/Src/qtbase/mkspecs/win32-g++/qmake.conf:63:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/Qt/5.8/Src/qtbase/mkspecs/win32-icc/qmake.conf:61:#QMAKE_CXXFLAGS_CXX1Z    = -Qstd=c++1z
    /opt/Qt/5.8/Src/qtbase/mkspecs/common/clang.conf:31:QMAKE_CXXFLAGS_CXX1Z             = -std=c++1z
    /opt/Qt/5.8/Src/qtbase/mkspecs/common/android-base-tail.conf:41:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/Qt/5.8/Src/qtbase/mkspecs/common/g++-base.conf:32:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/Qt/5.8/Src/qtbase/mkspecs/common/qcc-base-qnx.conf:47:QMAKE_CXXFLAGS_CXX1Z    = -Wc,-std=gnu++1z
    /opt/Qt/5.8/gcc_64/mkspecs/linux-icc/qmake.conf:63:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/Qt/5.8/gcc_64/mkspecs/macx-icc/qmake.conf:57:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/Qt/5.8/gcc_64/mkspecs/win32-g++/qmake.conf:63:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/Qt/5.8/gcc_64/mkspecs/win32-icc/qmake.conf:61:#QMAKE_CXXFLAGS_CXX1Z    = -Qstd=c++1z
    /opt/Qt/5.8/gcc_64/mkspecs/common/clang.conf:31:QMAKE_CXXFLAGS_CXX1Z             = -std=c++1z
    /opt/Qt/5.8/gcc_64/mkspecs/common/android-base-tail.conf:41:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/Qt/5.8/gcc_64/mkspecs/common/g++-base.conf:32:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/Qt/5.8/gcc_64/mkspecs/common/qcc-base-qnx.conf:47:QMAKE_CXXFLAGS_CXX1Z    = -Wc,-std=gnu++1z
    /opt/arm-toolchain/sysroot-glibc-linaro-2.23-2016.11-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/linux-icc/qmake.conf:63:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/arm-toolchain/sysroot-glibc-linaro-2.23-2016.11-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/macx-icc/qmake.conf:57:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/arm-toolchain/sysroot-glibc-linaro-2.23-2016.11-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/win32-g++/qmake.conf:63:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/arm-toolchain/sysroot-glibc-linaro-2.23-2016.11-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/win32-icc/qmake.conf:61:#QMAKE_CXXFLAGS_CXX1Z    = -Qstd=c++1z
    /opt/arm-toolchain/sysroot-glibc-linaro-2.23-2016.11-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/common/clang.conf:31:QMAKE_CXXFLAGS_CXX1Z             = -std=c++1z
    /opt/arm-toolchain/sysroot-glibc-linaro-2.23-2016.11-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/common/android-base-tail.conf:41:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/arm-toolchain/sysroot-glibc-linaro-2.23-2016.11-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/common/g++-base.conf:32:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/arm-toolchain/sysroot-glibc-linaro-2.23-2016.11-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/common/qcc-base-qnx.conf:47:QMAKE_CXXFLAGS_CXX1Z    = -Wc,-std=gnu++1z
    /opt/arm-toolchain/sysroot-eglibc-linaro-2017.01-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/linux-icc/qmake.conf:63:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/arm-toolchain/sysroot-eglibc-linaro-2017.01-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/macx-icc/qmake.conf:57:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/arm-toolchain/sysroot-eglibc-linaro-2017.01-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/win32-g++/qmake.conf:63:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/arm-toolchain/sysroot-eglibc-linaro-2017.01-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/win32-icc/qmake.conf:61:#QMAKE_CXXFLAGS_CXX1Z    = -Qstd=c++1z
    /opt/arm-toolchain/sysroot-eglibc-linaro-2017.01-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/common/clang.conf:31:QMAKE_CXXFLAGS_CXX1Z             = -std=c++1z
    /opt/arm-toolchain/sysroot-eglibc-linaro-2017.01-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/common/android-base-tail.conf:41:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/arm-toolchain/sysroot-eglibc-linaro-2017.01-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/common/g++-base.conf:32:QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
    /opt/arm-toolchain/sysroot-eglibc-linaro-2017.01-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/common/qcc-base-qnx.conf:47:QMAKE_CXXFLAGS_CXX1Z    = -Wc,-std=gnu++1z
    

    Nothing here looks particularly interesting. Can you think of any other file types that might sneak in a compiler flag?


  • Qt Champions 2016

    @mzimmers

    Hi
    Its a bit odd where it comes from since you do it by shell.

    I was wondering. Did you compile Qt (arm) with much newer compiler and then
    later went back to the 4.9 one but Qt is still compiled with the other?


  • Qt Champions 2016

    Hi
    Can you please look here
    http://lists.qt-project.org/pipermail/interest/2016-September/024454.html

    seems you can call qmake with -d to see where stuff comes from.
    Maybe we can use that :)



  • Hi, mrjj -

    1. I honestly don't remember what I used to build Qt for my ARM, but I think I built it with 4.9.2. I really don't think the ARM toolchain is what's causing this problem, though.

    2. the -d option on qmake creates a tremendous amount of output...way too much to post here. I tried redirecting to a file using "> debug.out" at the end, but that didn't work. (I'm still new to the shell interface.)

    EDIT: I looked through the output and found instances of that compiler flag in various .prf files:

    sudo grep --include=*.{,prf} -rnw '/' -e "QMAKE_CXXFLAGS_CXX1Z"
    [sudo] password for mzimmers: 
    mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ sudo grep --include=*.{,prf} -rnw '/' -e "1z"
    /home/mzimmers/QtStuff/qtbase/mkspecs/features/default_post.prf:98:c++11|c++14|c++1z {
    /home/mzimmers/QtStuff/qtbase/mkspecs/features/default_post.prf:101:        c++1z:       cxxstd = CXX1Z
    /home/mzimmers/QtStuff/qtbase/mkspecs/features/qt_common.prf:17:qtConfig(c++1z): CONFIG += c++1z
    /opt/Qt/5.8/src/qtbase/mkspecs/features/default_post.prf:98:c++11|c++14|c++1z {
    /opt/Qt/5.8/src/qtbase/mkspecs/features/default_post.prf:101:        c++1z:       cxxstd = CXX1Z
    /opt/Qt/5.8/src/qtbase/mkspecs/features/qt_common.prf:17:qtConfig(c++1z): CONFIG += c++1z
    /opt/Qt/5.8/Src/qtbase/mkspecs/features/default_post.prf:98:c++11|c++14|c++1z {
    /opt/Qt/5.8/Src/qtbase/mkspecs/features/default_post.prf:101:        c++1z:       cxxstd = CXX1Z
    /opt/Qt/5.8/Src/qtbase/mkspecs/features/qt_common.prf:17:qtConfig(c++1z): CONFIG += c++1z
    /opt/Qt/5.8/gcc_64/mkspecs/features/default_post.prf:98:c++11|c++14|c++1z {
    /opt/Qt/5.8/gcc_64/mkspecs/features/default_post.prf:101:        c++1z:       cxxstd = CXX1Z
    /opt/Qt/5.8/gcc_64/mkspecs/features/qt_common.prf:17:qtConfig(c++1z): CONFIG += c++1z
    /opt/arm-toolchain/sysroot-glibc-linaro-2.23-2016.11-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/features/default_post.prf:98:c++11|c++14|c++1z {
    /opt/arm-toolchain/sysroot-glibc-linaro-2.23-2016.11-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/features/default_post.prf:101:        c++1z:       cxxstd = CXX1Z
    /opt/arm-toolchain/sysroot-glibc-linaro-2.23-2016.11-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/features/qt_common.prf:17:qtConfig(c++1z): CONFIG += c++1z
    /opt/arm-toolchain/sysroot-eglibc-linaro-2017.01-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/features/default_post.prf:98:c++11|c++14|c++1z {
    /opt/arm-toolchain/sysroot-eglibc-linaro-2017.01-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/features/default_post.prf:101:        c++1z:       cxxstd = CXX1Z
    /opt/arm-toolchain/sysroot-eglibc-linaro-2017.01-arm-linux-gnueabihf/home/mzimmers/QtForBBB/mkspecs/features/qt_common.prf:17:qtConfig(c++1z): CONFIG += c++1z
    mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ 
    

    I don't know much at all about these .prf files, but lines like this make me wonder:

    qtConfig(c++1z): CONFIG += c++1z
    

Log in to reply
 

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