jan van katwijk schreef op wo 04-07-2012 om 11:41 [+0200]: > I installed Fedora 17 and the - excellent - cross compilation tools > for mingw64. It was surprisingly simple to > generate an executable using dynamically bound libs, however, when > trying to create an executable with static binding > for the most important (i.e. QtGui etc) libs, there are linking > problems: apparently the references from the Qt libs to some windows > libs > cannot be resolved.
> x86_64-w64-mingw32-g++ -static -Wl,-s -Wl,-subsystem,console -mthreads > -o release/spectrum-viewer.exe object_script.spectrum-viewer.Release > -L'/usr/x86_64-w64-mingw32/sys-root/mingw/lib' > /home/jan/cross-compiling/dll_64/libfftw3-3.lib > /home/jan/cross-compiling/qwt-5.2.2/lib/libqwt.a -lole32 -lwinmm -lstdc++ > -lusb-1.0 -lQtGui4 -lQtCore4 > /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qapplication.o):(.text+0x1824): > undefined reference to `__imp_CoCreateGuid' > /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qapplication.o):(.text+0x1849): > undefined reference to `__imp_StringFromGUID2' > /usr/lib64/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld: > /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qapplication.o): bad > reloc address 0x0 in section `.data' > /usr/lib64/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld: > final link failed: Invalid operation > collect2: error: ld returned 1 exit status > make[1]: *** [release/spectrum-viewer.exe] Error 1 Hi, When you want to link against a static copy of Qt, you need to add CONFIG += static to your .pro file. That way all win32 libs which are needed for static linking will be added automatically. Also check the testcase which we've used in Fedora to test this feature: http://svn.openftd.org/svn/fedora_mingw_testsuite/trunk/testcases/qt/qmake/ I do have to note that this probably only works on Fedora and not on other environments as the patch to enable this feature isn't upstreamed yet. The patches [1][2] still have to be polished a bit more before it's ready to be submitted upstream. Regards, Erik van Pienbroek Fedora MinGW SIG [1]: http://pkgs.fedoraproject.org/gitweb/?p=mingw-qt.git;a=blob;f=qt-merge-static-and-shared-library-trees.patch;h=6f557221f84a9ef2c7b1d6dc9f4a0879af32dc95;hb=HEAD [2]: http://pkgs.fedoraproject.org/gitweb/?p=mingw-qt.git;a=blob;f=qmake.conf.win32;h=98c0e72990ad4a42c16478b4f7c9dc85bfe20f1e;hb=HEAD ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
