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.1k 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.
  • SGaistS SGaist

    You shouldn't need the -l parameter

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

    @SGaist OK, I removed it. Here are the results:

    mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ /opt/Qt/5.8/gcc_64/bin/qmake "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib/" ./mysql.pro
    mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ make
    rm -f libqsqlmysql.so
    g++ -Wl,--no-undefined -Wl,-O1 -Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,\$ORIGIN/../../lib -Wl,-rpath,\$ORIGIN/../../lib -shared -o libqsqlmysql.so .obj/qsql_mysql.o .obj/main.o .obj/moc_qsql_mysql_p.o  -L/usr/lib/ -L/opt/Qt/5.8/gcc_64/lib -lQt5Sql -lQt5Core -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl  
    /usr/bin/ld: cannot find -lz
    /usr/bin/ld: cannot find -lssl
    /usr/bin/ld: cannot find -lcrypto
    collect2: error: ld returned 1 exit status
    Makefile:115: recipe for target '../../../../plugins/sqldrivers/libqsqlmysql.so' failed
    make: *** [../../../../plugins/sqldrivers/libqsqlmysql.so] Error 1
    mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ 
    

    I don't know whether this is progress or a step back. Do I need to specify paths for the libraries that make can't find?

    On a more general note: I notice that I seem to be needing to do a lot of things that aren't mentioned on the page that talks about building this plugin. Is the page incomplete, or is there something atypical about my Qt installation?

    Thanks.

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

      You need the development packages for OpenSSL and zlib.

      That's rather a side effect of the dependencies of the 3rd party that can change over time.

      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

        You need the development packages for OpenSSL and zlib.

        That's rather a side effect of the dependencies of the 3rd party that can change over time.

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

        @SGaist so, I need these?

        https://www.openssl.org/source/openssl-1.1.0e.tar.gz
        http://www.zlib.net/zlib-1.2.11.tar.gz

        They aren't explicitly labeled "development packages" but I'm hoping this is what I need...

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

          It seems you are forgetting you are running Linux ;)

          Use your distributions package manager for that like you did to install the MySQL development package.

          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
          2
          • SGaistS SGaist

            It seems you are forgetting you are running Linux ;)

            Use your distributions package manager for that like you did to install the MySQL development package.

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

            @SGaist believe it or not, I did look there first, but I wasn't sure what to choose. My best guesses would be:

            openssl - Secure Sockets Layer toolkit - cryptographic utility
            zlib1g-dev - compression library - development

            (I found these among the results of an apt-cache search for openssl and zlib.)

            Did I guess well?

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

              Sorry, it's libssl-dev the OpenSSL package is the command line client.
              As for zlib, yes

              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
                #35

                I installed those two, and here is the output:```
                mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ make
                rm -f libqsqlmysql.so
                g++ -Wl,--no-undefined -Wl,-O1 -Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,$ORIGIN/../../lib -Wl,-rpath,$ORIGIN/../../lib -shared -o libqsqlmysql.so .obj/qsql_mysql.o .obj/main.o .obj/moc_qsql_mysql_p.o -L/usr/lib/x86_64-linux-gnu/ -lmysqlclient_r -L/opt/Qt/5.8/gcc_64/lib -lQt5Sql -lQt5Core -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl
                /usr/bin/ld: cannot find -lmysqlclient_r
                collect2: error: ld returned 1 exit status
                Makefile:115: recipe for target '../../../../plugins/sqldrivers/libqsqlmysql.so' failed
                make: *** [../../../../plugins/sqldrivers/libqsqlmysql.so] Error 1
                mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$

                I have a file called "libmysqlclient_r.so.18" in /usr/lib/x86_64-linux-gnu...is this not the library it wants?
                
                Thanks. I appreciate your staying up so late to help me with this.
                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #36

                  It looks like you didn't install the libmysqlclient-dev package.

                  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
                  • SGaistS SGaist

                    It looks like you didn't install the libmysqlclient-dev package.

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

                    @SGaist yes I did. I just tried again, and apt-get confirmed I'm up to date on this package. And according to the file list on the page you linked, the libraries are in the right location:

                    mzimmers@debian:/usr/lib/x86_64-linux-gnu$ pwd
                    /usr/lib/x86_64-linux-gnu
                    mzimmers@debian:/usr/lib/x86_64-linux-gnu$ ls libmy*
                    libmysqlclient.a        libmysqlclient_r.so.18.0.0  libmysqlclient.so.18      libmysqlclient.so.20      libmysqlservices.a
                    libmysqlclient_r.so.18  libmysqlclient.so           libmysqlclient.so.18.0.0  libmysqlclient.so.20.3.4
                    mzimmers@debian:/usr/lib/x86_64-linux-gnu$ 
                    
                    
                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #38

                      There's something strange here, you are missing at least the libmysqlclient_r.so symlink 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

                      mzimmersM 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        There's something strange here, you are missing at least the libmysqlclient_r.so symlink in that folder.

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

                        @SGaist I just did an apt-get remove and another install...same files. Should I file a bug report in the Debian forum?

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

                          Since you have two sets of MySQL libraries there might be something else.

                          Can you post the result of dpkg -l | grep -i mysql ?

                          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

                            Since you have two sets of MySQL libraries there might be something else.

                            Can you post the result of dpkg -l | grep -i mysql ?

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

                            @SGaist :

                            mzimmers@debian:/usr/lib/x86_64-linux-gnu$ sudo dpkg -l | grep -i mysql
                            [sudo] password for mzimmers:
                            ii libmysqlclient-dev 5.7.17-1debian8 amd64 MySQL development headers
                            ii libmysqlclient18:amd64 5.5.54-0+deb8u1 amd64 MySQL database client library
                            ii libmysqlclient20:amd64 5.7.17-1debian8 amd64 MySQL shared client libraries
                            ii libmysqlcppconn7 1.1.3-6 amd64 MySQL Connector for C++ (library)
                            ii libqt5sql5-mysql:amd64 5.3.2+dfsg-4+deb8u2 amd64 Qt 5 MySQL database driver
                            ii mysql-apt-config 0.8.3-1 all Auto configuration for MySQL APT Repo.
                            ii mysql-client 5.7.17-1debian8 amd64 MySQL Client meta package depending on latest version
                            ii mysql-common 5.7.17-1debian8 amd64 MySQL Common
                            ii mysql-community-client 5.7.17-1debian8 amd64 MySQL Client
                            ii mysql-community-server 5.7.17-1debian8 amd64 MySQL Server
                            ii mysql-community-source 5.7.17-1debian8 amd64 MySQL source
                            ii mysql-server 5.7.17-1debian8 amd64 MySQL Server meta package depending on latest version
                            ii mysql-workbench 6.2.3+dfsg-7 amd64 MySQL Workbench - a visual database modeling, administration and queuing tool
                            ii mysql-workbench-data 6.2.3+dfsg-7 all MySQL Workbench -- architecture independent data
                            ii python-mysql.connector 1.2.3-2 all pure Python implementation of MySQL Client/Server protocol
                            mzimmers@debian:/usr/lib/x86_64-linux-gnu$

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

                              There's something fishy here, you have two sets of mysql client libraries and the dev package you have matches the libmysqlclient20 while the one I was suggesting is matching libmysqlclient18. I'd remove the XX20 related packages and re-install the libmysqlclient-dev for 18.

                              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 mzimmers

                                @SGaist :

                                mzimmers@debian:/usr/lib/x86_64-linux-gnu$ sudo dpkg -l | grep -i mysql
                                [sudo] password for mzimmers:
                                ii libmysqlclient-dev 5.7.17-1debian8 amd64 MySQL development headers
                                ii libmysqlclient18:amd64 5.5.54-0+deb8u1 amd64 MySQL database client library
                                ii libmysqlclient20:amd64 5.7.17-1debian8 amd64 MySQL shared client libraries
                                ii libmysqlcppconn7 1.1.3-6 amd64 MySQL Connector for C++ (library)
                                ii libqt5sql5-mysql:amd64 5.3.2+dfsg-4+deb8u2 amd64 Qt 5 MySQL database driver
                                ii mysql-apt-config 0.8.3-1 all Auto configuration for MySQL APT Repo.
                                ii mysql-client 5.7.17-1debian8 amd64 MySQL Client meta package depending on latest version
                                ii mysql-common 5.7.17-1debian8 amd64 MySQL Common
                                ii mysql-community-client 5.7.17-1debian8 amd64 MySQL Client
                                ii mysql-community-server 5.7.17-1debian8 amd64 MySQL Server
                                ii mysql-community-source 5.7.17-1debian8 amd64 MySQL source
                                ii mysql-server 5.7.17-1debian8 amd64 MySQL Server meta package depending on latest version
                                ii mysql-workbench 6.2.3+dfsg-7 amd64 MySQL Workbench - a visual database modeling, administration and queuing tool
                                ii mysql-workbench-data 6.2.3+dfsg-7 all MySQL Workbench -- architecture independent data
                                ii python-mysql.connector 1.2.3-2 all pure Python implementation of MySQL Client/Server protocol
                                mzimmers@debian:/usr/lib/x86_64-linux-gnu$

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

                                I can do that. Here's a snippet of my CLI:

                                mzimmers@debian:/usr/lib/x86_64-linux-gnu$ apt list --installed | grep libmysqlclient
                                
                                WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts.
                                
                                libmysqlclient-dev/unknown,now 5.7.17-1debian8 amd64 [installed]
                                libmysqlclient18/stable,now 5.5.54-0+deb8u1 amd64 [installed,automatic]
                                libmysqlclient20/unknown,now 5.7.17-1debian8 amd64 [installed,automatic]
                                mzimmers@debian:/usr/lib/x86_64-linux-gnu$ sudo apt-get remove libmysqlclient20
                                [sudo] password for mzimmers: 
                                Reading package lists... Done
                                Building dependency tree       
                                Reading state information... Done
                                The following packages will be REMOVED:
                                  libmysqlclient-dev libmysqlclient20
                                0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
                                After this operation, 11.4 MB disk space will be freed.
                                Do you want to continue? [Y/n] y
                                (Reading database ... 156868 files and directories currently installed.)
                                Removing libmysqlclient-dev (5.7.17-1debian8) ...
                                Removing libmysqlclient20:amd64 (5.7.17-1debian8) ...
                                Processing triggers for man-db (2.7.0.2-5) ...
                                Processing triggers for libc-bin (2.19-18+deb8u7) ...
                                mzimmers@debian:/usr/lib/x86_64-linux-gnu$ apt list --installed | grep libmysqlclient
                                
                                WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts.
                                
                                libmysqlclient18/stable,now 5.5.54-0+deb8u1 amd64 [installed,automatic]
                                mzimmers@debian:/usr/lib/x86_64-linux-gnu$ 
                                

                                As you can see, when I removed version 20, removed the development package as well. Should I reinstall both that, and version 18?

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

                                  You still have the stable 18 installed so you should only need to install the dev package. Ensure that is also comes from the stable repo and you should be fine.

                                  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
                                    #45

                                    I did an apt-cache show libmysqlclient-dev and it gave me 3 choices (omitted for brevity). How do I know which one I want (all different versions) and how do I make this selection?

                                    Thanks.

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

                                      The one that is marked 5.5.54-0+deb8u1

                                      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
                                      • SGaistS SGaist

                                        The one that is marked 5.5.54-0+deb8u1

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

                                        @SGaist I believe we have lift-off! (that's American for a good thing) I now have that file, and make and make install both completed successfully. Along the way, I got rid of that weird problem with the compiler flag, too.

                                        So, back to the original exercise of building the QMYSQL plugin...I've re-read the page and they don't really say where to find it, or how to get Creator to pick it up. (I've never used plugins before, it that isn't obvious by now.) How do I check to see that it's available to Creator?

                                        This was a good learning experience...thanks for all the help, SGaist.

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

                                          Good !

                                          Since you've called make install your original plugin should have been replaced by the one you just built. It will be loaded as before automatically for you but this time it should be successful.

                                          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

                                          • Login

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