Qt 5.5.1 Error when building dbus support



  • 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:

    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
    

    I've searched the web and found nothing about these errors, so I'm assuming my configure options may be to blame for this.

    I'm building from the git repo, initialized with:

    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
    

    And this is my configure:

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

    Any help/suggestions will be welcome. Thanks in advance for your time.

    Paulo Caetano



  • I have the same problem. Ever so slightly different circumstances, so it might help to narrow the suspect's list. Compiling 5.5.1 on Scientific Linux release 6, from the tarball, and using as configuration:

    ./configure -prefix ~/prefix -qt-xcb
    

    Same error message:

    g++ -Wl,--no-undefined -Wl,-O1 -Wl,--enable-new-dtags -Wl,-rpath,/home/fbenurea/prefix/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/home/fbenurea/external/qt-everywhere-opensource-src-5.5.1/build/qtbase/lib -lQt5Core -lpthread
    .obj/qdbusmarshaller.o: In function `QDBusMarshaller::append(QString const&)':
    qdbusmarshaller.cpp:(.text+0x70): multiple definition of `QDBusMarshaller::append(QString const&)'
    .obj/qdbusargument.o:qdbusargument.cpp:(.text+0x1800): first defined here
    .obj/qdbusmarshaller.o: In function `QDBusMarshaller::open(QDBusMarshaller&, int, char const*)':
    qdbusmarshaller.cpp:(.text+0xf0): multiple definition of `QDBusMarshaller::open(QDBusMarshaller&, int, char const*)'
    .obj/qdbusargument.o:qdbusargument.cpp:(.text+0x18b0): first defined here
    .obj/qdbusmarshaller.o: In function `QDBusMarshaller::beginCommon(int, char const*)':
    qdbusmarshaller.cpp:(.text+0x1e0): multiple definition of `QDBusMarshaller::beginCommon(int, char const*)'
    .obj/qdbusargument.o:qdbusargument.cpp:(.text+0x19a0): first defined here
    .obj/qdbusmarshaller.o: In function `QDBusMarshaller::close()':
    qdbusmarshaller.cpp:(.text+0x270): multiple definition of `QDBusMarshaller::close()'
    .obj/qdbusargument.o:qdbusargument.cpp:(.text+0x20e0): first defined here
    .obj/qdbusmarshaller.o: In function `QDBusMarshaller::~QDBusMarshaller()':
    qdbusmarshaller.cpp:(.text+0x300): multiple definition of `QDBusMarshaller::~QDBusMarshaller()'
    .obj/qdbusargument.o:qdbusargument.cpp:(.text+0x2170): first defined here
    .obj/qdbusmarshaller.o: In function `QDBusMarshaller::~QDBusMarshaller()':
    qdbusmarshaller.cpp:(.text+0x300): multiple definition of `QDBusMarshaller::~QDBusMarshaller()'
    .obj/qdbusargument.o:qdbusargument.cpp:(.text+0x2170): first defined here
    .obj/qdbusmarshaller.o: In function `QDBusMarshaller::endCommon()':
    qdbusmarshaller.cpp:(.text+0x350): multiple definition of `QDBusMarshaller::endCommon()'
    .obj/qdbusargument.o:qdbusargument.cpp:(.text+0x21f0): first defined here
    .obj/qdbusmarshaller.o: In function `QDBusMarshaller::error(QString const&)':
    qdbusmarshaller.cpp:(.text+0x380): multiple definition of `QDBusMarshaller::error(QString const&)'
    .obj/qdbusargument.o:qdbusargument.cpp:(.text+0x2740): first defined here
    .obj/qdbusmarshaller.o: In function `QDBusMarshaller::appendRegisteredType(QVariant const&)':
    qdbusmarshaller.cpp:(.text+0x3b0): multiple definition of `QDBusMarshaller::appendRegisteredType(QVariant const&)'
    .obj/qdbusargument.o:qdbusargument.cpp:(.text+0x2770): first defined here
    .obj/qdbusmarshaller.o: In function `QDBusMarshaller::appendCrossMarshalling(QDBusDemarshaller*)':
    qdbusmarshaller.cpp:(.text+0x410): multiple definition of `QDBusMarshaller::appendCrossMarshalling(QDBusDemarshaller*)'
    .obj/qdbusargument.o:qdbusargument.cpp:(.text+0x3160): first defined here
    .obj/qdbusmarshaller.o: In function `QDBusMarshaller::appendVariantInternal(QVariant const&)':
    qdbusmarshaller.cpp:(.text+0x8c0): multiple definition of `QDBusMarshaller::appendVariantInternal(QVariant const&)'
    .obj/qdbusargument.o:qdbusargument.cpp:(.text+0x4330): first defined here
    .obj/qdbusmarshaller.o: In function `QDBusMarshaller::appendCrossMarshalling(QDBusDemarshaller*)':
    qdbusmarshaller.cpp:(.text+0x58c): undefined reference to `QDBusDemarshaller::currentSignature()'
    collect2: error: ld returned 1 exit status
    


  • @ernest.joyce
    My environment is relatively non-standard. GCC I built myself, in non-standard location, the same with ICU, zlib, and OpenSSL. What about yours?

    The compile commands for my machine are these:

    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
    

    WRT to the multiple definitions, I'd say there's something strange going on with -fvisibility=hidden, because all the symbols marked with this error are non-inline. Which means -fvisibility-inlines-hidden seems to be working.

    So, even though we have this in qdbusargument.cpp, it should make no difference, assuming -fvisibility=hidden was working.

    // for optimization purposes, we include the marshallers here
    #include "qdbusmarshaller.cpp"
    

    I'm still looking into this. I'm a bit way out of my depth, but that never stopped me before. It's how I've always been learning.



  • Yeah, my environment is non-standart too. It's on a cluster, and there are many compilers available, most of which must have been compiled specifically. I have no control over that however. I may try with a different compiler (but because everything else I need is compiled with gcc 4.8.2, I would not be much help for me if it worked.). In the mean time, I tried compiling Qt 5.4.2, with a similar result, but different symbols:

    g++ -Wl,--no-undefined -Wl,-e,qt_core_boilerplate -Wl,-O1 -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,/home/fbenurea/external/qt-everywhere-opensource-src-5.4.2/qtbase/src/corelib/QtCore.dynlist -Wl,-soname,libQt5Core.so.5 -o libQt5Core.so.5.4.2 .obj/qstring_compat.o .obj/qabstractanimation.o .obj/qvariantanimation.o .obj/qpropertyanimation.o .obj/qanimationgroup.o .obj/qsequentialanimationgroup.o .obj/qparallelanimationgroup.o .obj/qpauseanimation.o .obj/qatomic_unix.o .obj/archdetect.o .obj/qglobal.o .obj/qglobalstatic.o .obj/qlibraryinfo.o .obj/qmalloc.o .obj/qnumeric.o .obj/qlogging.o .obj/qhooks.o .obj/qatomic.o .obj/qexception.o .obj/qresultstore.o .obj/qfutureinterface.o .obj/qfuturewatcher.o .obj/qmutex.o .obj/qreadwritelock.o .obj/qrunnable.o .obj/qmutexpool.o .obj/qsemaphore.o .obj/qthread.o .obj/qthreadpool.o .obj/qthreadstorage.o .obj/qthread_unix.o .obj/qwaitcondition_unix.o .obj/qmutex_linux.o .obj/qarraydata.o .obj/qbitarray.o .obj/qbytearray.o .obj/qbytearraylist.o .obj/qbytearraymatcher.o .obj/qcollator.o .obj/qcommandlineoption.o .obj/qcommandlineparser.o .obj/qcryptographichash.o .obj/qdatetime.o .obj/qdatetimeparser.o .obj/qeasingcurve.o .obj/qelapsedtimer.o .obj/qfreelist.o .obj/qhash.o .obj/qline.o .obj/qlinkedlist.o .obj/qlist.o .obj/qlocale.o .obj/qlocale_tools.o .obj/qpoint.o .obj/qmap.o .obj/qmargins.o .obj/qmessageauthenticationcode.o .obj/qcontiguouscache.o .obj/qrect.o .obj/qregexp.o .obj/qrefcount.o .obj/qshareddata.o .obj/qsharedpointer.o .obj/qsimd.o .obj/qsize.o .obj/qstring.o .obj/qstringbuilder.o .obj/qstringlist.o .obj/qtextboundaryfinder.o .obj/qtimeline.o .obj/qtimezone.o .obj/qtimezoneprivate.o .obj/qunicodetools.o .obj/qvector.o .obj/qvsnprintf.o .obj/qversionnumber.o .obj/qelapsedtimer_unix.o .obj/qlocale_unix.o .obj/qtimezoneprivate_tz.o .obj/qcollator_posix.o .obj/qregularexpression.o .obj/pcre16_byte_order.o .obj/pcre16_chartables.o .obj/pcre16_compile.o .obj/pcre16_config.o .obj/pcre16_dfa_exec.o .obj/pcre16_exec.o .obj/pcre16_fullinfo.o .obj/pcre16_get.o .obj/pcre16_globals.o .obj/pcre16_jit_compile.o .obj/pcre16_maketables.o .obj/pcre16_newline.o .obj/pcre16_ord2utf16.o .obj/pcre16_refcount.o .obj/pcre16_string_utils.o .obj/pcre16_study.o .obj/pcre16_tables.o .obj/pcre16_ucd.o .obj/pcre16_utf16_utils.o .obj/pcre16_valid_utf16.o .obj/pcre16_version.o .obj/pcre16_xclass.o .obj/harfbuzz-buffer.o .obj/harfbuzz-gdef.o .obj/harfbuzz-gsub.o .obj/harfbuzz-gpos.o .obj/harfbuzz-impl.o .obj/harfbuzz-open.o .obj/harfbuzz-stream.o .obj/harfbuzz-shaper-all.o .obj/qharfbuzz.o .obj/qabstractfileengine.o .obj/qbuffer.o .obj/qdatastream.o .obj/qdataurl.o .obj/qtldurl.o .obj/qdebug.o .obj/qdir.o .obj/qdiriterator.o .obj/qfile.o .obj/qfiledevice.o .obj/qfileinfo.o .obj/qipaddress.o .obj/qiodevice.o .obj/qlockfile.o .obj/qnoncontiguousbytedevice.o .obj/qprocess.o .obj/qstorageinfo.o .obj/qtextstream.o .obj/qtemporarydir.o .obj/qtemporaryfile.o .obj/qresource.o .obj/qresource_iterator.o .obj/qsavefile.o .obj/qstandardpaths.o .obj/qurl.o .obj/qurlidna.o .obj/qurlquery.o .obj/qurlrecode.o .obj/qsettings.o .obj/qfsfileengine.o .obj/qfsfileengine_iterator.o .obj/qfilesystemwatcher.o .obj/qfilesystemwatcher_polling.o .obj/qfilesystementry.o .obj/qfilesystemengine.o .obj/qfileselector.o .obj/qloggingcategory.o .obj/qloggingregistry.o .obj/qfsfileengine_unix.o .obj/qfilesystemengine_unix.o .obj/qlockfile_unix.o .obj/qprocess_unix.o .obj/qfilesystemiterator_unix.o .obj/qstandardpaths_unix.o .obj/qstorageinfo_unix.o .obj/qfilesystemwatcher_inotify.o .obj/qabstractitemmodel.o .obj/qabstractproxymodel.o .obj/qitemselectionmodel.o .obj/qidentityproxymodel.o .obj/qsortfilterproxymodel.o .obj/qstringlistmodel.o .obj/qjson.o .obj/qjsondocument.o .obj/qjsonobject.o .obj/qjsonarray.o .obj/qjsonvalue.o .obj/qjsonwriter.o .obj/qjsonparser.o .obj/qpluginloader.o .obj/qfactoryloader.o .obj/quuid.o .obj/qlibrary.o .obj/qelfparser_p.o .obj/qmachparser.o .obj/qlibrary_unix.o .obj/qabstracteventdispatcher.o .obj/qabstractnativeeventfilter.o .obj/qbasictimer.o .obj/qeventloop.o .obj/qcoreapplication.o .obj/qcoreevent.o .obj/qmetaobject.o .obj/qmetatype.o .obj/qmetaobjectbuilder.o .obj/qmimedata.o .obj/qobject.o .obj/qobjectcleanuphandler.o .obj/qsignalmapper.o .obj/qsocketnotifier.o .obj/qtimer.o .obj/qtranslator.o .obj/qvariant.o .obj/qcoreglobaldata.o .obj/qsharedmemory.o .obj/qsystemsemaphore.o .obj/qpointer.o .obj/qmath.o .obj/qsystemerror.o .obj/qcore_unix.o .obj/qcrashhandler.o .obj/qeventdispatcher_unix.o .obj/qtimerinfo_unix.o .obj/qeventdispatcher_glib.o .obj/qsharedmemory_unix.o .obj/qsystemsemaphore_unix.o .obj/qisciicodec.o .obj/qlatincodec.o .obj/qtextcodec.o .obj/qtsciicodec.o .obj/qutfcodec.o .obj/qsimplecodec.o .obj/qgb18030codec.o .obj/qjpunicode.o .obj/qeucjpcodec.o .obj/qjiscodec.o .obj/qsjiscodec.o .obj/qeuckrcodec.o .obj/qbig5codec.o .obj/qiconvcodec.o .obj/qstatemachine.o .obj/qabstractstate.o .obj/qstate.o .obj/qfinalstate.o .obj/qhistorystate.o .obj/qabstracttransition.o .obj/qsignaltransition.o .obj/qeventtransition.o .obj/qmimedatabase.o .obj/qmimetype.o .obj/qmimemagicrulematcher.o .obj/qmimetypeparser.o .obj/qmimemagicrule.o .obj/qmimeglobpattern.o .obj/qmimeprovider.o .obj/qxmlstream.o .obj/qxmlutils.o .obj/qrc_mimetypes.o .obj/moc_qabstractanimation_p.o .obj/moc_qnamespace.o .obj/moc_qthread.o .obj/moc_qthreadpool.o .obj/moc_qfuturewatcher.o .obj/moc_qeasingcurve.o .obj/moc_qlocale.o .obj/moc_qtimeline.o .obj/moc_qfile.o .obj/moc_qfiledevice.o .obj/moc_qiodevice.o .obj/moc_qnoncontiguousbytedevice_p.o .obj/moc_qtextstream_p.o .obj/moc_qtemporaryfile.o .obj/moc_qsavefile.o .obj/moc_qsettings.o .obj/moc_qfilesystemwatcher_p.o .obj/moc_qfilesystemwatcher_polling_p.o .obj/moc_qfilesystemwatcher_inotify_p.o .obj/moc_qabstractitemmodel.o .obj/moc_qstringlistmodel.o .obj/moc_qpluginloader.o .obj/moc_qlibrary.o .obj/moc_qfactoryloader_p.o .obj/moc_qabstracteventdispatcher.o .obj/moc_qeventloop.o .obj/moc_qcoreapplication.o .obj/moc_qcoreevent.o .obj/moc_qmimedata.o .obj/moc_qsocketnotifier.o .obj/moc_qtimer.o .obj/moc_qtranslator.o .obj/moc_qobjectcleanuphandler.o .obj/moc_qsharedmemory.o .obj/moc_qeventdispatcher_unix_p.o .obj/moc_qeventdispatcher_glib_p.o .obj/moc_qabstractstate.o .obj/moc_qstate.o .obj/moc_qfinalstate.o .obj/moc_qhistorystate.o .obj/moc_qabstracttransition.o .obj/moc_qsignaltransition.o .obj/moc_qeventtransition.o  -lpthread -lz -lm -ldl -pthread -lgthread-2.0 -lrt -lglib-2.0
    .obj/qmutex_linux.o: In function `QBasicMutex::lockInternal()':
    qmutex_linux.cpp:(.text+0x0): multiple definition of `QBasicMutex::lockInternal()'
    .obj/qmutex.o:qmutex.cpp:(.text+0x100): first defined here
    .obj/qmutex_linux.o: In function `QBasicMutex::lockInternal(int)':
    qmutex_linux.cpp:(.text+0x70): multiple definition of `QBasicMutex::lockInternal(int)'
    .obj/qmutex.o:qmutex.cpp:(.text+0x170): first defined here
    .obj/qmutex_linux.o: In function `QBasicMutex::unlockInternal()':
    qmutex_linux.cpp:(.text+0x250): multiple definition of `QBasicMutex::unlockInternal()'
    .obj/qmutex.o:qmutex.cpp:(.text+0x470): first defined here
    collect2: error: ld returned 1 exit status
    make[3]: *** [../../lib/libQt5Core.so.5.4.2] Error 1
    make[3]: Leaving directory `/home/fbenurea/external/qt-everywhere-opensource-src-5.4.2/build/qtbase/src/corelib'
    make[2]: *** [sub-corelib-make_first] Error 2
    make[2]: Leaving directory `/home/fbenurea/external/qt-everywhere-opensource-src-5.4.2/build/qtbase/src'
    make[1]: *** [sub-src-make_first] Error 2
    make[1]: Leaving directory `/home/fbenurea/external/qt-everywhere-opensource-src-5.4.2/build/qtbase'
    make: *** [module-qtbase-make_first] Error 2
    


  • I've built with the system GCC (as opposed to my custom-built GCC), and the result is the same, exact same symbols duplicate and missing.

    I've also been reading about the visibility flags, and I've got it all wrong. These flags control export visibility for the final .so, which means it should have no influence on this issue.

    When I look at the sources, and at the result of g++ -E and the output from nm, the error makes perfect sense - there are duplicate symbols in two .o files, and these duplicate symbols cause an error when linking the .so, because the symbols are not weak.

    So, I can't understand what compilation/linking mechanism is supposed to keep this error from happening to everyone.


  • Lifetime Qt Champion

    Hi guys,

    You might be hit by QTBUG-46582 See the workaround linked in the comment. That might help



  • @SGaist
    Yes, I posted this on the Interest list, and Thiago's answer points to that, too.

    I can't get back to this before Monday, but I'll post a follow-up here.

    Thanks.



  • As promised, here is the follow-up.

    The workaround worked. I then ran ths command on gdb:

    /mnt/Data/devel/source/qt/build.exp/qtbase/bin/qmake
        /mnt/Data/devel/source/qt/qt5/qtbase/src/dbus/dbus.pro -o Makefile
    

    However, there were too many variables eliminated by optimization, and it was hard figuring out what was happening. E.g., on void MakefileGenerator::setProjectFile(QMakeProject *p), on this check

    if (project->isActiveConfig("win32"))
        target_mode = TARG_WIN_MODE;
    else if (project->isActiveConfig("mac"))
        target_mode = TARG_MAC_MODE;
    else
        target_mode = TARG_UNIX_MODE;
    

    I was getting TARG_MAC_MODE, instead of the TARG_UNIX_MODE I expected, especially because on MakefileGenerator * MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO)

    if(gen.isEmpty()) {
    ...
    } else if(gen == "UNIX") {
        mkfile = new UnixMakefileGenerator;
    } else if(gen == "MINGW") {
        mkfile = new MingwMakefileGenerator;
    } else if(gen == "PROJECTBUILDER" || gen == "XCODE") {
    

    I got a mkfile = new UnixMakefileGenerator, as expected.

    So, I decided to run configure with -no-optimized-qmake, and try again. And I've got errors on elementar functionality, e.g., this:

    /mnt/Data/devel/source/qt/qt5/qtbase/mkspecs/features/qt_module_pris.prf:136:
    Cannot write file /mkspecs/modules-inst/qt_lib_dbus.pri: Cannot create parent directory
    Project ERROR: Aborting.
    

    or this:

    QFileSystemEngine::currentPath () at
    /mnt/Data/devel/source/qt/qt5/qtbase/src/corelib/io/qfilesystemengine_unix.cpp:760
    760        qWarning("QFileSystemEngine::currentPath: getcwd() failed");
    

    So, I became even more suspicious of my environment, and decided to step back and run a more systematic test suite, which got me the results below on dbus support:

    -optimized-qmake
    Custom GCC - Failed
    Fedora GCC - Failed

    -no-optimized-qmake
    Custom GCC - Failed
    Fedora GCC - Success

    If we discount my custom environment (back to the drawing board for me), I've apparently hit some issue with my configuration options and -optimized-qmake.

    This makes more sense. Since the default is -no-optimized-qmake, it could explain why most people never get hit by this. Most "Qt-building recipes" I found on the web just take the default, and I've only used -optimized-qmake because I found it on Fedora's package source and decided to give it a try.

    I'll leave it at that, for now.

    Thanks for the help.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.