PDA

View Full Version : install qt + mysql on windows xp



JeanC
11th September 2008, 11:07
Hello,

For some reason I am not allowed to post in the section 'installation and deployment' so I am asking here.
For installing qt on xp I am trying to follow this guide:
http://wiki.qtcentre.org/index.php?title=Building_the_QMYSQL_plugin_on_Wind ows_using_MinGW

But on step 5, make returns an error:
d:\Qt\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\ ..\mingw32\bin\ld.exe: cannot find -lQtSqld4
collect2: ld returned 1 exit status
mingw32-make[]: *** [..\..\..\..\plugins\sqldrivers\qsqlmysqld4.dll] Error 1

Please help.

JeanC
11th September 2008, 14:27
Never mind, I was using the wrong guide.

JeanC
12th September 2008, 07:52
I'm lost and asking for help again.

I am trying to compile a static qt 4.4.1 on windows xp with mingw and with mysql support.
http://wiki.qtcentre.org/index.php?title=Building_static_Qt_on_Windows#MinG W

The configure line was this:
configure -static -no-execptions -qt-sql-mysql

When I run mingw32-make it stops on mysql.h not found. Seems I need to download mysql source to compile. What exactly do I have to download and where do I put it?
Isn't there a howto or a tutorial on this? There are some for the plugin version but I'd like static builds.

Thanks.

Edit: I found a guide http://www.rag.com.au/linux/qt4howto.html and trying out now.

jacek
12th September 2008, 16:28
You didn't tell Qt where it should look for MySQL library. You have to pass -I and -L options with proper arguments to configure.

JeanC
12th September 2008, 21:32
Yes I reconfigure/recompiled with those options.

It didn't finish the compile (which took about 10 hours). It had an error compiling one of the very last examples, but qt itself is installed.

It still asks for libmysql.dll though.

But there are two other things much more to my dislike.

1. All exe files are around 10 mb, is that normal? Seems a bit huge.
2. If I start my first compiled own program (a port from working unix code) first I get a windows cmd window, then the program starts.

Strange..


You didn't tell Qt where it should look for MySQL library. You have to pass -I and -L options with proper arguments to configure.

jacek
12th September 2008, 21:38
It didn't finish the compile (which took about 10 hours). It had an error compiling one of the very last examples, but qt itself is installed.
You have compiled static Qt with examples? You must have a lot of disk space. Next time compile just the library and plugins and make sure you pass the "-release" option to the configure.


It still asks for libmysql.dll though.
Most likely because you didn't provide a static version of that library.


1. All exe files are around 10 mb, is that normal? Seems a bit huge.
Try stripping the binaries.


2. If I start my first compiled own program (a port from working unix code) first I get a windows cmd window, then the program starts.
Do you have CONFIG += console in your .pro file?

JeanC
13th September 2008, 07:13
You have compiled static Qt with examples? You must have a lot of disk space. Next time compile just the library and plugins and make sure you pass the "-release" option to the configure.

Yeah that harddisk is almost full now, have to write something to delete all those exe's.
I didn't pass -release no, I will do that. This was my configure line: configure -platform win32-g++ -static -qt-sql-sqlite -qt-sql-mysql -l mysql -I d:\qt\mysql\include -L d:\qt\mysql\lib\opt



Most likely because you didn't provide a static version of that library.


And how would I do that please?



Try stripping the binaries.


What do you mean? How would I do that?



Do you have CONFIG += console in your .pro file?
[/quote]

I use qdevelop for an IDE. Looking at the .pro there is indeed a console entry:


CONFIG += qt \
debug \
warn_on \
console \
staticlib

One problem solved.

3 questions:
What is the configure line to just compile qt and plugins please? I really would like a static build but only if it gives me 'normal' sized exes.
Will passing -release give me exes with a sane size? :)
And how should I provide a static version of mysql?

Hope to get this working..
Thanks for the help jacek.

JeanC
13th September 2008, 14:12
Edit:

I bet the command to compile source only is
mingw32-make sub-src

But how do I provide a static version of mysql please?

triperzonak
13th September 2008, 14:28
how about build the mysql plugin first then build the qt as static?

JeanC
13th September 2008, 15:26
You mean it will get linked in automagically?
Hm, it says

WARNING: Using static linking will disable the use of plugins.
Make sure you compile ALL needed modules into the library.

jacek
14th September 2008, 01:01
What do you mean? How would I do that?
Use the "strip" utility. You can also consider something like UPX. But you can't expect that all of the Qt code will simply vanish just because you have used the static build.


Will passing -release give me exes with a sane size?
No, but you will save a lot of disk space. You can use the dynamic linking for debugging.


And how should I provide a static version of mysql?
You will have to consult the MySQL documentation, but beware that linking MySQL library into your executable might cause licensing problems.

jacek
14th September 2008, 01:02
Hm, it says

WARNING: Using static linking will disable the use of plugins.
Make sure you compile ALL needed modules into the library.
Yes, you will have to use "static" plugins.

JeanC
14th September 2008, 12:47
I have rebuilt qt without static, mysql works.
Thank you all for your help.