Qt static with MySQL issue
-
Hi! I use
Qt 5.9.7
andOpenSSL libs: 1.0.2l
andMySQL: 5.7.23
because of the compatibility withWin Vista
and later. I think it should be better for you to use latest versions ofOpenSSL
andMySQL
to configureQt 5.12
.By the way,
mysqlclientMT
is the name of theMySQL
static lib compiled with/MT
flag.Change the instruction in configure to:
MYSQL_LIBS="-lmysqlclient -lAdvapi32 -lUser32 -lCrypt32 -lGdi32"
wrote on 30 Dec 2018, 11:30 last edited by@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 .wrote on 30 Dec 2018, 12:08 last edited byOk. Here are instructions how to build:
- Download the
MySQL
source from https://dev.mysql.com/downloads/mysql/ - Get the
OpenSSL
source from https://openssl.org/source/openssl-1.0.2l.tar.gz - Extract all archives
- Compile static
OpenSSL
- Compile static
MySQL
with previously compiledOpenSSL
libs
Read the
MySQL
andOpenSSL
(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
MySQL
source from https://dev.mysql.com/downloads/mysql/ - Get the
OpenSSL
source from https://openssl.org/source/openssl-1.0.2l.tar.gz - Extract all archives
- Compile static
OpenSSL
- Compile static
MySQL
with previously compiledOpenSSL
libs
Read the
MySQL
andOpenSSL
(https://wiki.openssl.org/index.php/Compilation_and_Installation#PREFIX_and_OPENSSLDIR) docs for more details.wrote on 30 Dec 2018, 12:42 last edited by@Cobra91151
Many thanks for your help.
I will have a try. - Download the
-
Ok. Here are instructions how to build:
- Download the
MySQL
source from https://dev.mysql.com/downloads/mysql/ - Get the
OpenSSL
source from https://openssl.org/source/openssl-1.0.2l.tar.gz - Extract all archives
- Compile static
OpenSSL
- Compile static
MySQL
with previously compiledOpenSSL
libs
Read the
MySQL
andOpenSSL
(https://wiki.openssl.org/index.php/Compilation_and_Installation#PREFIX_and_OPENSSLDIR) docs for more details.wrote on 31 Dec 2018, 03:38 last edited byI 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.wrote on 31 Dec 2018, 08:28 last edited by cawlfj@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
wrote on 31 Dec 2018, 11:51 last edited byHi! The problem is that you use
MySQL
connector. But instead you should download this one:Extract it and build it with
OpenSSL
libs (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 yourMySQL
libs path is wrong in theQt
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. -
Hi! The problem is that you use
MySQL
connector. But instead you should download this one:Extract it and build it with
OpenSSL
libs (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 yourMySQL
libs path is wrong in theQt
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.wrote on 31 Dec 2018, 13:09 last edited by@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 .wrote on 31 Dec 2018, 13:59 last edited by Cobra91151I never used
MySQL connector
, it's only confuses. OpenVS 2017 x64
command prompt and navigate to theMySQL
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 theVS 2017
and build it all. After that, you will seemysqlclient
lib.Note 1: The only
MySQL
static lib ismysqlclient.lib
Note 2: Check yourMySQL
libs are compiled with/MT
flags withVS 2017
and also before theQt compilation
I 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 x64
command prompt and navigate to theMySQL
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 theVS 2017
and build it all. After that, you will seemysqlclient
lib.Note 1: The only
MySQL
static lib ismysqlclient.lib
Note 2: Check yourMySQL
libs are compiled with/MT
flags withVS 2017
and also before theQt compilation
I suggest to check if it works by creating simple console project.Happy New Year!
wrote on 31 Dec 2018, 15:51 last edited by@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!
-
wrote on 1 Jan 2019, 01:58 last edited by
@Cobra91151
Happy New Year!
Many thanks for your help.
I got the right qsqlmysql.lib, now everything is ok!
41/50