[Qt-interest] QT 4.7.1 on Windows + MSVC2010 + MySQL
newsletters at philippberger.de
newsletters at philippberger.de
Tue Dec 14 11:25:49 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.
For static builds this is not possible, or did I get something wrong?
I moved on to building a debug-shared version for developing and a
release-static for deploying.
>>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.
>
I still havent got around those errors, but today I will present you with
the detailed messages... :)
Using the Configure:
configure.exe -debug -opensource -shared -no-ltcg -no-fast -exceptions
-accessibility -stl -qt-sql-sqlite -qt-sql-mysql -no-qt3support -no-openvg
-platform win32-msvc2010 -graphicssystem opengl -qt-zlib -qt-gif
-qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -dsp -vcproj
-incredibuild-xge -plugin-manifests -qmake -process -no-rtti -mmx
-no-3dnow -sse -sse2 -openssl-linked -no-dbus -phonon -multimedia
-audio-backend -no-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 -graphicssystem opengl -nomake demos -nomake examples
-I "E:\QT\sqlite-amalgamation-3_7_3" -I "E:\QT\openssl\include" -L
"E:\QT\openssl\lib" -I "E:\QT\mysql\include" -L "E:\QT\mysql\lib\opt" -L
"E:\QT\mysql\lib\debug"
I configured QT 4.7.1 to build in shared debug mode with MySQL support.
I modified the qmake.conf file like this (lines 67 to 71 in win32-msvc2010):
MAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib
ole32.lib advapi32.lib ws2_32.lib libmysql.lib
QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib
winmm.lib winspool.lib ws2_32.lib ole32.lib user32.lib advapi32.lib
libmysql.lib
QMAKE_LIBS_NETWORK = kernel32.lib user32.lib advapi32.lib ws2_32.lib
crypt32.lib gdi32.lib winmm.lib imm32.lib libmysql.lib
QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib
libmysql.lib
QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib
gdi32.lib ws2_32.lib libmysql.lib
So that all imports for the static openssl libs are met, the
"libmysql.lib" file is needed for QT Designer and other included programs
(they would not compile without this import, just added the lib to
everything to be safe...)
But when I compile this I get the following errors (only a small part
below, for complete log see txt file!):
link /LIBPATH:"e:\QT\qt-mysql-builds\debug-opensource-4.7.1\lib"
/LIBPATH:"e:\QT\qt-mysql-builds\debug-opensource-4.7.1\lib" /NOLOGO
/BASE:0x62000000 /DEBUG /DLL /MANIFEST
/MANIFESTFILE:"tmp\obj\debug_shared\QtSqld.intermediate.manifest"
/VERSION:4.71 /OUT:..\..\lib\QtSqld4.dll
@C:\Users\THE_-_~1\AppData\Local\Temp\nmC21F.tmp
Creating library ..\..\lib\QtSqld4.lib and object ..\..\lib\QtSqld4.exp
qsql_mysql.obj : error LNK2019: unresolved external symbol
_mysql_fetch_field at 4 referenced in function "public: bool __thiscall
QMYSQLResultPrivate::bindInValues(void)"
(?bindInValues at QMYSQLResultPrivate@@QAE_NXZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol
_mysql_num_fields at 4 referenced in function "public: bool __thiscall
QMYSQLResultPrivate::bindInValues(void)"
(?bindInValues at QMYSQLResultPrivate@@QAE_NXZ)
->(many more here)
NMAKE : fatal error U1077: '"E:\Program Files (x86)\Microsoft Visual
Studio 10.0\VC\BIN\link.EXE"' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"E:\Program Files (x86)\Microsoft Visual
Studio 10.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
My question is: Where do I have to add what file/command to get this working?
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: qtMysqlCompileErrors.txt
Url: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101214/746068f9/attachment.txt
More information about the Qt-interest-old
mailing list