When emergeing Qt4 libraries, the following message pops up: This target is using the GNU C++ compiler (linux-g++). Recent versions of this compiler automatically include code for exceptions, which increase both the size of the Qt libraries and the amount of memory taken by your applications. You may choose to re-run configure with the -no-exceptions option to compile Qt without exceptions. This is completely binary compatible, and existing applications will continue to work. This should be fixed since the users will benefit (especially with upcoming KDE 4.1), and this is how it's intended upstream. Reproducible: Always Steps to Reproduce: 1. emerge qt-gui 2. Watch the output a little bit 3. See the above message Actual Results: Qt4 is not configured properly. Expected Results: Configure should be run with the -no-exceptions option.
Hmm, even old x11-libs/qt ebuilds disabled g++ exceptions: (Or what..? :) # find x11-libs/ -type f -name qt-*.ebuild -exec grep -Hn exception {} + x11-libs/qt-embedded/qt-embedded-3.3.8.ebuild:76: use debug && myconf="${myconf} -debug" || myconf="${myconf} -release -no-g++-exceptions" x11-libs/qt/qt-4.3.5.ebuild:15:LICENSE="|| ( QPL-1.0 GPL-2 GPL-3 Trolltech-GPL-exception-1.2 Trolltech-GPL-exception-addendum-1.2 )" x11-libs/qt/qt-3.3.8b-r1.ebuild:199: use debug && myconf+=" -debug" || myconf+=" -release -no-g++-exceptions" x11-libs/qt/qt-3.3.8-r4.ebuild:202: use debug && myconf="${myconf} -debug" || myconf="${myconf} -release -no-g++-exceptions"
Created attachment 177908 [details, diff] eclass diff: disable exceptions Add below code to your 'emerge --sync' script and fix the path variable. (I hope no bugs left ;) ___ path="/mnt/data/portage/local" for patch in qt4-build; do if patch --quiet --fuzz 0 --dry-run -p0 -d "${path}/.." -i "${path}/${patch}.diff"; then echo " * ${patch}" grep ^+++ "${path}/${patch}.diff" patch --quiet -p0 -d "${path}/.." -i "${path}/${patch}.diff" for orig in $(grep ^+++ "${path}/${patch}.diff" | cut -d' ' -f2 | cut -f1); do rm -f "${path}/../${orig}".orig done else echo " * ${patch} failed?! went into portage tree?" fi done
Afaik, exceptions handling is a usefull thing for developers. I couldnt find any specific documentation about exception handling in Qt but I wouldnt disable it. Sebastian, do you have any ideas about this?
Furthermore, a similar discussion took place on kde mailing list http://lists.kde.org/?t=122302328200004&r=1&w=2 A developers states the following: "README.qt-copy is for developers, NOT for packagers. It would be a bad mistake for a distribution to follow the configuration listed there, since it's a "KDE only" setup, and indeed doesn't match other users of Qt." So , we are not supposed to have "-no-exceptions" on our configure script. If you read that discussion , you will see that "-no-exception" makes QtXmlpatterns fail too. So I would not take that risk for the shake of a slightly less generated code. Also, how do you know that this configure option will benefit KDE users? I am closing it as WONTFIX
(In reply to comment #4) > If you read that discussion , you will see that "-no-exception" makes > QtXmlpatterns fail too. I can confirm that at least the XML patterns module requires compilation with exceptions enabled. Closing as wontfix seems reasonable to me.
Reopening since we have second thoughts about this :)
All qt-* ebuilds in qting-edge overlay (except for qt-xmlpatterns) now have a new USE flag called 'exceptions' which, surprisingly, enables exceptions. Please test and report :)
Created attachment 200906 [details, diff] added exception use flag on 4.5.2 packages Proposed patch to enable 'exceptions' via use flag on 4.5.2 packages. Please apply it and test it Many thanks to Dror for the initial patch on qting-edge overlay
AFAICS the current portage eclass already compiles every qt module (except qt-xmlpatterns) with -no-exceptions, so what's this bug about? It seems to me that what we are trying to accomplish here is adding a new USE flag to always _enable_ exceptions, right?
(In reply to comment #9) > AFAICS the current portage eclass already compiles every qt module (except > qt-xmlpatterns) with -no-exceptions, so what's this bug about? > It seems to me that what we are trying to accomplish here is adding a new USE > flag to always _enable_ exceptions, right? > Not always. Just to allow users to choose whether they want to build Qt using exceptions or not.
Created attachment 201004 [details, diff] Updated patch Updated patch thanks to Alex Alexander
<snip> + if has exceptions "${IUSE}"; then </snip> I believe ${IUSE} should not be quoted.
(In reply to comment #10) > Just to allow users to choose whether they want to build Qt using > exceptions or not. And should exceptions be enabled by default or not? I think not, but am open to good arguments...
I think exceptions should be disabled by default. When exception handling is enabled, gcc generates extra code needed to propagate exceptions, which implies frame unwind information for all functions. This substantially increases the size of the final binary. The runtime overhead is incurred only when an exception is thrown.
+1 to Davide exceptions should definitely NOT be enabled by default because it will lead to bigger packages with extra code which is useless for 95% of our users
BTW, what's the benefit of adding exceptions support? Do packages that use exceptions fail when qt is built without them?
afaik -exceptions is for internal Qt usage and does not affect Qt programs. I am not sure about this though. We need to ask a Qt developer, possibly on #qt irc channel
Well... if that's true, then I don't see a reason to enable exceptions.
As wired discovered, qt-xmlpatterns requires qt-core built *with* exceptions since Qt 4.6.
My proposal to solve this bug: (btw the summary is still wrong...) *) Leave Qt 4.5.x as-is, all modules except qt-xmlpatterns are compiled without exception, as suggested by upstream. *) For Qt 4.6.x, introduce an 'exceptions' USE flag in qt-core (enabled by default) and make qt-xmlpatterns depend on "qt-core[exceptions]". qt-xmlpatterns is always compiled with exceptions, all other modules are always compiled without. No need to confuse users with yet another obscure USE flag. Thoughts?
I ve lost touch with this bug. @Qt herd exceptions use flag is on qting-edge for 3 months. No bugs have been reported so I might be safe to port it on portage. However I don't want to touch the existing ebuilds so I propose to add this flag only for the upcoming 4.6.1 packages Any objection?
As I've stated in comment #20, I don't think we should add an 'exceptions' USE flag for packages that don't need it.
We should get a statement from upstream on what is the recommended setting and what would be the consequences of enabling/disabling it. I hope the summary better reflects the issue now.
(In reply to comment #23) > We should get a statement from upstream on what is the recommended setting and > what would be the consequences of enabling/disabling it. > > I hope the summary better reflects the issue now. > [19:06:44] <hwoarang> Hi. Could someone explains me how the 'exceptions' configure switch affects the produced Qt binaries or the Qt4 applications? [19:16:16] <aep> hwoarang: some internal stuff, and if you throw an exception into the eventloop you get a nice warning instead of a crash[19:17:55] <hwoarang> aep: would you recommend to use that switch? [19:18:05] <hwoarang> i mean for packaging on distros [19:18:07] <aep> yes. unless you're on uclib [19:18:11] <aep> yes definatly [19:18:16] <hwoarang> ok many thanks :)
Should we keep an USE flag for exceptions (enabled by default)?
I'd say yes :)
just committed an updated eclass that adds an "exceptions" USE flag to >= 4.6.0 qt ebuilds :) wired * gentoo-x86/eclass/qt4-build.eclass: [qt4-build.eclass] added exceptions USE flag for >= Qt 4.6.x - bug #240185