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. issues with building QMYSQL plugin
Forum Updated to NodeBB v4.3 + New Features

issues with building QMYSQL plugin

Scheduled Pinned Locked Moved Solved Installation and Deployment
59 Posts 3 Posters 23.0k Views 2 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.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #1

    Hi, all -

    My latest adventure is trying to build the QMYSQL plugin. I've tried it from the command line as well as using Creator, and am having issues with both.

    When I issue this command:

    sudo qmake "INCLUDEPATH+=/usr/src/mysql/mysql-5.7.17/include" "LIBS+=-L/usr/lib/x86_64-linux-gnu -lmysqlclient_r" mysql.pro
    

    I get the following:

    /opt/Qt/5.8/Src/qtbase/src/plugins/sqldrivers/qsqldriverbase.pri:4: Unable to find file for inclusion qt_plugin
    Project MESSAGE: Warning: unknown QT: core-private
    Project MESSAGE: Warning: unknown QT: sql-private
    

    It might be noteworthy that I don't have a file named mysqlclient_r, but I do have one (actually a link) named libmysqlclient_r.so.18. Should I use this instead?

    When I try to use Creator, upon attempting to build, I get this:

    error: unrecognized command line option ‘-std=c++1z’
    

    which is puzzling, as I cant' find that flag anywhere.

    When I try to run qmake from Creator, I get this:

    /opt/Qt/5.8/Src/qtbase/mkspecs/features/qt_plugin.prf:62: 
    error: Cannot touch /mkspecs/modules/qt_plugin_qsqlmysql.pri: Operation not permitted.
    

    Which leads me to believe that some Qt variables aren't defined.

    Anyway, I'm fairly lost at this point. Can someone please give me an idea of where I lost my way on this?

    Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You are likely using the wrong qmake. Use the full path to your Qt 5.8 qmake.

      Also since you installed Qt in /opt, your user likely doesn't have the permission to write in that folder.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #3

        You are likely using the wrong qmake. Use the full path to your Qt 5.8 qmake.

        Aargh...someday, I will remember that you've told me this multiple times.

        The correct qmake worked. Now when I run make, I'm getting that compiler flag error. I looked in my Makefile and see this line:

        CXXFLAGS      = -pipe -O2 -std=c++1z ...
        

        So, I'm curious...why am I getting this inclusion now? And, what would you recommend I do about it.

        Also, about installing Qt into /opt...where is the appropriate location for it when installing on Linux? I'd assume it would go somewhere outside of my userspace, right? So that it could be shared if there were multiple users?

        Thanks, SGaist.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          That's the right place when you want a shared installed.

          However, you don't need to build the plugin in-place, you can use an out of source build.

          The compiler flags just indicates that it want's to use the latest available standard.

          What error are you getting exactly ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • mzimmersM Offline
            mzimmersM Offline
            mzimmers
            wrote on last edited by
            #5

            That's pretty much the whole error message on the command line (and in Creator):

            g++: error: unrecognized command line option ‘-std=c++1z’
            

            Is there some verbose flag I could set to try to get more information? My g++ is also in /usr/bin if that makes a difference.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Which version of gcc is it ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • mzimmersM Offline
                mzimmersM Offline
                mzimmers
                wrote on last edited by
                #7
                mzimmers@debian:/opt/Qt/5.8/Src/qtbase/src/plugins/sqldrivers/mysql$ g++ -v
                Using built-in specs.
                COLLECT_GCC=g++
                COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
                Target: x86_64-linux-gnu
                Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.2-10' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
                Thread model: posix
                gcc version 4.9.2 (Debian 4.9.2-10) 
                

                Oh, I see...it's using the old version that I keep to do cross builds to my BBB, isn't it? How best to handle when you want to keep multiple versions of something?

                jsulmJ 1 Reply Last reply
                0
                • mzimmersM mzimmers
                  mzimmers@debian:/opt/Qt/5.8/Src/qtbase/src/plugins/sqldrivers/mysql$ g++ -v
                  Using built-in specs.
                  COLLECT_GCC=g++
                  COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
                  Target: x86_64-linux-gnu
                  Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.2-10' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
                  Thread model: posix
                  gcc version 4.9.2 (Debian 4.9.2-10) 
                  

                  Oh, I see...it's using the old version that I keep to do cross builds to my BBB, isn't it? How best to handle when you want to keep multiple versions of something?

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by jsulm
                  #8

                  @mzimmers c++1z is C++17 - your compiler (GCC 4.9) for sure does not support it. You should check the mysql.pro file and change it to c++11.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  mzimmersM 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @mzimmers c++1z is C++17 - your compiler (GCC 4.9) for sure does not support it. You should check the mysql.pro file and change it to c++11.

                    mzimmersM Offline
                    mzimmersM Offline
                    mzimmers
                    wrote on last edited by mzimmers
                    #9

                    @jsulm thanks for the reply. I recognize that this flag isn't compatible with my current compiler. Of greater concern to me is: where is this flag coming from? It's not in my .pro file, and none of the other projects I've built using Creator have generated this flag.

                    I'm looking into upgrading my compiler, but someone on the Debian forum told me that this might not be a good idea, so that's on hold for a bit.

                    EDIT: OK, it looks like upgrading my compiler without upgrading the version of Debian I'm running is a bad idea. At this point, it seems like it would be the tail wagging the dog anyway. So, I'm back to this question: where is that flag coming from? Does qmake actually parse the code to the point where it might detect that such a flag would be necessary?

                    Question #2: Sgaist referred to "an out of source build" above. I'm not sure I know what this mean -- does it mean redirecting the output of the build to another directory? If so, is this accomplished with a qmake variable? Because I didn't see one in the documentation that looked like it would alter this.

                    Thanks.

                    jsulmJ 1 Reply Last reply
                    0
                    • mzimmersM mzimmers

                      @jsulm thanks for the reply. I recognize that this flag isn't compatible with my current compiler. Of greater concern to me is: where is this flag coming from? It's not in my .pro file, and none of the other projects I've built using Creator have generated this flag.

                      I'm looking into upgrading my compiler, but someone on the Debian forum told me that this might not be a good idea, so that's on hold for a bit.

                      EDIT: OK, it looks like upgrading my compiler without upgrading the version of Debian I'm running is a bad idea. At this point, it seems like it would be the tail wagging the dog anyway. So, I'm back to this question: where is that flag coming from? Does qmake actually parse the code to the point where it might detect that such a flag would be necessary?

                      Question #2: Sgaist referred to "an out of source build" above. I'm not sure I know what this mean -- does it mean redirecting the output of the build to another directory? If so, is this accomplished with a qmake variable? Because I didn't see one in the documentation that looked like it would alter this.

                      Thanks.

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by jsulm
                      #10

                      @mzimmers qmake does not parse any source code, it only parses pro files. Can you post that pro file or a link to it? This flag should be in that file. You also should check the output of the qmake command, maybe it gives some hints.
                      Out of source simply means that you call qmake and make from a directory outside of the source code you're going to build. This way all the build artefacts are not in the source directory - you keep the source code directory clean.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      mzimmersM 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @mzimmers qmake does not parse any source code, it only parses pro files. Can you post that pro file or a link to it? This flag should be in that file. You also should check the output of the qmake command, maybe it gives some hints.
                        Out of source simply means that you call qmake and make from a directory outside of the source code you're going to build. This way all the build artefacts are not in the source directory - you keep the source code directory clean.

                        mzimmersM Offline
                        mzimmersM Offline
                        mzimmers
                        wrote on last edited by mzimmers
                        #11

                        @jsulm here's the project file. I put in the last line myself.

                        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)
                        
                        QMAKE_CXXFLAGS -= "-std=c++1z"
                        

                        I'm still getting this error, though:

                        /opt/Qt/5.8/Src/qtbase/mkspecs/features/qt_plugin.prf:62: error: Cannot touch /mkspecs/modules/qt_plugin_qsqlmysql.pri: Operation not permitted.
                        

                        It's trying to write to mkspecs as a root directory. I verified this by running as root; it creates a mkspecs root directory. I think the cause is some undefined symbols, as the lines that form this symbol are:

                        38    mod_work_pfx = $$MODULE_QMAKE_OUTDIR/mkspecs/modules
                        44    MODULE_FWD_PRI = $$mod_work_pfx/qt_plugin_$${MODULE}.pri
                        62            touch($$MODULE_FWD_PRI, $$MODULE_PRI)
                        

                        Thanks for any assistance.

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          To avoid losing time, just copy the qtbase module sources in you home folder so you don't have that touch problem.

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • mzimmersM Offline
                            mzimmersM Offline
                            mzimmers
                            wrote on last edited by
                            #13

                            I just tried this; got a few errors. I took care of all but one:

                            error: Project has no top-level .qmake.conf file.

                            I still think there's something wrong with my variables or symbols if it was trying to write to the root directory, though.

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              Did you copy the whole qtbase source ?

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              mzimmersM 1 Reply Last reply
                              0
                              • SGaistS SGaist

                                Did you copy the whole qtbase source ?

                                mzimmersM Offline
                                mzimmersM Offline
                                mzimmers
                                wrote on last edited by
                                #15

                                @SGaist oops...I misread what you said above...sorry. I'm still getting this error, though:

                                /home/mzimmers/QtStuff/qtbase/mkspecs/features/qt_plugin.prf:62: 
                                error: Cannot touch /mkspecs/modules/qt_plugin_qsqlmysql.pri: Operation not permitted.
                                

                                I can try this with root, too, but I'm pretty sure it will indeed write to a directory /mkspecs...it did before.

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  The sources likely have kept their rights. You should call something like sudo chown user:group qtbase -R (replace user and group by your user name and main group).

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  0
                                  • mzimmersM Offline
                                    mzimmersM Offline
                                    mzimmers
                                    wrote on last edited by
                                    #17

                                    User and group IDs are already mine. (They are in the original location as well.)

                                    1 Reply Last reply
                                    0
                                    • SGaistS Offline
                                      SGaistS Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #18

                                      Then are the files read-only ?

                                      Interested in AI ? www.idiap.ch
                                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      mzimmersM 1 Reply Last reply
                                      0
                                      • SGaistS SGaist

                                        Then are the files read-only ?

                                        mzimmersM Offline
                                        mzimmersM Offline
                                        mzimmers
                                        wrote on last edited by
                                        #19

                                        @SGaist No, not for me:

                                        mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ pwd
                                        /home/mzimmers/QtStuff/qtbase/src/plugins/sqldrivers/mysql
                                        mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ ls -l
                                        total 108
                                        -rw-rw-r-- 1 mzimmers mzimmers  2619 Jan 18 09:20 main.cpp
                                        -rw-r--r-- 1 mzimmers mzimmers  8229 Mar 15 20:04 Makefile
                                        -rw-rw-r-- 1 mzimmers mzimmers    40 Jan 18 09:20 mysql.json
                                        -rw-rw-r-- 1 mzimmers mzimmers   250 Mar 15 20:06 mysql.pro
                                        -rw-r--r-- 1 mzimmers mzimmers 23807 Mar 16 17:11 mysql.pro.user
                                        -rw-rw-r-- 1 mzimmers mzimmers 50811 Jan 18 09:20 qsql_mysql.cpp
                                        -rw-rw-r-- 1 mzimmers mzimmers  3952 Jan 18 09:20 qsql_mysql_p.h
                                        -rw-rw-r-- 1 mzimmers mzimmers   204 Jan 18 09:20 README
                                        mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ 
                                        
                                        
                                        1 Reply Last reply
                                        0
                                        • SGaistS Offline
                                          SGaistS Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #20

                                          I just realised there's something fishy with the error message: the path seems to start at the root of the filesystem and doesn't match anything I know from the sources.

                                          Can you try a clean out of source build of the plugin from the console ?

                                          Interested in AI ? www.idiap.ch
                                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          mzimmersM 1 Reply Last reply
                                          1

                                          • Login

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