Can't build for Windows

• May 7, 2014 - 10:52
Type
Functional
Severity
S2 - Critical
Status
closed
Project

Since 2bf549ba72 I can't build for Windows anymore, linking fails:

Linking CXX executable mscore.exe
CMakeFiles\mscore.dir/objects.a(palette.cpp.obj): In function `ZNK2Ms9XmlReader9attributeEPKc':
.../MuseScore/libmscore/xml.h:69: undefined reference to `_imp___ZNK19XmlStreamAttributes5valueERK7QString'
CMakeFiles\mscore.dir/objects.a(palette.cpp.obj): In function `ZN7QVectorI18XmlStreamAttributeE8destructEPS0_S2_':
C:/Qt/5.2.1/mingw48_32/include/QtCore/qvector.h:292: undefined reference to `_imp___ZN18XmlStreamAttributeD1Ev'
..\libmscore\liblibmscore.a(xmlstream.cpp.obj): In function `ZN23XmlStreamEntityResolverD2Ev':
.../MuseScore/thirdparty/xmlstream/xmlstream.cpp:175: undefined reference to `_imp___ZTV23XmlStreamEntityResolver'
..\libmscore\liblibmscore.a(xml.cpp.obj): In function `ZNK2Ms9XmlReader12intAttributeEPKci':
.../MuseScore/libmscore/xml.cpp:32: undefined reference to `_imp___ZNK19XmlStreamAttributes5valueERK7QString'
..\libmscore\liblibmscore.a(xml.cpp.obj): In function `ZNK2Ms9XmlReader12intAttributeEPKc':
.../MuseScore/libmscore/xml.cpp:39: undefined reference to `_imp___ZNK19XmlStreamAttributes5valueERK7QString'
..\libmscore\liblibmscore.a(xml.cpp.obj): In function `ZNK2Ms9XmlReader15doubleAttributeEPKc':
.../MuseScore/libmscore/xml.cpp:48: undefined reference to `_imp___ZNK19XmlStreamAttributes5valueERK7QString'
..\libmscore\liblibmscore.a(xml.cpp.obj): In function `ZNK2Ms9XmlReader15doubleAttributeEPKcd':
.../MuseScore/libmscore/xml.cpp:54: undefined reference to `_imp___ZNK19XmlStreamAttributes5valueERK7QString'
..\libmscore\liblibmscore.a(xml.cpp.obj): In function `ZNK2Ms9XmlReader9attributeEPKcRK7QString':
.../MuseScore/libmscore/xml.cpp:66: undefined reference to `_imp___ZNK19XmlStreamAttributes5valueERK7QString'
..\libmscore\liblibmscore.a(xml.cpp.obj):.../MuseScore/thirdparty/xmlstream/xmlstream.h:120: more undefined references to `_imp___ZNK19XmlStreamAttributes5valueERK7QString' follow
collect2.exe: error: ld returned 1 exit status
mscore\CMakeFiles\mscore.dir\build.make:8265: recipe for target 'mscore/mscore.exe' failed
CMakeFiles\Makefile2:264: recipe for target 'mscore/CMakeFiles/mscore.dir/all' failed
makefile:135: recipe for target 'all' failed
mingw32-make[2]: *** [mscore/mscore.exe] Error 1
mingw32-make[1]: *** [mscore/CMakeFiles/mscore.dir/all] Error 2
mingw32-make: *** [all] Error 2

Seems the server for the Windows nightlies agrees, it too hasn't yet made the latest version available. For MacOS it seems to work though.


Comments

Confirmed under Windows 8.1 64bit, similar/same errors.

Linking CXX executable mscore.exe
CMakeFiles\mscore.dir/objects.a(palette.cpp.obj):palette.cpp:(.text+0x45fe): undefined reference to `_imp___ZNK19XmlStreamAttributes5valueERK7QString'
CMakeFiles\mscore.dir/objects.a(palette.cpp.obj):palette.cpp:(.text+0x4647): undefined reference to `_imp___ZN18XmlStreamAttributeD1Ev'
CMakeFiles\mscore.dir/objects.a(palette.cpp.obj):palette.cpp:(.text+0x4bda): undefined reference to `_imp___ZNK19XmlStreamAttributes5valueERK7QString'
CMakeFiles\mscore.dir/objects.a(palette.cpp.obj):palette.cpp:(.text+0x4c08): undefined reference to `_imp___ZN18XmlStreamAttributeD1Ev'
CMakeFiles\mscore.dir/objects.a(palette.cpp.obj):palette.cpp:(.text+0x5239): undefined reference to `_imp___ZNK19XmlStreamAttributes5valueERK7QString'
CMakeFiles\mscore.dir/objects.a(palette.cpp.obj):palette.cpp:(.text+0x526a): undefined reference to `_imp___ZN18XmlStreamAttributeD1Ev'
d:/qt520/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\mscore.dir/objects.a(palette.cpp.obj): bad reloc address 0x38 in section `.text$_ZNK10QStringRefeqEPKc[__ZNK10QStringRefeqEPKc]'
collect2.exe: error: ld returned 1 exit status
mscore\CMakeFiles\mscore.dir\build.make:8265: recipe for target 'mscore/mscore.exe' failed
mingw32-make[3]: *** [mscore/mscore.exe] Error 1
mingw32-make[3]: Leaving directory 'D:/MS_TRUNK/build.release'
CMakeFiles\Makefile2:264: recipe for target 'mscore/CMakeFiles/mscore.dir/all' failed
mingw32-make[2]: *** [mscore/CMakeFiles/mscore.dir/all] Error 2
mingw32-make[2]: Leaving directory 'D:/MS_TRUNK/build.release'
makefile:135: recipe for target 'all' failed
mingw32-make[1]: *** [all] Error 2
mingw32-make[1]: Leaving directory 'D:/MS_TRUNK/build.release'
makefile.mingw:27: recipe for target 'release' failed
mingw32-make: *** [release] Error 2

with github.musescore-musescore-1dff0380 the error changed slightly:

Linking CXX executable mscore.exe
CMakeFiles\mscore.dir/objects.a(palette.cpp.obj): In function `ZNK2Ms9XmlReader9attributeEPKc':
.../MuseScore/libmscore/xml.h:69: undefined reference to `_imp___ZNK19XmlStreamAttributes5valueERK7QString'
CMakeFiles\mscore.dir/objects.a(palette.cpp.obj): In function `ZN7QVectorI18XmlStreamAttributeE8destructEPS0_S2_':
C:/Qt/5.2.1/mingw48_32/include/QtCore/qvector.h:292: undefined reference to `_imp___ZN18XmlStreamAttributeD1Ev'
..\libmscore\liblibmscore.a(xml.cpp.obj): In function `ZNK2Ms9XmlReader12intAttributeEPKci':
.../MuseScore/libmscore/xml.cpp:33: undefined reference to `_imp___ZNK19XmlStreamAttributes5valueERK7QString'
..\libmscore\liblibmscore.a(xml.cpp.obj): In function `ZNK2Ms9XmlReader12intAttributeEPKc':
.../MuseScore/libmscore/xml.cpp:40: undefined reference to `_imp___ZNK19XmlStreamAttributes5valueERK7QString'
..\libmscore\liblibmscore.a(xml.cpp.obj): In function `ZNK2Ms9XmlReader15doubleAttributeEPKc':
.../MuseScore/libmscore/xml.cpp:49: undefined reference to `_imp___ZNK19XmlStreamAttributes5valueERK7QString'
..\libmscore\liblibmscore.a(xml.cpp.obj): In function `ZNK2Ms9XmlReader15doubleAttributeEPKcd':
.../libmscore/xml.cpp:55: undefined reference to `_imp___ZNK19XmlStreamAttributes5valueERK7QString'
..\libmscore\liblibmscore.a(xml.cpp.obj): In function `ZNK2Ms9XmlReader9attributeEPKcRK7QString':
.../MuseScore/libmscore/xml.cpp:67: undefined reference to `_imp___ZNK19XmlStreamAttributes5valueERK7QString'
..\libmscore\liblibmscore.a(xml.cpp.obj):C.../MuseScore/thirdparty/xmlstream/xmlstream.h:120: more undefined references to `_imp___ZNK19XmlStreamAttributes5valueERK7QString' follow
..\libmscore\liblibmscore.a(xml.cpp.obj): In function `ZN7QVectorI18XmlStreamAttributeE11reallocDataEii6QFlagsIN10QArrayData16AllocationOptionEE':
C:/Qt/5.2.1/mingw48_32/include/QtCore/qvector.h:482: undefined reference to `_imp___ZN18XmlStreamAttributeC1ERKS_'
..\libmscore\liblibmscore.a(xml.cpp.obj): In function `ZN7QVectorI18XmlStreamAttributeE16defaultConstructEPS0_S2_':
C:/Qt/5.2.1/mingw48_32/include/QtCore/qvector.h:265: undefined reference to `_imp___ZN18XmlStreamAttributeC1Ev'
..\thirdparty\xmlstream\libxmlstream.a(xmlstream.cpp.obj): In function `ZN23XmlStreamEntityResolverD2Ev':
.../MuseScore/thirdparty/xmlstream/xmlstream.cpp:175: undefined reference to `_imp___ZTV23XmlStreamEntityResolver'
collect2.exe: error: ld returned 1 exit status
mscore\CMakeFiles\mscore.dir\build.make:8267: recipe for target 'mscore/mscore.exe' failed
CMakeFiles\Makefile2:266: recipe for target 'mscore/CMakeFiles/mscore.dir/all' failed
makefile:135: recipe for target 'all' failed
mingw32-make[2]: *** [mscore/mscore.exe] Error 1
mingw32-make[1]: *** [mscore/CMakeFiles/mscore.dir/all] Error 2
mingw32-make: *** [all] Error 2

setting VERBOSE=1 additionally shows:
Linking CXX executable mscore.exe
cd /d C:\Users\joschmitz\Documents\GitHub\MuseScore\build.qtc\mscore && "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_link_script CMakeFiles\mscore.dir\link.txt --verbose=1
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E remove -f CMakeFiles\mscore.dir/objects.a
C:\Qt\Tools\mingw48_32\bin\ar.exe cr CMakeFiles\mscore.dir/objects.a @CMakeFiles\mscore.dir\objects1.rsp
C:\Qt\Tools\mingw48_32\bin\g++.exe -std=gnu++0x -mno-ms-bitfields -g .../MuseScore/build.qtc/resfile.o -mwindows -mconsole -L C:/Qt/5.2.1/mingw48_32/lib -Wl,--whole-archive CMakeFiles\mscore.dir/objects.a -Wl,--no-whole-archive -o mscore.exe -Wl,--out-implib,libmscore.dll.a -Wl,--major-image-version,0,--minor-image-version,0 ..\awl\libawl.a ..\mstyle\libmstyle.a ..\thirdparty\diff\libdiff_match_patch.a ..\bww2mxml\libbww.a ..\thirdparty\rtf2html\librtf2html.a ..\thirdparty\singleapp\src\libqtsingleapp.a ..\synthesizer\libsynthesizer.a ..\midi\libmidi.a ..\fluid\libfluid.a ..\effects\libeffects.a -lvorbisfile ..\libmscore\liblibmscore.a ..\thirdparty\xmlstream\libxmlstream.a ..\thirdparty\qzip\libqzip.a ..\zerberus\libzerberus.a ..\synthesizer\libsynthesizer.a ..\aeolus\libaeolus.a -lvorbis -logg ..\audiofile\libaudiofile.a -lsndfile-1 ..\thirdparty\ofqf\libofqf.a -lportaudio ..\thirdparty\portmidi\libportmidi.a -lwinmm -lz -lQt5Svg -lQt5Gui -lQt5Core -lQt5Widgets -lQt5Xml -lQt5Network -lQt5WebKitWidgets -lQt5WebKit -lQt5XmlPatterns -lQt5PrintSupport -lQt5Quick -lQt5Qml -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

I tried to look at the symbols defined inside libxmlstream.a in commit 4721517 Windows 8.1 (the compilation of which still fails for me) to search for these missing symbols, with "nm -g libxmlstream.a" under msys and these symbols are present, but without the prefix "_imp_" the linker is searching for.
For example, one of the line output of "nm -g libxmlstream.a" is
0000c0d4 T __ZNK19XmlStreamAttributes5valueERK7QString
but _imp___ZNK19XmlStreamAttributes5valueERK7QString (searched by the linker) is missing.
Hope this helps.

Ciao,
ABL

Status (old) active patch (code needs review)

Got it (I think)! See PR #892
Got rid of the linker errors, but also of a whole bunch of warnings that were annoying me since a while.
So here's proof for my Mantra: "Warnings Are Evil" esp. if you don't understand them. And they are also evil if you do understan them, but that are many, as it is way too easy to miss the tree in the forest...

Status (old) fixed active

Hmm, well, still some warnings left:
...\MuseScore\thirdparty\xmlstream\xmlutils.cpp:67:6: warning: 'static bool QXmlUtils::rangeContains(QXmlUtils::RangeIter, QXmlUtils::RangeIter, QChar)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
bool QXmlUtils::rangeContains(RangeIter begin, RangeIter end, const QChar c)
^
...\MuseScore\thirdparty\xmlstream\xmlutils.cpp:157:6: warning: 'static bool QXmlUtils::isIdeographic(QChar)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
bool QXmlUtils::isIdeographic(const QChar c)
^
...\MuseScore\thirdparty\xmlstream\xmlutils.cpp:186:6: warning: 'static bool QXmlUtils::isCombiningChar(QChar)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
bool QXmlUtils::isCombiningChar(const QChar c)
^
...\MuseScore\thirdparty\xmlstream\xmlutils.cpp:200:6: warning: 'static bool QXmlUtils::isDigit(QChar)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
bool QXmlUtils::isDigit(const QChar c)
^
...\MuseScore\thirdparty\xmlstream\xmlutils.cpp:214:6: warning: 'static bool QXmlUtils::isExtender(QChar)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
bool QXmlUtils::isExtender(const QChar c)
^
...\MuseScore\thirdparty\xmlstream\xmlutils.cpp:219:6: warning: 'static bool QXmlUtils::isBaseChar(QChar)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
bool QXmlUtils::isBaseChar(const QChar c)
^
...\MuseScore\thirdparty\xmlstream\xmlutils.cpp:233:6: warning: 'static bool QXmlUtils::isEncName(const QString&)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
bool QXmlUtils::isEncName(const QString &encName)
^
...\MuseScore\thirdparty\xmlstream\xmlutils.cpp:254:6: warning: 'static bool QXmlUtils::isLetter(QChar)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
bool QXmlUtils::isLetter(const QChar c)
^
...\MuseScore\thirdparty\xmlstream\xmlutils.cpp:268:6: warning: 'static bool QXmlUtils::isChar(QChar)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
bool QXmlUtils::isChar(const QChar c)
^
...\MuseScore\thirdparty\xmlstream\xmlutils.cpp:287:6: warning: 'static bool QXmlUtils::isNameChar(QChar)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
bool QXmlUtils::isNameChar(const QChar c)
^
...\MuseScore\thirdparty\xmlstream\xmlutils.cpp:310:6: warning: 'static bool QXmlUtils::isPublicID(const QString&)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
bool QXmlUtils::isPublicID(const QString &candidate)
^
...\MuseScore\thirdparty\xmlstream\xmlutils.cpp:369:6: warning: 'static bool QXmlUtils::isNCName(const QStringRef&)' redeclared without dllimport attribute after being referenced with dll linkage [enabled by default]
bool QXmlUtils::isNCName(const QStringRef &ncName)

Seems in xmlutils_p.h another Q_CORE_EXPORT needs to get deleted, sorry I missed it in the first round (QtCreator doesn't show it!?!), PR to follow shortly

And there is still:
...\MuseScore\thirdparty\ofqf\qosctypes.cpp: In member function 'void PathObject::signalData(QVariant)':
...\MuseScore\thirdparty\ofqf\qosctypes.cpp:153:52: warning: comparison between 'enum QVariant::Type' and 'enum QMetaType::Type' [-Wenum-compare]
if ( v.type() == _type || (v.type() == QMetaType::Float && _type == QVariant::Double) ) {
...
...\MuseScore\mscore\ove.cpp: In function 'bool OVE::getMiddleUnit(OVE::OveSong*, int, int, OVE::Measure*, OVE::Measure*, int, int, OVE::Measure*, int&)':
...\GitHub\MuseScore\mscore\ove.cpp:7636:6: warning: parameter 'middleMeasure' set but not used [-Wunused-but-set-parameter]
bool getMiddleUnit(
^

Not sure what to do about these, I guess the 1st needs a cast and the 2nd may need a change from pointer to reference?