[Interest] Qt 5.5.1 Error when building dbus support

Thiago Macieira thiago.macieira at intel.com
Thu Nov 5 14:51:46 CET 2015


On Thursday 05 November 2015 12:58:12 Paulo Caetano wrote:
> /usr/bin/ld.gold: error: .obj/qdbusmarshaller.o: multiple definition of
> 'QDBusMarshaller::append(QString const&)'
> /usr/bin/ld.gold: .obj/qdbusargument.o: previous definition here

> This, in turn, comes from here, in
> <source_dir>/qtbase/src/dbus/qdbusargument.cpp:
> ------------- BEGIN
> // for optimization purposes, we include the marshallers here
> #include "qdbusmarshaller.cpp"
> ------------- END
> 
> So, the "multiple definition" error is to be expected. Looking at the
> output of g++ -E, the functions are defined in both translation units, and
> I can't see any mechanism to keep this error from happening (of course,
> this could be from lack of knowledge on my part).

The multiple definition error is not to be expected. We expect qmake to remove 
qdbusmarshaller.cpp and qdbusdemarshaller.cpp from the list of files to build 
because it sees the #include in qdbusargument.cpp. It's been working like that 
for almost 10 years, so there's something wrong with your qmake.

You're running into the same bug as QTBUG-46582, which has never been 
identified or fixed. I applied a workaround for the issue in that bug report 
which you may have to do.

My guess is that the problem is related somehow to the path you've got Qt 
sources in or the build path.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list