尝试在Debian上交叉编译Qt 4.8.3时为win32构建失败

时间:2012-10-25 19:12:28

标签: qt compiler-errors debian cross-compiling

我正在尝试构建一个原始的Qt 4.8.3 tarball,并使用此命令配置构建:

./configure -opensource -xplatform win32-g++ -device-option CROSS_COMPILE=i686-w64-mingw32-

以下是(重新)运行make

的结果
$ make
cd src/tools/bootstrap/ && make -f Makefile 
make[1]: Entering directory `/home/wena/src/qt-4.8.3/src/tools/bootstrap'
make[1]: Nothing to be done for `first'.
make[1]: Leaving directory `/home/wena/src/qt-4.8.3/src/tools/bootstrap'
cd src/tools/moc/ && make -f Makefile 
make[1]: Entering directory `/home/wena/src/qt-4.8.3/src/tools/moc'
make[1]: Nothing to be done for `first'.
make[1]: Leaving directory `/home/wena/src/qt-4.8.3/src/tools/moc'
cd src/tools/rcc/ && make -f Makefile 
make[1]: Entering directory `/home/wena/src/qt-4.8.3/src/tools/rcc'
make[1]: Nothing to be done for `first'.
make[1]: Leaving directory `/home/wena/src/qt-4.8.3/src/tools/rcc'
cd src/tools/uic/ && make -f Makefile 
make[1]: Entering directory `/home/wena/src/qt-4.8.3/src/tools/uic'
make[1]: Nothing to be done for `first'.
make[1]: Leaving directory `/home/wena/src/qt-4.8.3/src/tools/uic'
cd src/winmain/ && make -f Makefile 
make[1]: Entering directory `/home/wena/src/qt-4.8.3/src/winmain'
make -f Makefile.Debug all
make[2]: Entering directory `/home/wena/src/qt-4.8.3/src/winmain'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/wena/src/qt-4.8.3/src/winmain'
make -f Makefile.Release all
make[2]: Entering directory `/home/wena/src/qt-4.8.3/src/winmain'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/wena/src/qt-4.8.3/src/winmain'
make[1]: Leaving directory `/home/wena/src/qt-4.8.3/src/winmain'
cd src/corelib/ && make -f Makefile 
make[1]: Entering directory `/home/wena/src/qt-4.8.3/src/corelib'
make -f Makefile.Debug all
make[2]: Entering directory `/home/wena/src/qt-4.8.3/src/corelib'
i686-w64-mingw32-g++ -shared -mthreads -Wl,--out-implib,/home/wena/src/qt-4.8.3/lib/libQtCored4.a -o ../../lib/QtCored4.dll object_script.QtCored.Debug  -L'/home/wena/src/qt-4.8.3/lib' -L'/home/wena/src/qt-4.8.3/lib' -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 .obj/debug-shared/QtCored_resource_res.o 
Creating library file: /home/wena/src/qt-4.8.3/lib/libQtCored4.a
./.obj/debug-shared/qtextcodec.o: In function `setup':
/home/wena/src/qt-4.8.3/src/corelib/codecs/qtextcodec.cpp:771: undefined reference to `QGb18030Codec::QGb18030Codec()'
/home/wena/src/qt-4.8.3/src/corelib/codecs/qtextcodec.cpp:772: undefined reference to `QGbkCodec::QGbkCodec()'
/home/wena/src/qt-4.8.3/src/corelib/codecs/qtextcodec.cpp:773: undefined reference to `QGb2312Codec::QGb2312Codec()'
/home/wena/src/qt-4.8.3/src/corelib/codecs/qtextcodec.cpp:774: undefined reference to `QEucJpCodec::QEucJpCodec()'
/home/wena/src/qt-4.8.3/src/corelib/codecs/qtextcodec.cpp:775: undefined reference to `QJisCodec::QJisCodec()'
/home/wena/src/qt-4.8.3/src/corelib/codecs/qtextcodec.cpp:776: undefined reference to `QSjisCodec::QSjisCodec()'
./.obj/debug-shared/qtextcodec.o: In function `QEucKrCodec':
/home/wena/src/qt-4.8.3/src/corelib/codecs/../../plugins/codecs/kr/qeuckrcodec.h:77: undefined reference to `vtable for QEucKrCodec'
./.obj/debug-shared/qtextcodec.o: In function `QCP949Codec':
/home/wena/src/qt-4.8.3/src/corelib/codecs/../../plugins/codecs/kr/qeuckrcodec.h:91: undefined reference to `vtable for QCP949Codec'
./.obj/debug-shared/qtextcodec.o: In function `QBig5Codec':
/home/wena/src/qt-4.8.3/src/corelib/codecs/../../plugins/codecs/tw/qbig5codec.h:56: undefined reference to `vtable for QBig5Codec'
./.obj/debug-shared/qtextcodec.o: In function `QBig5hkscsCodec':
/home/wena/src/qt-4.8.3/src/corelib/codecs/../../plugins/codecs/tw/qbig5codec.h:70: undefined reference to `vtable for QBig5hkscsCodec'
collect2: ld returned 1 exit status
make[2]: *** [../../lib/QtCored4.dll] Error 1
make[2]: Leaving directory `/home/wena/src/qt-4.8.3/src/corelib'
make[1]: *** [debug-all] Error 2
make[1]: Leaving directory `/home/wena/src/qt-4.8.3/src/corelib'
make: *** [sub-corelib-make_default-ordered] Error 2

我正在使用最新的Debian 7(Wheezy)。

3 个答案:

答案 0 :(得分:2)

使用-no-iconv cc-ing 4.7时出现了同样的错误。

来到这个hack转到src / corelib / codecs / codecs.pri:

win32 {
        !contains(QT_CONFIG,iconv) {
                # no iconv, so we put all plugins in the library
                HEADERS += \
                        ../plugins/codecs/cn/qgb18030codec.h \
                        ../plugins/codecs/jp/qeucjpcodec.h \
                        ../plugins/codecs/jp/qjiscodec.h \
                        ../plugins/codecs/jp/qsjiscodec.h \ 
                        ../plugins/codecs/kr/qeuckrcodec.h \
                        ../plugins/codecs/tw/qbig5codec.h \
                        ../plugins/codecs/jp/qfontjpcodec.h
                SOURCES += \
                        ../plugins/codecs/cn/qgb18030codec.cpp \
                        ../plugins/codecs/jp/qjpunicode.cpp \
                        ../plugins/codecs/jp/qeucjpcodec.cpp \
                        ../plugins/codecs/jp/qjiscodec.cpp \
                        ../plugins/codecs/jp/qsjiscodec.cpp \ 
                        ../plugins/codecs/kr/qeuckrcodec.cpp \
                        ../plugins/codecs/tw/qbig5codec.cpp \
                        ../plugins/codecs/jp/qfontjpcodec.cpp
        }
}

还有其他错误和黑客,但看起来它们已经在4.8.3中消失了。

答案 1 :(得分:0)

您缺少文本编解码器插件使用的libiconv库。有同样问题的人here

答案 2 :(得分:0)

为避免此错误:

In file included from main.cpp:42:0: dialog.h:65:5: error: ‘QSharedMemory’ does not name a type

看起来mxe使用./configure -nomake examples ...(另一个选项是vlc使用的,只做make sub-src而不是全局制作 - 尽管你不能使用make install这个方法因为它仍然试图构建示例)。看起来像qt中的一个bug给我...或者使用本地构建的qmake会有所帮助,没试过......

另见How do I configure Qt for cross-compilation from Linux to Windows target?