Can't build Qt5 (qtbase) on Windows XP (win32-msvc2005)



  • In a cmd.exe prompt, using msysgit, I cloned git://gitorious.org/qt/qtbase.git.
    Set QTDIR to that qtbase directory, added %QTDIR%\bin to PATH.
    Made sure sh.exe is not in the PATH. Set
    The problem:

    configure -developer-build -opensource -nomake examples -nomake tests
    fails with a link error for configure.exe, due to duplicated symbols:
    @
    Please wait while bootstrapping configure ...

    Microsoft (R) Program Maintenance Utility Version 8.00.50727.762
    Copyright (C) Microsoft Corporation. All rights reserved.

        link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:CONSOLE " /MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST /MANIFESTFILE:"configure.intermediate.manifest" /OUT:..\..\configure.exe @C:\DOCUME~1\kdabian\LOCALS~1\Temp\nm46.tmp
    

    environment.obj : error LNK2005: "public: __thiscall public: __thiscall QList<class QString>::QList<class QString>(class QList<class QString> const &)'::5'::Cleanup::Cleanup(struct QListData::Data *)" (??0Cleanup@?4???0?$QList@VQString@@@@QAE@ABV1@@Z@QAE@PAUData@QListData@@@Z) already defined in configureapp.obj
    environment.obj : error LNK2005: "public: __thiscall public: __thiscall QList<class QString>::QList<class QString>(class QList<class QString> const &)'::5'::Cleanup::~Cleanup(void)" (??1Cleanup@?4???0?$QList@VQString@@@@QAE@ABV1@@Z@QAE@XZ) already defined in configureapp.obj
    @
    and a lot more of the same.

    Sample compilation line, to see the flags:
    @
    cl -c -FIconfigure_pch.h -Yuconfigure_pch.h -Fpconfigure_pch.pch -MP -nologo -Zm200 -Zc:wchar_t -MT -W3 -GR -EHsc -w34100 -w34189 -DUNICODE -DQT_NO_CODECS -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_COMPRESS -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -D_CRT_SECURE_NO_DEPRECATE -DQT_BOOTSTRAPPED -DCOMMERCIAL_VERSION -I"....\include" -I"....\include\QtCore" -I"....\include\QtCore\5.0.0" -I"....\include\QtCore\5.0.0\QtCore" -I"C:\Qt\qtbase\tools\shared" -I"C:\Qt\qtbase\mkspecs\win32-msvc2008" C:\Qt\qtbase\src\corelib\xml\qxmlstream.cpp C:\Qt\qtbase\src\corelib\xml\qxmlutils.cpp qxmlstream.cpp
    @
    (funny that -opensource sets -DCOMMERCIAL_VERSION, but that's unrelated...)
    Strange, too that my QMAKESPEC being set to win32-msvc2005 leads to win32-msvc2008 in the compilation line.



  • I had this problem too. It looks like there is no way around it except upgrading Visual Stduio. The problem is described here: http://stackoverflow.com/questions/2078087/local-classes-inside-inline-non-member-function-produces-lnk2005-with-msvc2005

    The code that triggers the problem is in qlist.h:

    @template <typename T>
    Q_OUTOFLINE_TEMPLATE QList<T>::QList(const QList<T> &l)
    : d(l.d)
    {
    if (!d->ref.ref()) {
    p.detach(d->alloc);

        struct Cleanup
        {
            Cleanup(QListData::Data *d) : d_(d) {}
            ~Cleanup() { if (d_) free(d_); }
    
            QListData::Data *d_;
        } tryCatch(d);
    
        node_copy(reinterpret_cast<Node *>(p.begin()),
                reinterpret_cast<Node *>(p.end()),
                reinterpret_cast<Node *>(l.p.begin()));
        tryCatch.d_ = 0;
    }
    

    }
    @



  • You can use the /FORCE linker option to get rid of the linker errors (the linker reports warnings instead). Here's a description on how to succeed with the complete build of Qt5 qtbase on XP using msvc2005 (so you don't have to upgrade): http://qt-project.org/forums/viewthread/27666/


Log in to reply
 

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