Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt static with MySQL issue
Forum Updated to NodeBB v4.3 + New Features

Qt static with MySQL issue

Scheduled Pinned Locked Moved Solved General and Desktop
50 Posts 4 Posters 22.2k 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.
  • C Cobra91151
    30 Dec 2018, 10:37

    @cawlfj

    Hi! I use Qt 5.9.7 and OpenSSL libs: 1.0.2l and MySQL: 5.7.23 because of the compatibility with Win Vista and later. I think it should be better for you to use latest versions of OpenSSL and MySQL to configure Qt 5.12.

    By the way, mysqlclientMT is the name of the MySQL static lib compiled with /MT flag.

    Change the instruction in configure to:

    MYSQL_LIBS="-lmysqlclient -lAdvapi32 -lUser32 -lCrypt32 -lGdi32"

    C Offline
    C Offline
    cawlfj
    wrote on 30 Dec 2018, 11:30 last edited by
    #41

    @Cobra91151
    I try again and got the finally without error. but the qsqlmysql.lib is very small(only 798k).
    can't use .

    C 1 Reply Last reply 30 Dec 2018, 12:08
    0
    • C cawlfj
      30 Dec 2018, 11:30

      @Cobra91151
      I try again and got the finally without error. but the qsqlmysql.lib is very small(only 798k).
      can't use .

      C Offline
      C Offline
      Cobra91151
      wrote on 30 Dec 2018, 12:08 last edited by
      #42

      @cawlfj

      Ok. Here are instructions how to build:

      1. Download the MySQL source from https://dev.mysql.com/downloads/mysql/
      2. Get the OpenSSL source from https://openssl.org/source/openssl-1.0.2l.tar.gz
      3. Extract all archives
      4. Compile static OpenSSL
      5. Compile static MySQL with previously compiled OpenSSL libs

      Read the MySQL and OpenSSL (https://wiki.openssl.org/index.php/Compilation_and_Installation#PREFIX_and_OPENSSLDIR) docs for more details.

      C 2 Replies Last reply 30 Dec 2018, 12:42
      0
      • C Cobra91151
        30 Dec 2018, 12:08

        @cawlfj

        Ok. Here are instructions how to build:

        1. Download the MySQL source from https://dev.mysql.com/downloads/mysql/
        2. Get the OpenSSL source from https://openssl.org/source/openssl-1.0.2l.tar.gz
        3. Extract all archives
        4. Compile static OpenSSL
        5. Compile static MySQL with previously compiled OpenSSL libs

        Read the MySQL and OpenSSL (https://wiki.openssl.org/index.php/Compilation_and_Installation#PREFIX_and_OPENSSLDIR) docs for more details.

        C Offline
        C Offline
        cawlfj
        wrote on 30 Dec 2018, 12:42 last edited by
        #43

        @Cobra91151
        Many thanks for your help.
        I will have a try.

        1 Reply Last reply
        1
        • C Cobra91151
          30 Dec 2018, 12:08

          @cawlfj

          Ok. Here are instructions how to build:

          1. Download the MySQL source from https://dev.mysql.com/downloads/mysql/
          2. Get the OpenSSL source from https://openssl.org/source/openssl-1.0.2l.tar.gz
          3. Extract all archives
          4. Compile static OpenSSL
          5. Compile static MySQL with previously compiled OpenSSL libs

          Read the MySQL and OpenSSL (https://wiki.openssl.org/index.php/Compilation_and_Installation#PREFIX_and_OPENSSLDIR) docs for more details.

          C Offline
          C Offline
          cawlfj
          wrote on 31 Dec 2018, 03:38 last edited by
          #44

          @Cobra91151

          I use below steps and got the openssl

          1:download openssl-1.0.2l
          2: cd c:\openssl-10.2l
          3:perl Configure VC-WIN64A no-asm --prefix=c:/QtOpenSSL64
          4:ms\do_win64a
          5:nmake -f ms\nt.mak
          6: nmake -f ms\nt.mak test if dispaly passed all tests at last row means ok
          7:nmake -f ms\nt.mak install
          There are 2 libs in c:\QtOpenSSL64\lib libeay32.lib ssleay32.lib

          I don't know how to next step mark in your instruction
          5:Compile static MySQL with previously compiled OpenSSL libs
          Cloud you give me more details?
          Many thanks.

          C 1 Reply Last reply 31 Dec 2018, 08:28
          0
          • C cawlfj
            31 Dec 2018, 03:38

            @Cobra91151

            I use below steps and got the openssl

            1:download openssl-1.0.2l
            2: cd c:\openssl-10.2l
            3:perl Configure VC-WIN64A no-asm --prefix=c:/QtOpenSSL64
            4:ms\do_win64a
            5:nmake -f ms\nt.mak
            6: nmake -f ms\nt.mak test if dispaly passed all tests at last row means ok
            7:nmake -f ms\nt.mak install
            There are 2 libs in c:\QtOpenSSL64\lib libeay32.lib ssleay32.lib

            I don't know how to next step mark in your instruction
            5:Compile static MySQL with previously compiled OpenSSL libs
            Cloud you give me more details?
            Many thanks.

            C Offline
            C Offline
            cawlfj
            wrote on 31 Dec 2018, 08:28 last edited by cawlfj
            #45

            @cawlfj
            after got openssl by above 1-7.
            8 :I download mysql connector c " mysql-connector-c-6.1.11-src.zip"
            9: build it by cmake-gui and then got mysqlclient.lib
            10: use below configure command, can see the openssl is yes but mysql is still erro
            ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.

            configure -confirm-license -opensource -release -static -static-runtime -mp -platform win32-msvc -prefix "D:\QT\512M" -openssl-linked OPENSSL_PREFIX=C:\QtOpenSSL64 OPENSSL_LIBS="-lssleay32 -llibeay32 -lgdi32" -sql-mysql MYSQL_PREFIX=C:\mysql MYSQL_LIBS="-lmysqlclient -lAdvapi32 -lUser32 -lCrypt32 -lGdi32" -gui -no-dbus -widgets -qt-zlib -qt-libjpeg -gif -ico -qt-libpng -qt-xkbcommon -qt-freetype -qt-pcre -qt-harfbuzz -opengl desktop -nomake tests -nomake examples -no-compile-examples -skip qttranslations -skip qtserialport -skip qtwebengine -recheck-all

            C 1 Reply Last reply 31 Dec 2018, 11:51
            0
            • C cawlfj
              31 Dec 2018, 08:28

              @cawlfj
              after got openssl by above 1-7.
              8 :I download mysql connector c " mysql-connector-c-6.1.11-src.zip"
              9: build it by cmake-gui and then got mysqlclient.lib
              10: use below configure command, can see the openssl is yes but mysql is still erro
              ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.

              configure -confirm-license -opensource -release -static -static-runtime -mp -platform win32-msvc -prefix "D:\QT\512M" -openssl-linked OPENSSL_PREFIX=C:\QtOpenSSL64 OPENSSL_LIBS="-lssleay32 -llibeay32 -lgdi32" -sql-mysql MYSQL_PREFIX=C:\mysql MYSQL_LIBS="-lmysqlclient -lAdvapi32 -lUser32 -lCrypt32 -lGdi32" -gui -no-dbus -widgets -qt-zlib -qt-libjpeg -gif -ico -qt-libpng -qt-xkbcommon -qt-freetype -qt-pcre -qt-harfbuzz -opengl desktop -nomake tests -nomake examples -no-compile-examples -skip qttranslations -skip qtserialport -skip qtwebengine -recheck-all

              C Offline
              C Offline
              Cobra91151
              wrote on 31 Dec 2018, 11:51 last edited by
              #46

              @cawlfj

              Hi! The problem is that you use MySQL connector. But instead you should download this one:

              alt text

              Extract it and build it with OpenSSL libs (which you previously built).

              Also read it:

              @Cobra91151 said in Qt static with MySQL issue:

              @cawlfj

              Also, this error: ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed. points that your MySQL libs path is wrong in the Qt configure.

              For example:
              my include path and libs path: -I "C:\MySQL\mysql-5.7.23-winx64\release\include" -L "C:\MySQL\mysql-5.7.23-winx64\release\lib"

              Remove the MYSQL_PREFIX="C:/mysql" instruction and change to your paths appropriately.

              Also, I suggest you to create a batch script for Qt compilation.

              C 1 Reply Last reply 31 Dec 2018, 13:09
              0
              • C Cobra91151
                31 Dec 2018, 11:51

                @cawlfj

                Hi! The problem is that you use MySQL connector. But instead you should download this one:

                alt text

                Extract it and build it with OpenSSL libs (which you previously built).

                Also read it:

                @Cobra91151 said in Qt static with MySQL issue:

                @cawlfj

                Also, this error: ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed. points that your MySQL libs path is wrong in the Qt configure.

                For example:
                my include path and libs path: -I "C:\MySQL\mysql-5.7.23-winx64\release\include" -L "C:\MySQL\mysql-5.7.23-winx64\release\lib"

                Remove the MYSQL_PREFIX="C:/mysql" instruction and change to your paths appropriately.

                Also, I suggest you to create a batch script for Qt compilation.

                C Offline
                C Offline
                cawlfj
                wrote on 31 Dec 2018, 13:09 last edited by
                #47

                @Cobra91151
                Dear Cobora91151
                Use mysql connector c and modify the mysql_version.h.in to mysql_version.h
                after configure , the mysql is display yes.
                But after build whole qt , the qsqlmysql.lib is not present.
                I will try mysql community server 8.0.13 .

                C 1 Reply Last reply 31 Dec 2018, 13:59
                0
                • C cawlfj
                  31 Dec 2018, 13:09

                  @Cobra91151
                  Dear Cobora91151
                  Use mysql connector c and modify the mysql_version.h.in to mysql_version.h
                  after configure , the mysql is display yes.
                  But after build whole qt , the qsqlmysql.lib is not present.
                  I will try mysql community server 8.0.13 .

                  C Offline
                  C Offline
                  Cobra91151
                  wrote on 31 Dec 2018, 13:59 last edited by Cobra91151
                  #48

                  @cawlfj

                  I never used MySQL connector, it's only confuses. Open VS 2017 x64 command prompt and navigate to the MySQL source dir and enter these instructions:

                  cmake -DBUILD_SHARED_LIBS=OFF -DLINK_STATIC_RUNTIME_LIBRARIES=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST="C:\Boost" -DWITH_SSL="C:\OpenSSL\openssl-1.0.2l\x64\release" -DOPENSSL_LIBRARY="C:\OpenSSL\openssl-1.0.2l\x64\release\lib\ssleay32MT.lib" -DCRYPTO_LIBRARY="C:\OpenSSL\openssl-1.0.2l\x64\release\lib\libeay32MT.lib" -G "Visual Studio 15 2017 Win64"

                  Change all OpenSSL paths to appropriate yours and follow the instructions from the output. Then open compiled project in the VS 2017 and build it all. After that, you will see mysqlclient lib.

                  Note 1: The only MySQL static lib is mysqlclient.lib
                  Note 2: Check your MySQL libs are compiled with /MT flags with VS 2017 and also before the Qt compilation I suggest to check if it works by creating simple console project.

                  Happy New Year!

                  C 1 Reply Last reply 31 Dec 2018, 15:51
                  1
                  • C Cobra91151
                    31 Dec 2018, 13:59

                    @cawlfj

                    I never used MySQL connector, it's only confuses. Open VS 2017 x64 command prompt and navigate to the MySQL source dir and enter these instructions:

                    cmake -DBUILD_SHARED_LIBS=OFF -DLINK_STATIC_RUNTIME_LIBRARIES=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST="C:\Boost" -DWITH_SSL="C:\OpenSSL\openssl-1.0.2l\x64\release" -DOPENSSL_LIBRARY="C:\OpenSSL\openssl-1.0.2l\x64\release\lib\ssleay32MT.lib" -DCRYPTO_LIBRARY="C:\OpenSSL\openssl-1.0.2l\x64\release\lib\libeay32MT.lib" -G "Visual Studio 15 2017 Win64"

                    Change all OpenSSL paths to appropriate yours and follow the instructions from the output. Then open compiled project in the VS 2017 and build it all. After that, you will see mysqlclient lib.

                    Note 1: The only MySQL static lib is mysqlclient.lib
                    Note 2: Check your MySQL libs are compiled with /MT flags with VS 2017 and also before the Qt compilation I suggest to check if it works by creating simple console project.

                    Happy New Year!

                    C Offline
                    C Offline
                    cawlfj
                    wrote on 31 Dec 2018, 15:51 last edited by
                    #49

                    @Cobra91151
                    Dear Cobra91151
                    As per your instruction , i got mysqlclient.lib (seems it right 33m)
                    Now ,i am doing the command jom -j8 to get qt build.

                    The version will be got in 2019.:)
                    Many thanks for your help!

                    Happy New Year!

                    1 Reply Last reply
                    1
                    • C Offline
                      C Offline
                      cawlfj
                      wrote on 1 Jan 2019, 01:58 last edited by
                      #50

                      @Cobra91151
                      Happy New Year!
                      Many thanks for your help.
                      I got the right qsqlmysql.lib, now everything is ok!

                      1 Reply Last reply
                      1

                      41/50

                      30 Dec 2018, 11:30

                      • Login

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