[Development] Problem loading plugins with gcc 4.9.2

Thiago Macieira thiago.macieira at intel.com
Wed Mar 4 02:57:28 CET 2015

On Wednesday 04 March 2015 02:40:55 Aleix Pol wrote:
> On Tue, Mar 3, 2015 at 2:55 PM, Sergio Martins <sergio.martins at kdab.com> 
> > Hi,
> > 
> > 
> > 
> > So that you don't waste time pulling your hair out: plugin loading is
> > broken with gcc 4.9.2
> > 
> > 
> > 
> > There's some clash between global static QFactoryLoader instances.
> > 
> > Reproduced on Archlinux (and on Fedora by jpnurmi).
> I also hit this bug on ArchLinux. I solved it by downgrading from:
> 4.9.2-3 to 4.9.2-2 on these packages: lib32-gcc-libs gcc-libs gcc.

Someone who can reproduce the bug, please file it with GCC.

The test case seems quite simple (two .cpp files with two Q_GLOBAL_STATIC with 
the same name). Just remember to expand the Q_GLOBAL_STATIC macro before 

if that doesn't work, you'll need to reduce the testcase. Again, it should be 
quite evident which two .cpp files need to be reduced. In case the problem 
isn't triggered by just those two .cpp files, you can use the attached script, 
which I used to test an LTO issue with QtGui and GCC 5. The file listing should 
be up-to-date for Qt 5.4.

Before you run it, you'll need to update the main linker command-line and the 
error detection logic. I suggest that you run the linker normally, just 
ensuring it ran successfully, then use nm to get the anonymous namespace 
symbols. If the count is wrong (not 8), then mark as error.

You'll probably need to remove the --no-undefined option to allow the linker to 
succeed without the full list of files.

Once you have the minimum set of sources that triggers the error, reduce the 
.cpp to the minimum.

Then reduce the compiler and linker flags.
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pl
Type: application/x-perl
Size: 9065 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150303/aadc3b84/attachment.bin>

More information about the Development mailing list