2

(Crosspost from here, since nobody seems to have an idea)

Hello everyone,

I am trying to cross compile qt 4.8.3 from my linux for my windows. The final goal is to build a static qt, but independent of building static or not I always get the same error. Playing around with various flags didn't help either:

./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x18dc): undefined reference to `QGb18030Codec::QGb18030Codec()'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x18ef): undefined reference to `QGbkCodec::QGbkCodec()'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x1902): undefined reference to `QGb2312Codec::QGb2312Codec()'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x1915): undefined reference to `QEucJpCodec::QEucJpCodec()'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x1928): undefined reference to `QJisCodec::QJisCodec()'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x193b): undefined reference to `QSjisCodec::QSjisCodec()'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x1956): undefined reference to `vtable for QEucKrCodec'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x1971): undefined reference to `vtable for QCP949Codec'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x198c): undefined reference to `vtable for QBig5Codec'
./.obj/release-shared/qtextcodec.o:qtextcodec.cpp:(.text+0x19a7): undefined reference to `vtable for QBig5hkscsCodec'

I'm using the default win32-g++ configuration file in combination with mingw.

I googled quite a bit around, but I have still no idea, where this comes from.. Maybe someone of you has the right hint for me ;-)

  • just curious, why cross-compiling and not building in windows? i do all my development in linux, but keep a whole qt/mingw toolchain with QtCreator on a small windows VM to build deployable binaries there. _much_ easier than crosscompiling or trying to deal with VS – Javier Oct 23 '12 at 18:40
  • Currently I only have linux+mingw here, although setting up mingw on windows would be my fallback solution. – kaesekuchen Oct 23 '12 at 18:44
  • 2
    Try the suggestion here: http://comments.gmane.org/gmane.comp.lib.qt.general/42338 – Steve-o Oct 23 '12 at 19:32
  • Your problem should be solved with my hack from similar http://stackoverflow.com/questions/13075577/build-failure-when-trying-to-cross-compile-qt-4-8-3-on-debian-for-win32 . – error Oct 29 '12 at 22:13

1 Answers1

3

You could use MXE to build it. It's quite easy. You simply do:

make qt

It does pretty much everything automatically, including downloading sources, applying needed patches to enable cross compiling (which might be why manually cross compiling Qt on your own is failing), and building all dependencies. You can download MXE from: http://mxe.cc. Read the docs of course on how to cross compile software with it.

The gist of it is that instead of qmake you use i686-pc-mingw32-qmake (after you've changed your PATH to include the MXE directory, as per the docs.)

MXE builds everything as static libraries, so when you cross compile a program, you'll get a single .exe file with no depenendies on any DLLs.

Nikos C.
  • 50,738
  • 9
  • 71
  • 96