Opened 10 years ago

Last modified 10 years ago

#46606 new enhancement

qt4-mac "noexceptions" variant

Reported by: RJVB (René Bertin) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch Cc: michaelld (Michael Dickens), mkae (Marko Käning)
Port: qt4-mac

Description

This one has already been presented (because included) in my qt4-mac concurrent ticket, but a bit of independent exposure might be good.

When you build Qt4 on OS X (or Linux) using gcc or clang, configure prints a notice when done about how these compilers will by default include the infrastructure required for C++ exceptions, how that adds considerable overhead, and that it is possible to build Qt without that support, resulting in an ABI-compatible install because exceptions aren't used internally.

That latter part is not 100% true: the resulting installation is only ABI compatible for software that doesn't require QtXMLPatterns and the full QtConcurrent.

The variant presented here does result in an installation that should be 100% ABI compatible by undoing the effect of configure's -no-exceptions for QtCore (and thus QtConcurrent) and QtXMLPatterns. It would have been better if QtConcurrent (and XMLPatterns) could be built *with* exceptions and the rest without, but that requires much more invasive hacking of the build system.

I've been using the current patch on OS X and Kubuntu (via ppa:rjvbertin/qt4) for weeks no, without ill effects.

The changes to the portfile (given inline):

    variant noexceptions description {build without using exceptions internally} {
        # (26) don't build with exceptions, which gives a completely ABI-compatible build
        patchfiles-append       disable-exceptions.patch
        configure.args-append   -no-exceptions
    }

and an additional patch in the post-destroot that removes an inappropriate section from QtCore/qconfig.h :

post-destroot {
    ...

        if {[variant_isset noexceptions ]} {
            # building with -no-exceptions will add a section to QtCore/qconfig.h that has to be removed
            # given that we did NOT build QtCore WITHOUT exceptions...
            exec patch -d ${destroot}${qt_frameworks_dir} -Np0 -i ${filespath}/qconfig-remove-EXCEPTIONS.diff
        }
    ...
}

Attachments (2)

disable-exceptions.patch (2.6 KB) - added by RJVB (René Bertin) 10 years ago.
qconfig-remove-EXCEPTIONS.diff (519 bytes) - added by RJVB (René Bertin) 10 years ago.

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by RJVB (René Bertin)

Attachment: disable-exceptions.patch added

Changed 10 years ago by RJVB (René Bertin)

comment:1 Changed 10 years ago by mkae (Marko Käning)

Cc: mk@… added

Cc Me!

Note: See TracTickets for help on using tickets.