[Qt-interest] QT 4.7.1 on Windows + MSVC2010 + MySQL
Nikolay Moskvichev
nikolay.moskvichev at gmail.com
Mon Nov 22 04:57:10 CET 2010
Hello, newsletters at philippberger.de
22.11.2010 0:13 you wrote:
>> On Sunday 21 November 2010 20:39:43 newsletters at philippberger.de wrote:
>>> Hello everybody,
>>>
>>> this is my first post to this list, therefore please tell me should I
>>> have
>>> violated a rule :)
>> Hello and welcome. ;)
>>
>>> I started from qt-everywhere-opensource-src-4.7.1.tar.gz,
>>> openssl-1.0.0b.tar.gz, sqlite-amalgamation-3_7_3.zip and
>>> mysql-noinstall-5.1.53-win32.zip.
>>> Steps I took:
>>> 1. Extract openssl, build it following the instructions with MSVC2010
>>> and
>>> NASM 2.10 to C:\QT\openssl
>>> 2. Extract mysql to E:\QT\mysql-build
>>> 3. Extract SQLite to E:\QT\sqlite
>>> 4. Extract qt to E:\QT\4.7.1-opensource, start a MSVC2010 x86 Build
>>> console and configure it with:
>>>
>>> Configure.exe -debug-and-release -opensource -shared -ltcg -no-fast
>>> -exceptions -accessibility -stl -qt-sql-sqlite -plugin-sql-sqlite
>>> -qt-sql-mysql -plugin-sql-mysql -platform win32-msvc2010 -qt-zlib
>>> -qt-gif
>>> -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -dsp -vcproj
>>> -incredibuild-xge -plugin-manifests -qmake -process -rtti -mmx -sse
>>> -sse2
>>> -openssl-linked -multimedia -webkit -script -scripttools -declarative
>>> -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista
>>> -qt-style-plastique -qt-style-cleanlooks -qt-style-motif -qt-style-cde
>>> -native-gestures -mp -I "E:\QT\mysql-5.1.53-win32\include" -L
>>> "E:\QT\mysql-5.1.53-win32\lib\opt" -I "E:\QT\openssl\include" -L
>>> "E:\QT\openssl\lib" -I "E:\QT\sqlite"
>>>
>>> Do I need -qt-sql-mysql AND -plugin-sql-mysql? These options are not
>>> very
>>> well documented.
>> No, you don't need to specify both options.
>> "-qt-sql-*" means SQL driver will be compiled directly into QtSql4.dll.
>> The result is that it's always available, no matter whether an application
>> wants it or not.
>> "-plugin-sql-*" means the driver will be built as a plugin and loaded
>> on-demand, i.e. when an application requests it.
>> The latter approach obviously requires less system resources (unused
>> libraries are not loaded) and allows more flexible
>> installation/distribution variants.
>
> Ahh :D Thanks for clarifying this :)
>
>>
>>> But after configure run through nmake fails with a message about 50
>>> unresolved externals related to mysql. Do I need an additional command
>>> like "-llibmysql"? And this problem is not related to the MinGW problems
>>> (or at least I think so^^).
>> You don't need to specify "-llibmysql" explicitly because it's
>> automatically done by the MySQL driver project file.
>> What looks strange to me is that you extracted MySQL to one directory, but
>> in configuration options specified another directory.
>
> Sorry, this is due to me trying to sum up what I've done on multiple
> computers, of course I used
> -I "E:\QT\mysql-build\include"
> -L "E:\QT\mysql-build\lib\opt"
>
> in this case :). Because nmake (and the linker) complained about the
> unresolved external symbols, I thought that maybe QT was not loading
> libmysql and/or libmysqlclient. Sadly I do now know enough about the
> behaviour of those programs, so I can only guess..
>
Just build Qt without MySQL support, then build MySQL plugin.
>From Qt docs:
How to Build the QMYSQL Plugin on Windows
You need to get the MySQL installation files. Run SETUP.EXE and choose
"Custom Install". Install the "Libs & Include Files" Module. Build the
plugin as follows (here it is assumed that MySQL is installed in C:\MySQL):
cd %QTDIR%\src\plugins\sqldrivers\mysql
qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\MySQL Server
<version>\lib\opt\libmysql.lib" mysql.pro
nmake
If you are not using a Microsoft compiler, replace nmake with make in
the line above.
The same way i use succesfully for firebird many times.
>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>
More information about the Qt-interest-old
mailing list