Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QT static hot does it build ?
When you build qt static it generates only libs or it makes libs+dlls?
giesbert last edited by
first of all, I assume you are on windows (as you talk about .dll and .lib and not about .so and .a)?
A static library does not have a dll. A dll is a dynamic link linbrary, which implies, it's dynamically linked. A dll that exports symbols, also has a .lib file which contains the fuinction offsets, not more.
A static library only consits of .lib files which are much bigger, as they are only object containers.
Hi, yes indeed it's windows:) I am trying to build QT static with MYSQL driver using nmake. I can't figure how.
ddurhamdavyandbeth.com last edited by
Running configure with -static will build only .libs. I don't believe you can configure with -static and -dynamic at the same time anyhow.
Also, I HIGHLY recommend making sure you disable demos and examples when building static (and almost never for that matter) otherwise you're likely to fill up your disk with libraries/object files and executable taking up many many GB. Not to mention that it compiles much faster without them.
I'm not sure if there's a standard way to do it. Don't see an explicit configure flag for it. But one option (what I do) is to edit projects.pro before running configure. Just add "QT_BUILD_PARTS = tools libs" as the first line of projects.pro.
Ok I undestand how linking works. Because qt static uses only libs I must link against mysql when i build. However while building qt I get strange errorrs regarding MSVCR that is allready defined. I have compiled QT with /MT flag and the single error I got was of an undefined symbol: "instance_plugin_mysql" or somenthin... Is there a good documentation regarding building mysql driver/plugin on a static version of qt? I want everything to be in a single .exe file ?
lgeyer last edited by
[quote author="Davy Durham" date="1322622374"]I'm not sure if there's a standard way to do it.[/quote]
-nomake part is what you are looking for, eg. -nomake examples -nomake demos -nomake tests.
I know that: my configure command looks like:
configure -release -nomake examples -nomake demos -no-exceptions -no-stl -no-rtti -no-qt3support -no-scripttools -no-openssl -no-opengl -no-webkit -no-phonon -no-style-motif -no-style-cde -no-style-cleanlooks -no-style-plastique -plugin-sql-mysql -I C:\mysql\include -L C:\mysql\lib -l mysqlcient
But I get compilation errors regarding sql I have also tryed -qt-sql-mysql, linking with libmysq not mysqlclient but with no success...
Should I build mysql before configuring ?
qtd1d1 last edited by
Do I get it right, that you have to include all your libraries in your configure command ? I thought that Qt static only contains the qt libraries.
Can't you define your external libraries in your project file?
It's about mysql driver wich is dependent by the mysql libs. Mysql has different license so qt cannot deploy mysql driver built in. Documentation says that you shall build it yourself... The problem is that I don't know how! I mean I know how but I get a lot of errors on compile.
ddurhamdavyandbeth.com last edited by
Also note that it's not possible to use dynamic plugins when building Qt statically (at least that's how I read: http://doc.qt.nokia.com/latest/plugins-howto.html (c.f. "Static Plugins"))
Not sure if that answers your question, but might be worth noting.
phonesystems last edited by
Well got my doubt cleared for how so many object files were created...It was so because I did not disable the demos and examples so these files were also stored..!!
I have resolved the issue. First I have compiled qtsqlmysql.lib using lib+dll(libmysql.lib) just to import simbols(so dll is not needed). When compiling the app I had to set the linker to ignore libcmt.lb and added mysqlclient.lib befoere qtsqlmysql.lib. A bit complicated I must say.