Qt static with MySQL issue
-
Hi! Try to include to configure:
MYSQL_LIBS="-lmysqlclientMT -lAdvapi32 -lUser32 -lCrypt32 -lGdi32"and also create a simpleMySQLtest project inVS 2017, for example console app to verify that it works:#include <iostream> #include <mysql.h> #include <openssl/bio.h> #include <openssl/ssl.h> #include <openssl/err.h> using namespace std; int main() { cout << "Hello World!" << endl; cout << "Hello!" << endl; SSL_load_error_strings(); ERR_load_BIO_strings(); OpenSSL_add_all_algorithms(); printf("MySQL client version: %s\n", mysql_get_client_info()); system("PAUSE"); return 0; }If you still need help, reply here or in chat and I will try to help.
@Cobra91151
Cloud you give me a copy of mysqlclient.lib qsqlmysql.lib qsqlmysql.prl build by youself with vs2017 x64? my email tigerlfj@126.com
i think the mysqlclient.lib download from web is not for vs2017.
bast regards,
jeff -
@Cobra91151
Cloud you give me a copy of mysqlclient.lib qsqlmysql.lib qsqlmysql.prl build by youself with vs2017 x64? my email tigerlfj@126.com
i think the mysqlclient.lib download from web is not for vs2017.
bast regards,
jeffHi! I use
Qt 5.9.7andOpenSSL libs: 1.0.2landMySQL: 5.7.23because of the compatibility withWin Vistaand later. I think it should be better for you to use latest versions ofOpenSSLandMySQLto configureQt 5.12.By the way,
mysqlclientMTis the name of theMySQLstatic lib compiled with/MTflag.Change the instruction in configure to:
MYSQL_LIBS="-lmysqlclient -lAdvapi32 -lUser32 -lCrypt32 -lGdi32" -
@Cobra91151
Cloud you give me a copy of mysqlclient.lib qsqlmysql.lib qsqlmysql.prl build by youself with vs2017 x64? my email tigerlfj@126.com
i think the mysqlclient.lib download from web is not for vs2017.
bast regards,
jeffAlso, this error:
ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.points that yourMySQLlibs path is wrong in theQtconfigure.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
Qtcompilation. -
Hi! I use
Qt 5.9.7andOpenSSL libs: 1.0.2landMySQL: 5.7.23because of the compatibility withWin Vistaand later. I think it should be better for you to use latest versions ofOpenSSLandMySQLto configureQt 5.12.By the way,
mysqlclientMTis the name of theMySQLstatic lib compiled with/MTflag.Change the instruction in configure to:
MYSQL_LIBS="-lmysqlclient -lAdvapi32 -lUser32 -lCrypt32 -lGdi32"@Cobra91151
I try again and got the finally without error. but the qsqlmysql.lib is very small(only 798k).
can't use . -
@Cobra91151
I try again and got the finally without error. but the qsqlmysql.lib is very small(only 798k).
can't use .Ok. Here are instructions how to build:
- Download the
MySQLsource from https://dev.mysql.com/downloads/mysql/ - Get the
OpenSSLsource from https://openssl.org/source/openssl-1.0.2l.tar.gz - Extract all archives
- Compile static
OpenSSL - Compile static
MySQLwith previously compiledOpenSSLlibs
Read the
MySQLandOpenSSL(https://wiki.openssl.org/index.php/Compilation_and_Installation#PREFIX_and_OPENSSLDIR) docs for more details. - Download the
-
Ok. Here are instructions how to build:
- Download the
MySQLsource from https://dev.mysql.com/downloads/mysql/ - Get the
OpenSSLsource from https://openssl.org/source/openssl-1.0.2l.tar.gz - Extract all archives
- Compile static
OpenSSL - Compile static
MySQLwith previously compiledOpenSSLlibs
Read the
MySQLandOpenSSL(https://wiki.openssl.org/index.php/Compilation_and_Installation#PREFIX_and_OPENSSLDIR) docs for more details.@Cobra91151
Many thanks for your help.
I will have a try. - Download the
-
Ok. Here are instructions how to build:
- Download the
MySQLsource from https://dev.mysql.com/downloads/mysql/ - Get the
OpenSSLsource from https://openssl.org/source/openssl-1.0.2l.tar.gz - Extract all archives
- Compile static
OpenSSL - Compile static
MySQLwith previously compiledOpenSSLlibs
Read the
MySQLandOpenSSL(https://wiki.openssl.org/index.php/Compilation_and_Installation#PREFIX_and_OPENSSLDIR) docs for more details.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.libI 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. - Download the
-
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.libI 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.@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
-
@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
Hi! The problem is that you use
MySQLconnector. But instead you should download this one:
Extract it and build it with
OpenSSLlibs (which you previously built).Also read it:
@Cobra91151 said in Qt static with MySQL issue:
Also, this error:
ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.points that yourMySQLlibs path is wrong in theQtconfigure.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
Qtcompilation. -
Hi! The problem is that you use
MySQLconnector. But instead you should download this one:
Extract it and build it with
OpenSSLlibs (which you previously built).Also read it:
@Cobra91151 said in Qt static with MySQL issue:
Also, this error:
ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.points that yourMySQLlibs path is wrong in theQtconfigure.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
Qtcompilation.@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 . -
@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 .I never used
MySQL connector, it's only confuses. OpenVS 2017 x64command prompt and navigate to theMySQLsource 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
OpenSSLpaths to appropriate yours and follow the instructions from the output. Then open compiled project in theVS 2017and build it all. After that, you will seemysqlclientlib.Note 1: The only
MySQLstatic lib ismysqlclient.lib
Note 2: Check yourMySQLlibs are compiled with/MTflags withVS 2017and also before theQt compilationI suggest to check if it works by creating simple console project.Happy New Year!
-
I never used
MySQL connector, it's only confuses. OpenVS 2017 x64command prompt and navigate to theMySQLsource 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
OpenSSLpaths to appropriate yours and follow the instructions from the output. Then open compiled project in theVS 2017and build it all. After that, you will seemysqlclientlib.Note 1: The only
MySQLstatic lib ismysqlclient.lib
Note 2: Check yourMySQLlibs are compiled with/MTflags withVS 2017and also before theQt compilationI suggest to check if it works by creating simple console project.Happy New Year!
@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!
-
@Cobra91151
Happy New Year!
Many thanks for your help.
I got the right qsqlmysql.lib, now everything is ok!