2

我正在尝试构建一个原始的 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)。

4

3 回答 3

2

使用-no-iconv cc-ing 4.7 时我遇到了同样的错误。

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

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 中消失了。

于 2012-10-27T19:20:54.367 回答
0

You are missing the libiconv library used by the text codec plugins. Someone with the same problem here.

于 2012-10-26T07:44:14.163 回答
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——尽管你不能使用make install这个方法,因为它仍然试图构建示例)。对我来说似乎是 qt 中的一个错误......或者使用本地构建的 qmake 会有所帮助,没有尝试过......

另请参阅如何配置 Qt 以实现从 Linux 到 Windows 目标的交叉编译?

于 2013-09-13T18:30:07.953 回答