Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, August 2006
Removing mingwm10.dll dependency


Message 1 in thread

Dear List,

I am using open source Qt4.1.4 and to build a Windows binary I use MinGW (or
MingW, whatever it is).  I was frustrated by the mingwm10.dll dependency, so
I searched around and found this posting that was helpful:

http://lists.trolltech.com/qt-interest/2005-10/thread00381-0.html#msg00553

The problem is that I have to manually remove the -mthreads option from the
LFLAGS = line in my Makefile.  It works but I'd like to tell qmake to just
not put -mthreads in there in the first place.  I tried adding

    LFLAGS -= -mthreads

to my .pro file, but it didn't accomplish anything.  Any tips on how I can
avoid this by-hand edit every time I compile?  Thanks in advance.

(Note that Makefile doesn't actually contain a reference to -mthreads, it's
Makefile.Debug and Makefile.Release that do.)

Nathan


--
 [ signature omitted ] 

Message 2 in thread

Nathan Carter wrote:
   I tried adding
> 
>     LFLAGS -= -mthreads
> 

Have you tried it with LIBS -= -mthreads ?

--
 [ signature omitted ] 

Message 3 in thread

Hi,

>   I tried adding
>>
>>     LFLAGS -= -mthreads
>>

Try QMAKE_LFLAGS or QMAKE_LFLAGS_THREAD instead:
http://doc.trolltech.com/4.1/qmake-variable-reference.html#qmake-lflags-thread

> Have you tried it with LIBS -= -mthreads ?

The -mthreads option does not specify a library. I'm afraid this won't 
work.

Anyway, Qt requires thread support, so I don't think removing -mthreads 
can work.

--
 [ signature omitted ] 

Message 4 in thread

Hi,

> Anyway, Qt requires thread support, so I don't think removing -mthreads 
> can work.

NOT true, because "-mthreads" is just needed for thread-safe exception 
handling. Since Qt DOES NOT use exceptions at all, you can safly remove 
this flag on a MinGW32-System.

Here are the steps I did to get it to work without dependency:

1.) edit [QT]\mkspecs\win32-g++\qmake.conf: remove all occurrences of 
"-mthreads".

2.) Recompile Qt

3.) Recompile your project -> dependency will no longer exist!


I mentioned this to Trolltech Support twice, they confirmed the fact, but 
nothing happened ever since. I have to do this hack everytime I install a 
new Qt version :-(

Regards and good luck,

Malte

--
 [ signature omitted ] 

Message 5 in thread

Thank you very much!  I appreciate this fix; it helps a lot, since I don't
care about C++ exceptions in my project.

Nathan

>> Anyway, Qt requires thread support, so I don't think removing -mthreads
>> can work.
> 
> NOT true, because "-mthreads" is just needed for thread-safe exception
> handling. Since Qt DOES NOT use exceptions at all, you can safly remove
> this flag on a MinGW32-System.
> 
> Here are the steps I did to get it to work without dependency:
> 
> 1.) edit [QT]\mkspecs\win32-g++\qmake.conf: remove all occurrences of
> "-mthreads".
> 
> 2.) Recompile Qt
> 
> 3.) Recompile your project -> dependency will no longer exist!


--
 [ signature omitted ] 

Message 6 in thread

Hi,

>> Anyway, Qt requires thread support, so I don't think removing -mthreads 
>> can work.
> 
> NOT true, because "-mthreads" is just needed for thread-safe exception 
> handling. Since Qt DOES NOT use exceptions at all, you can safly remove 
> this flag on a MinGW32-System.

Qt actually may throw a bad_alloc exception in out-of-memory situations. 
Client slots connected to Qt signals may also throw exceptions. And this 
may happen in different threads.

The -mthreads documentation reads:
http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/i386-and-x86_002d64-Options.html#index-maccumulate_002doutgoing_002dargs-1041
	Support thread-safe exception handling on `Mingw32'. Code that
	relies on thread-safe exception handling must compile and link
	all code with the -mthreads option.

I'm not sure what "thread-safe exception handling" exactly means and 
what the real scope of "compile and link all code with the -mthreads 
option" is. It may be lack of knowledge and testing on my side, but I'm 
not convinced so far that -mthreads can be removed safely.

--
 [ signature omitted ] 

Message 7 in thread

Hi Dimitri,

I had a discussion with your support stuff about this issue before. The 
result was that I could safely remove the flag. I compiled with 
"-no-exceptions" flag though...
I am working with "-mthreads"-less Qt library for ages now and never had 
any regarding issues or problems. I am pretty sure that you CAN safely 
remove the flag. I am not sure if it is important to issue 
"-no-exceptions" flag additionally on compile-time of Qt. 

BTW, I refer to Qt 4.x. - I don't know about 3.x.

Regards,
Malte



Dimitri <dimitri@xxxxxxxxxxxxx> schrieb am 30.08.2006 22:55:55:

> Hi,
> 
> >> Anyway, Qt requires thread support, so I don't think removing 
-mthreads 
> >> can work.
> > 
> > NOT true, because "-mthreads" is just needed for thread-safe exception 

> > handling. Since Qt DOES NOT use exceptions at all, you can safly 
remove 
> > this flag on a MinGW32-System.
> 
> Qt actually may throw a bad_alloc exception in out-of-memory situations. 

> Client slots connected to Qt signals may also throw exceptions. And this 

> may happen in different threads.
> 
> The -mthreads documentation reads:
> http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/i386-and-x86_002d64-
> Options.html#index-maccumulate_002doutgoing_002dargs-1041
>    Support thread-safe exception handling on `Mingw32'. Code that
>    relies on thread-safe exception handling must compile and link
>    all code with the -mthreads option.
> 
> I'm not sure what "thread-safe exception handling" exactly means and 
> what the real scope of "compile and link all code with the -mthreads 
> option" is. It may be lack of knowledge and testing on my side, but I'm 
> not convinced so far that -mthreads can be removed safely.
> 
> --
> 
> Dimitri
> 
> --
> 
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx 
> with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
> 

--
 [ signature omitted ] 

Message 8 in thread

Hi,

> I had a discussion with your support stuff about this issue before. The 
> result was that I could safely remove the flag. I compiled with 
> "-no-exceptions" flag though...

If you compile with the -fno-exceptions flag, exceptions will not 
propagate through Qt. Any such attempt will crash the program.

> I am working with "-mthreads"-less Qt library for ages now and never had 
> any regarding issues or problems. I am pretty sure that you CAN safely 
> remove the flag. I am not sure if it is important to issue 
> "-no-exceptions" flag additionally on compile-time of Qt. 

This proves *you* can safely remove the flag in a specific context, 
because no exceptions are thrown on out-of-memory conditions and 
probably never propagate exceptions through Qt. This doesn't prove 
*everyone* can safely remove the flag.

Now it may be that it's useless for most Qt users, and the default 
should therefore be to avoid it. Instead of removing -mthreads from 
mkspecs/win32-g++/qmake.conf altogether, I would recommend a choice between:
* supporting exceptions: use -mthreads
* not supporting exceptions: use -fno-exceptions
This choice would be handled by the Windows installer. Since I don't 
master both the Windows installer and the Unix configure script, I can't 
modify this myself, but you could suggest this fix to the Trolltech support.

In any case, before fixing anything, I think we need to clarify in the 
compiler documentation what "thread-safe exception handling" exactly 
means and what the real scope of "compile and link all code with the 
-mthreads option" is.

--
 [ signature omitted ] 

Message 9 in thread

> If you compile with the -fno-exceptions flag, exceptions will not 
> propagate through Qt. Any such attempt will crash the program.

Ack'ed! But this is desired in my case.

> 
> > I am working with "-mthreads"-less Qt library for ages now and never 
had 
> > any regarding issues or problems. I am pretty sure that you CAN safely 

> > remove the flag. I am not sure if it is important to issue 
> > "-no-exceptions" flag additionally on compile-time of Qt. 
> 
> This proves *you* can safely remove the flag in a specific context, 
> because no exceptions are thrown on out-of-memory conditions and 
> probably never propagate exceptions through Qt. This doesn't prove 
> *everyone* can safely remove the flag.

True as well - but I bet that there are many users out there having 
similar side conditions.

> Now it may be that it's useless for most Qt users, and the default 
> should therefore be to avoid it. Instead of removing -mthreads from 
> mkspecs/win32-g++/qmake.conf altogether, I would recommend a choice 
between:
> * supporting exceptions: use -mthreads
> * not supporting exceptions: use -fno-exceptions
> This choice would be handled by the Windows installer. Since I don't 
> master both the Windows installer and the Unix configure script, I can't 

> modify this myself, but you could suggest this fix to the Trolltech 
support.

Sounds like a good approach to me :)

> In any case, before fixing anything, I think we need to clarify in the 
> compiler documentation what "thread-safe exception handling" exactly 
> means and what the real scope of "compile and link all code with the 
> -mthreads option" is.

True!

Regards and thanks for your considerations,

Malte


--
 [ signature omitted ]