[Interest] Qt 5.5.1 Error when building dbus support

Paulo Caetano paulo.a.o.caetano at gmail.com
Thu Nov 5 13:58:12 CET 2015


Hello.

I'm experimenting with configuring/building Qt on Linux x64 (Fedora 22). My
current goal is building qtbase, then I'll move on to other modules.

However, I'm stuck with errors while building dbus support:
------------- BEGIN
g++ -Wl,--no-undefined -fuse-ld=gold -Wl,--enable-new-dtags
-Wl,-rpath,/mnt/Data/devel/lib/qt5/exp/lib -shared -Wl,-Bsymbolic-functions
-Wl,-soname,libQt5DBus.so.5 -o libQt5DBus.so.5.5.1 .obj/qdbusconnection.o
.obj/qdbusconnectioninterface.o .obj/qdbuserror.o .obj/qdbusintegrator.o
.obj/qdbusmessage.o .obj/qdbusserver.o .obj/qdbusabstractinterface.o
.obj/qdbusinterface.o .obj/qdbusxmlparser.o .obj/qdbusutil.o
.obj/qdbusintrospection.o .obj/qdbusabstractadaptor.o
.obj/qdbusinternalfilters.o .obj/qdbusmetaobject.o .obj/qdbusxmlgenerator.o
.obj/qdbusmisc.o .obj/qdbusargument.o .obj/qdbusreply.o
.obj/qdbusmetatype.o .obj/qdbusextratypes.o .obj/qdbusmarshaller.o
.obj/qdbuscontext.o .obj/qdbuspendingcall.o .obj/qdbuspendingreply.o
.obj/qdbus_symbols.o .obj/qdbusservicewatcher.o
.obj/qdbusunixfiledescriptor.o .obj/qdbusvirtualobject.o
.obj/moc_qdbusconnectioninterface.o .obj/moc_qdbusserver.o
.obj/moc_qdbusconnection.o .obj/moc_qdbusabstractadaptor.o
.obj/moc_qdbusvirtualobject.o .obj/moc_qdbusconnection_p.o
.obj/moc_qdbuspendingcall_p.o  -L/mnt/Data/devel/lib/icu/rls/lib
-L/mnt/Data/devel/lib/zlib/rls/lib
-L/mnt/Data/devel/source/qt/qt5_exp/qtbase/lib -lQt5Core -lpthread

/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

/usr/bin/ld.gold: error: .obj/qdbusmarshaller.o: multiple definition of
'QDBusMarshaller::open(QDBusMarshaller&, int, char const*)'
/usr/bin/ld.gold: .obj/qdbusargument.o: previous definition here

/usr/bin/ld.gold: error: .obj/qdbusmarshaller.o: multiple definition of
'QDBusMarshaller::beginCommon(int, char const*)'
/usr/bin/ld.gold: .obj/qdbusargument.o: previous definition here

/usr/bin/ld.gold: error: .obj/qdbusmarshaller.o: multiple definition of
'QDBusMarshaller::close()'
/usr/bin/ld.gold: .obj/qdbusargument.o: previous definition here

/usr/bin/ld.gold: error: .obj/qdbusmarshaller.o: multiple definition of
'QDBusMarshaller::~QDBusMarshaller()'
/usr/bin/ld.gold: .obj/qdbusargument.o: previous definition here

/usr/bin/ld.gold: error: .obj/qdbusmarshaller.o: multiple definition of
'QDBusMarshaller::~QDBusMarshaller()'
/usr/bin/ld.gold: .obj/qdbusargument.o: previous definition here

/usr/bin/ld.gold: error: .obj/qdbusmarshaller.o: multiple definition of
'QDBusMarshaller::endCommon()'
/usr/bin/ld.gold: .obj/qdbusargument.o: previous definition here

/usr/bin/ld.gold: error: .obj/qdbusmarshaller.o: multiple definition of
'QDBusMarshaller::error(QString const&)'
/usr/bin/ld.gold: .obj/qdbusargument.o: previous definition here

/usr/bin/ld.gold: error: .obj/qdbusmarshaller.o: multiple definition of
'QDBusMarshaller::appendRegisteredType(QVariant const&)'
/usr/bin/ld.gold: .obj/qdbusargument.o: previous definition here

/usr/bin/ld.gold: error: .obj/qdbusmarshaller.o: multiple definition of
'QDBusMarshaller::appendCrossMarshalling(QDBusDemarshaller*)'
/usr/bin/ld.gold: .obj/qdbusargument.o: previous definition here

/usr/bin/ld.gold: error: .obj/qdbusmarshaller.o: multiple definition of
'QDBusMarshaller::appendVariantInternal(QVariant const&)'
/usr/bin/ld.gold: .obj/qdbusargument.o: previous definition here

/mnt/Data/devel/source/qt/qt5/qtbase/src/dbus/qdbusmarshaller.cpp:571:
error: undefined reference to 'QDBusDemarshaller::currentSignature()'

collect2: error: ld returned 1 exit status

Makefile:259: recipe for target '../../lib/libQt5DBus.so.5.5.1' failed
------------- END

I'm building from the git repo, initialized with:
------------- BEGIN
perl init-repository --no-webkit
--module-subset=qtbase,qtmultimedia,qttools,qtxmlpatterns,qttranslations,qtdoc,qtrepotools,qtqa,qtsystems,qtfeedback,qtdocgallery,qtpim,qtconnectivity,qtwayland,qtimageformats,qtquick1,qtgraphicaleffects,qtquickcontrols,qtserialport,qtx11extras,qtwebsockets,qtwebchannel,qtwebengine,qtcanvas3d

git checkout v5.5.1
------------- END

And this is my configure:
------------- BEGIN
../qt5/configure \
    -prefix /mnt/Data/devel/lib/qt5/exp \
    -release \
    -opensource \
    -confirm-license \
    -c++11 \
    -no-pch \
    -skip qtqa \
    -skip qtsystems \
    -skip qtfeedback \
    -skip qtdocgallery \
    -skip qtpim \
    -skip qtwinextras \
    -skip qtmultimedia \
    -skip qtxmlpatterns \
    -skip qttools \
    -skip qttranslations \
    -skip qtdoc \
    -skip qtconnectivity \
    -skip qtwayland \
    -skip qtimageformats \
    -skip qtquick1 \
    -skip qtgraphicaleffects \
    -skip qtquickcontrols \
    -skip qtserialport \
    -skip qtwebsockets \
    -skip qtwebengine \
    -skip qtcanvas3d \
    -skip qtx11extras \
    -skip qtwebkit \
    -skip qtwebkit-examples \
    -skip qtwebchannel \
    -skip qtsvg \
    -skip qtdeclarative \
    -skip qtactiveqt \
    -skip qtscript \
    -skip qtlocation \
    -skip qtsensors \
    -skip qt3d \
    -skip qtmacextras \
    -skip qtandroidextras \
    -skip qtenginio \
    -no-compile-examples \
    -nomake examples \
    -nomake tests \
    -force-debug-info \
    -shared \
    -largefile \
    -no-strip \
    -qml-debug \
    -no-warnings-are-errors \
    -system-zlib \
    -icu \
    -qt-libpng \
    -qt-libjpeg \
    -qt-freetype \
    -qt-harfbuzz \
    -opengl \
    -openssl \
    -dbus \
    -no-gtkstyle \
    -optimized-qmake \
    -reduce-relocations \
    -platform linux-g++ \
    -system-pcre \
    -v \
    -no-nis \
    -no-mtdev \
    -no-tslib \
    -I /mnt/Data/devel/lib/icu/rls/include \
    -L /mnt/Data/devel/lib/icu/rls/lib \
    -I /mnt/Data/devel/lib/zlib/rls/include \
    -L /mnt/Data/devel/lib/zlib/rls/lib \
    -I /mnt/Data/devel/lib/openssl/rls/include
------------- END
I've got two GCC builds on my system - one from the Fedora packages, and
one I built myself. The error occurs with both.

The g++ command for each of these files was:
------------- BEGIN
g++ -c -pipe -O2 -g -fvisibility=hidden -fvisibility-inlines-hidden
-std=c++0x -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV
-DQT_NO_TSLIB -DDBUS_API_SUBJECT_TO_CHANGE -DQT_BUILD_DBUS_LIB
-DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS
-DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS
-DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS
-D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_CORE_LIB
-isystem /mnt/Data/devel/source/qt/qt5/qtbase/src/dbus -I.
-I/mnt/Data/devel/lib/icu/rls/include
-I/mnt/Data/devel/lib/zlib/rls/include
-I/mnt/Data/devel/lib/openssl/rls/include -I../../include
-I../../include/QtDBus -I../../include/QtDBus/5.5.1
-I../../include/QtDBus/5.5.1/QtDBus -I../../include/QtCore/5.5.1
-I../../include/QtCore/5.5.1/QtCore -I../../include/QtCore -I.moc
-I/mnt/Data/devel/source/qt/qt5/qtbase/mkspecs/linux-g++ -o
.obj/qdbusargument.o
/mnt/Data/devel/source/qt/qt5/qtbase/src/dbus/qdbusargument.cpp

g++ -c -pipe -O2 -g -fvisibility=hidden -fvisibility-inlines-hidden
-std=c++0x -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV
-DQT_NO_TSLIB -DDBUS_API_SUBJECT_TO_CHANGE -DQT_BUILD_DBUS_LIB
-DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS
-DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS
-DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS
-D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_CORE_LIB
-isystem /mnt/Data/devel/source/qt/qt5/qtbase/src/dbus -I.
-I/mnt/Data/devel/lib/icu/rls/include
-I/mnt/Data/devel/lib/zlib/rls/include
-I/mnt/Data/devel/lib/openssl/rls/include -I../../include
-I../../include/QtDBus -I../../include/QtDBus/5.5.1
-I../../include/QtDBus/5.5.1/QtDBus -I../../include/QtCore/5.5.1
-I../../include/QtCore/5.5.1/QtCore -I../../include/QtCore -I.moc
-I/mnt/Data/devel/source/qt/qt5/qtbase/mkspecs/linux-g++ -o
.obj/qdbusmarshaller.o
/mnt/Data/devel/source/qt/qt5/qtbase/src/dbus/qdbusmarshaller.cpp
------------- END

Looking at the .o files, and taking QDBusMarshaller::append(QString const&)
as an example, the symbol exists in both, and is a strong symbol in both.
------------- BEGIN
$ nm -C ./.obj/qdbusmarshaller.o | grep -F append

0000000000000050 T QDBusMarshaller::append(QString const&)

$ nm -C ./.obj/qdbusargument.o | grep -F append

0000000000001b30 T QDBusMarshaller::append(QString const&)
------------- END

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).

And yet, I didn't find hordes of people online complaining about this, so
I'm assuming it's something on my system/environment that's causing the
error.

Any help/suggestions on where to look next will be welcome. Thanks in
advance for your time.

Paulo Caetano
http://cidebycide.blogspot.pt/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151105/75638c31/attachment.html>


More information about the Interest mailing list