Results 1 to 18 of 18

Thread: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

  1. #1
    Join Date
    Oct 2009
    Posts
    50
    Thanks
    22
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    How can I remove the dependencies for mingwm10.dll and ligcc_s_dw2-1.dll?Should I do static linking?Is it possible to do static linking with Qt Creator?


    How can I do static linking?(step by step please)

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    Try adding the -static-libgcc linker option.

  3. #3
    Join Date
    Oct 2009
    Posts
    50
    Thanks
    22
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    How can I do this?I compile with Qt Creator and don't know how I can compile,link without using Qt Creator.

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    You can still use Qt Creator, just put the option in your .pro file like so:

    Qt Code:
    1. win32 {
    2. QMAKE_LFLAGS += -static-libgcc
    3. }
    To copy to clipboard, switch view to plain text mode 

  5. The following user says thank you to squidge for this useful post:

    Awareness (11th April 2010)

  6. #5
    Join Date
    Oct 2009
    Posts
    50
    Thanks
    22
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    Thank you very much

  7. #6
    Join Date
    Mar 2010
    Posts
    56
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    Can we do that with the LGPL license?

  8. The following user says thank you to metRo_ for this useful post:

    Lawand (3rd December 2010)

  9. #7
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    That would depend on the licenses of MinGW and libGCC, as they are not Qt related.

  10. #8
    Join Date
    Oct 2009
    Posts
    50
    Thanks
    22
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    I couldn't make it work.

    My project's .pro file is:

    qmake Code:
    1. QT -= core gui
    2.  
    3. TARGET = struct1
    4.  
    5.  
    6. Win32 {
    7. QMAKE_LFLAGS_RELEASE += -static-libgcc
    8. }
    9. CONFIG += console
    10. CONFIG -= app_bundle
    11.  
    12.  
    13. TEMPLATE = app
    14.  
    15.  
    16. SOURCES += main.cpp
    To copy to clipboard, switch view to plain text mode 

    but it still requires mingwm10.dll.
    Last edited by wysota; 13th April 2010 at 14:21. Reason: reformatted to look better

  11. #9
    Join Date
    Mar 2008
    Posts
    1
    Thanked 1 Time in 1 Post

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    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.

  12. The following user says thank you to winz for this useful post:

    Awareness (18th April 2010)

  13. #10
    Join Date
    Oct 2009
    Posts
    50
    Thanks
    22
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    Thanks for your answer.Is it not possible to make this mingwm10.dll file staticaly linked?

  14. #11
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    Compile statical qt, first edit %qtdir%\mkspecs\win32-g++\qmake.conf and change
    Qt Code:
    1. QMAKE_LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
    2. QMAKE_LFLAGS = -static -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
    To copy to clipboard, switch view to plain text mode 
    then recompile using
    Qt Code:
    1. cd %qtdir%
    2. configure -static -release -no-exceptions -[other parameters like -mmx -sse -sse2 -3dnow etc...]
    3. make sub-src
    To 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.
    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 23:52.

  15. #12
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    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.

  16. #13
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    Quote Originally Posted by fatjuicymole View Post
    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 02:03.

  17. #14
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    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.

  18. #15
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    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?

  19. #16
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    Quote Originally Posted by Talei View Post
    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?
    No, as DLL = dynamic. You can't statically link a DLL, it's not possible. You have to build the static library and link with that. Qt doesn't ship with a static version of MinGW as far as I'm aware, only a dynamic (DLL) version.

  20. #17
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    Hello,
    After some sleep I understood what you wrote, sorry about that, I need to get ride of habit of posting after 12h of coding, can't think straight.
    Yes You are right that mingw (actually mingwm10, and so on, dll's) probably can't be statical compiled (I don't count trick to load dll from resource, so only one exe is deployed). But, and that's why I misunderstood You in the first place, You really don't need i.e. mingwm10.dll for Release build (they are not linked at all).
    In short this dll handle exceptions and clean up after threads, but AFAIK, reference: http://old.nabble.com/mingwm10.dll-ts8920679.html , using:
    Qt Code:
    1. configure -static -release -no-exceptions
    To copy to clipboard, switch view to plain text mode 
    prevent linker from linking it ( -no-exceptions ). Also, on posted thread, they are saying that mingwm10.dll clean up after threads, to prevent memory leak (24 * sizeof (void*) = 96byte, second post, and yes I know that thread was started in 2007 so probably information are outdated) for each catch in thread. So to summ it up, if no exceptions are used and no -mthreads is passed at compile time no need for mingwm10. (maybe I'm wrong?)
    I wrote small test app, to see if something strange is going on with QThreads on static build, like mem leek and so on.
    stat_test_dyn.exe (dynamic release build, require all dll like mingwm, QCore4 ...)
    Qt Code:
    1. qmake.exe stat_test.pro -spec win32-g++ -r CONFIG+=release
    2. mingw32-make.exe -w in \stat_test
    3. objdump.exe -j .idata -p stat_test_dyn.exe | sed -ne '/mingwm10/,/^$/{p;}'
    4. DLL Name: mingwm10.dll
    5. vma: Hint/Ord Member-Name Bound-To
    To copy to clipboard, switch view to plain text mode 

    stat_test_static.exe (static release build, don't require all dll like mingwm, QCore4 ...)
    Qt Code:
    1. qmake.exe stat_test.pro -spec win32-g++ -r CONFIG+=release
    2. mingw32-make.exe -w in \stat_test
    3. objdump.exe -j .idata -p stat_test_static.exe | sed -ne '/mingwm10/,/^$/{p;}'
    4. no output
    To copy to clipboard, switch view to plain text mode 
    Program run 1000 times thread, one after another, and output values to progressbar (from 0 -> 100 ).
    I run it ten times, so assuming mem leak of 96bytes on each thread * 1000 * 10 = 937KB mem leek.
    statistics for stat_test_dyn.exe [DYNAMIC]
    dyn_Snap1..jpgdyn_Snap2..jpg
    after 10 runs mem usage is higher by168KB.

    statistics for stat_test_static.exe [STATIC]
    static_Snap1..jpgstatic_Snap2..jpg
    after 10 runs mem usage is higher by120KB.
    To sum it up 10000 thread's executed one after another. Test machine Windows XP SP3 32bit. Process Explorer v 11.33.
    In attachment is src code if someone would want to test this by itself.
    Of course there can be some error made by me, so you are welcome to point them out. stat_tst..zip

  21. The following user says thank you to Talei for this useful post:

    tetsuoii (5th January 2011)

  22. #18
    Join Date
    Oct 2009
    Posts
    50
    Thanks
    22
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Removing dependencies for mingwm10.dll and libgcc_s_dw2-1.dll,static linking?

    Thanks for your answers

Similar Threads

  1. static & dynamic linking
    By mickey in forum General Programming
    Replies: 6
    Last Post: 11th June 2010, 09:57
  2. Static linking with Qt
    By prykHetQuo in forum Qt Programming
    Replies: 3
    Last Post: 3rd June 2009, 21:56
  3. Static linking
    By didcea in forum Qt Programming
    Replies: 0
    Last Post: 11th October 2008, 19:40
  4. gentoo qt4 static linking
    By powermax in forum Newbie
    Replies: 1
    Last Post: 27th April 2008, 22:11
  5. Build static on windows without deps on mingwm10.dll
    By ucomesdag in forum Qt Programming
    Replies: 2
    Last Post: 9th July 2007, 06:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.