问题
As I would like to build my Windows version of Qt5 application (C++) statically, I downloaded the source of Qt5 from git. Installed all dependencies like Python, Perl, etc. When I ran the following command
configure.bat -static -opensource -release -nomake examples -nomake tests -platform win32-g++ -c++11 -opengl desktop -no-icu -skip qtwebkit
Everything was fine and the config program said "Qt is now configured for building. Just run mingw32-make."
When I execute as requested, it ran for minutes but result in a following error at the end.
mingw32-make[4]: Entering directory 'c:/Users/lmh/Desktop/proj/QT/qt5-real/qtbas
e/src/tools/moc'
g++ -Wl,--gc-sections -Wl,-s,--gc-sections -Wl,-subsystem,console -o ../../../bi
n/moc.exe .obj/release/moc.o .obj/release/preprocessor.o .obj/release/generator.
o .obj/release/parser.o .obj/release/token.o .obj/release/main.o -LC:/Users/lmh
/Desktop/proj/QT/qt5-real/qtbase/lib -lQt5Bootstrap -luser32 -lole32 -ladvapi32
-lshell32 -lz
C:/Users/lmh/Desktop/proj/QT/qt5-real/qtbase/lib/libQt5Bootstrap.a: could not re
ad symbols: Archive has no index; run ranlib to add one
collect2.exe: error: ld returned 1 exit status
Makefile.Release:100: recipe for target '../../../bin/moc.exe' failed
mingw32-make[4]: *** [../../../bin/moc.exe] Error 1
mingw32-make[4]: Leaving directory 'c:/Users/lmh/Desktop/proj/QT/qt5-real/qtbase
/src/tools/moc'
Makefile:34: recipe for target 'release' failed
mingw32-make[3]: *** [release] Error 2
mingw32-make[3]: Leaving directory 'c:/Users/lmh/Desktop/proj/QT/qt5-real/qtbase
/src/tools/moc'
Makefile:84: recipe for target 'sub-moc-make_first' failed
mingw32-make[2]: *** [sub-moc-make_first] Error 2
mingw32-make[2]: Leaving directory 'c:/Users/lmh/Desktop/proj/QT/qt5-real/qtbase
/src'
Makefile:41: recipe for target 'sub-src-make_first' failed
mingw32-make[1]: *** [sub-src-make_first] Error 2
mingw32-make[1]: Leaving directory 'c:/Users/lmh/Desktop/proj/QT/qt5-real/qtbase
'
Makefile:50: recipe for target 'module-qtbase-make_first' failed
mingw32-make: *** [module-qtbase-make_first] Error 2
Did anyone encounter similar problem before? I have used similar approach to compile source on Linux, I do not understand why it failed on Windows. I would be glad to know what is wrong with my approach. Thank you very much.
来源:https://stackoverflow.com/questions/28660280/failure-on-building-qt5-from-source-on-windows