You can still use Qt Creator, just put the option in your .pro file like so:
Qt Code:
win32 { QMAKE_LFLAGS += -static-libgcc }To copy to clipboard, switch view to plain text mode
You can still use Qt Creator, just put the option in your .pro file like so:
Qt Code:
win32 { QMAKE_LFLAGS += -static-libgcc }To copy to clipboard, switch view to plain text mode
Awareness (11th April 2010)
Thank you very much
Can we do that with the LGPL license?
Lawand (3rd December 2010)
That would depend on the licenses of MinGW and libGCC, as they are not Qt related.
I couldn't make it work.
My project's .pro file is:
qmake Code:
QT -= core gui TARGET = struct1 Win32 { QMAKE_LFLAGS_RELEASE += -static-libgcc } CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cppTo copy to clipboard, switch view to plain text mode
but it still requires mingwm10.dll.
Last edited by wysota; 13th April 2010 at 13:21. Reason: reformatted to look better
You need mingwm10.dll because of the thread module.
I didn't find how to remove the thread module from the pro file but if you manually remove every occurrence of "-mthreads" in makefiles, it won't complain anymore about mingwm10.dll .
The problem is that you can not use QThread object in this case.
Awareness (18th April 2010)
Thanks for your answer.Is it not possible to make this mingwm10.dll file staticaly linked?
Compile statical qt, first edit %qtdir%\mkspecs\win32-g++\qmake.conf and change
then recompile usingQt Code:
QMAKE_LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc QMAKE_LFLAGS = -static -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-relocTo copy to clipboard, switch view to plain text mode
important here is no-exceptions that tells to link mingwm10.dll. This command compile qt in release mode, add -debug if you want that to. Also properly set Path on windows env. That way everything works fine, assuming configure is success.Qt Code:
cd %qtdir% configure -static -release -no-exceptions -[other parameters like -mmx -sse -sse2 -3dnow etc...] make sub-srcTo copy to clipboard, switch view to plain text mode
Your project is then LGPL, that means if some one who buy/download your app ask you for sorce code you need to provide it to them. I don't know if mingw allso gave you some restriction, from license point of view.
Last edited by Talei; 18th April 2010 at 22:52.
There doesn't seem to be a static version of MinGW. You can get around the problem with a bit of messing about, but by far the easist way is to change compilers. You can download the free edition of Microsoft's Visual C++ for example.
Can you elaborate more about your first sentence? Because AFAIK (I can be wrong so please correct me) dll, such as mingwm10.dll, are by default static, and configuring qt to static means that every lib, not only mingwm10.dll but also QtCore4.dlll for release and QtCored4.dl for debug are copied at linking time into exe. And AFAIK only advantage of using msvc compilers vs ming is that msvc don't copy at link time full content of each source file, so assuming that in some source file you have two functions, and Your app use only one function of them, ming "copy" these two function into your exe, and msvc only the one you are using (so ming produce relatievely larger exe then msvc in static). Comments about that are more then welcome.
EDIT. I compile to static using mingw32 right now so I will post if something, like threads or so, don't work.(but I highly doubt about that)
EDIT. Compiled with mingw32 to static, threads, jpeg, etc... all works without any additional dll. (tested only to see if something changed from 4.4 version, that's when I last used static compiling)
Last edited by Talei; 19th April 2010 at 01:03.
DLL stands for "Dynamic Linked Library" - you can ONLY dynamically link to it. It is not possible to statically link to a DLL. To statically link you need a '.a' file (for GCC) or a .lib file (for MSVC++). This is why you must reconfigure & rebuild Qt if you want to statically link, as those '.a' files do not exist (or exist, but are only stubs).
Last time I looked, there was only DLL file for MinGW.
I read this post twice and maybe it's due to my bad eng, but I can't figure out last two post. First You write that there is "no static version of mingw" (this sentence in particular is confusing to me) and suggest using msvc, and in last post You write that there was only dll for mingw. Wouldn't that imply contradiction? Also I compiled qt, before posting to make sure, and msvc08 create lib's so either way no mater what compiler you use lib will be created for you (no surprise there). By static lib. I mean peace of code that is itself a whole, and don't rely on other peace of code. And due to my bad eng, I wrote something in different meaning than I actually meant.
Do I correctly assume that you previous advice was due to "not force user" to reconfigure qt? If so, and that's only my opinion, wouldn't that be way more hassle then simply reconfigure the whole thing?
Bookmarks