Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 240185 - Qt 4 libraries exceptions flag handling
Summary: Qt 4 libraries exceptions flag handling
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Highest normal (vote)
Assignee: Qt Bug Alias
URL:
Whiteboard: [qting-edge]
Keywords: InOverlay
Depends on:
Blocks:
 
Reported: 2008-10-06 02:02 UTC by Alec Meyers
Modified: 2010-02-17 23:38 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
eclass diff: disable exceptions (qt4-build.diff,443 bytes, patch)
2009-01-09 21:00 UTC, Hanno Zysik (geki)
Details | Diff
added exception use flag on 4.5.2 packages (qt4-build-exceptions.patch,1.11 KB, patch)
2009-08-11 09:26 UTC, Markos Chandras (RETIRED)
Details | Diff
Updated patch (qt4-build-exceptions.patch,1.57 KB, patch)
2009-08-12 08:26 UTC, Markos Chandras (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alec Meyers 2008-10-06 02:02:01 UTC
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.
Comment 1 Hanno Zysik (geki) 2009-01-09 20:43:39 UTC
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"
Comment 2 Hanno Zysik (geki) 2009-01-09 21:00:06 UTC
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
Comment 3 Markos Chandras (RETIRED) gentoo-dev 2009-01-10 13:05:55 UTC
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?
Comment 4 Markos Chandras (RETIRED) gentoo-dev 2009-01-10 13:33:55 UTC
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
Comment 5 Sebastian Pipping gentoo-dev 2009-01-10 18:55:46 UTC
(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.
Comment 6 Markos Chandras (RETIRED) gentoo-dev 2009-08-10 19:43:59 UTC
Reopening since we have second thoughts about this :)
Comment 7 Dror Levin (RETIRED) gentoo-dev 2009-08-10 20:02:48 UTC
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 :)
Comment 8 Markos Chandras (RETIRED) gentoo-dev 2009-08-11 09:26:38 UTC
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
Comment 9 Davide Pesavento gentoo-dev 2009-08-11 13:23:18 UTC
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?
Comment 10 Markos Chandras (RETIRED) gentoo-dev 2009-08-11 13:25:07 UTC
(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.
Comment 11 Markos Chandras (RETIRED) gentoo-dev 2009-08-12 08:26:35 UTC
Created attachment 201004 [details, diff]
Updated patch

Updated patch thanks to Alex Alexander
Comment 12 Davide Pesavento gentoo-dev 2009-08-12 10:48:42 UTC
<snip>
+	if has exceptions "${IUSE}"; then
</snip>

I believe ${IUSE} should not be quoted.
Comment 13 Ben de Groot (RETIRED) gentoo-dev 2009-08-12 12:47:51 UTC
(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...

Comment 14 Davide Pesavento gentoo-dev 2009-08-12 13:27:12 UTC
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.
Comment 15 Markos Chandras (RETIRED) gentoo-dev 2009-08-12 15:08:31 UTC
+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
Comment 16 Davide Pesavento gentoo-dev 2009-08-17 22:48:09 UTC
BTW, what's the benefit of adding exceptions support? Do packages that use exceptions fail when qt is built without them?
Comment 17 Markos Chandras (RETIRED) gentoo-dev 2009-08-29 14:58:20 UTC
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
Comment 18 Davide Pesavento gentoo-dev 2009-08-29 16:19:25 UTC
Well... if that's true, then I don't see a reason to enable exceptions.
Comment 19 Davide Pesavento gentoo-dev 2009-09-07 10:31:04 UTC
As wired discovered, qt-xmlpatterns requires qt-core built *with* exceptions since Qt 4.6.
Comment 20 Davide Pesavento gentoo-dev 2009-09-23 09:11:45 UTC
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?
Comment 21 Markos Chandras (RETIRED) gentoo-dev 2009-12-19 10:36:28 UTC
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?
Comment 22 Davide Pesavento gentoo-dev 2009-12-19 11:27:05 UTC
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.
Comment 23 Ben de Groot (RETIRED) gentoo-dev 2009-12-19 20:12:51 UTC
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.
Comment 24 Markos Chandras (RETIRED) gentoo-dev 2010-01-12 17:19:19 UTC
(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 :)
Comment 25 Davide Pesavento gentoo-dev 2010-02-02 12:54:16 UTC
Should we keep an USE flag for exceptions (enabled by default)?
Comment 26 Markos Chandras (RETIRED) gentoo-dev 2010-02-02 13:20:14 UTC
I'd say yes :)
Comment 27 Alex Alexander (RETIRED) gentoo-dev 2010-02-17 23:38:36 UTC
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