-fexceptions in kdelibs

David Faure faure at kde.org
Mon Nov 24 19:36:49 GMT 2003


On Saturday 22 November 2003 15:12, Benjamin Reed wrote:
> In trying to package KDevelop, I ran into very strange linker errors 
> with some of the bits that use exceptions:
> 
> ---(snip!)---
> ld: .libs/javasupportpart.o illegal reference for -dynamic code (section 
> difference reference from section (__TEXT,__eh_frame) relocation entry 
> (12) to symbol: QPtrList<KParts::Part>::deleteItem(void*) defined in 
> dylib: /sw/lib/libkparts.dylib)
> ld: .libs/javasupportpart.o illegal reference for -dynamic code (section 
> difference reference from section (__TEXT,__eh_frame) relocation entry 
> (16) to symbol: QPtrList<KParts::Part>::count() const defined in dylib: 
> /sw/lib/libkparts.dylib)

I don't understand. Why does QPtrList::count() need exceptions?
Or do I read this wrong?

> Darwin's linker is very picky, and apparently won't let you link this 
> unless all of the symbols match up exception-wise.

Well, it has to be ok to link code-with-exceptions to code-without in general,
or you'd need exceptions in kdecore too.
I guess it's more precisely that all the code that calls a method that can
throw an exception, needs to have exception enabled. OK, but QPtrList::count
doesn't emit exceptions, so I'm puzzled.

> To fix this, I had to put "KDE_CXXFLAGS = $(USE_EXCEPTIONS)" into 
> kdelibs/kparts/Makefile.am and kdelibs/kio/kio/Makefile.am.

I don't know of any use of exceptions in there, so this is quite surprising.

> I seem to recall some threads about enabling exception handling in 
> kdelibs a while back, but I can't seem to find them at the moment.  Is 
> this still an open issue?  

Compilers improve, but people still have the old compilers :)
(e.g. gcc-2.95)

> Is it OK to commit those changes to kdelibs  
> or should I just continue patching them in the MacOSX packages?

Any chance you could find out _why_ this is needed?

-- 
David FAURE, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list