Thanx so far. It seems that the qmake does not generate a right order for
the libs to be linked.
When adding LIBS += -lole32 -lgdi32 to the ".pro"  file, the -lole32
-lgdi32 appears in front
of the Qtlibs and they will not find the symbols. When manually adding the
libs to the line, these symbols
are found, but a whole lot of others is not. It seems to me that I am doing
something wrong in the
".pro"  specification, but no clue what

See the result

[jan@hp spectrum-viewer]$ make
make -f Makefile.Release
make[1]: Entering directory
`/home/jan/cross-compiling/jsdr-3.04/spectrum-viewer'
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 -lgdi32 -lwinmm
-lstdc++ -lusb-1.0 -lQtGui4 -lQtCore4 -lole32 -lgdi32
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qapplication_win.o):(.text+0xe53e):
undefined reference to `IID_IAccessible'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x89d):
undefined reference to `IID_IUnknown'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x8c3):
undefined reference to `IID_IEnumVARIANT'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x91d):
undefined reference to `IID_IUnknown'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x943):
undefined reference to `IID_IDispatch'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x973):
undefined reference to `IID_IAccessible'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x98c):
undefined reference to `IID_IOleWindow'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0xa5c):
undefined reference to `IID_IDispatch'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0xb62):
undefined reference to `IID_IDispatch'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0xc50):
undefined reference to `IID_IDispatch'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0xf1f):
undefined reference to `IID_IDispatch'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x116b):
undefined reference to `IID_IDispatch'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x1c56):
undefined reference to `__imp_SysAllocStringLen'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x1ffe):
undefined reference to `__imp_SysAllocStringLen'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x232a):
undefined reference to `__imp_SysAllocStringLen'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x265a):
undefined reference to `__imp_SysAllocStringLen'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x298a):
undefined reference to `__imp_SysAllocStringLen'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x2cda):
more undefined references to `__imp_SysAllocStringLen' follow
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x2ebd):
undefined reference to `IID_IAccessible'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x3970):
undefined reference to `__imp_VariantInit'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x3d33):
undefined reference to `IID_IUnknown'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qaccessible_win.o):(.text+0x41d8):
undefined reference to `__imp_PlaySoundW'
/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(qaccessible_win.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
make[1]: Leaving directory
`/home/jan/cross-compiling/jsdr-3.04/spectrum-viewer'
make: *** [release] Error 2

thanx for any help
jan


---------- Forwarded message ----------
From: xunxun <[email protected]>
Date: 2012/7/4
Subject: Re: [Mingw-w64-public] cross compiling with static Qt libraries
To: [email protected]
Cc: jan van katwijk <[email protected]>


 于 2012/7/4 17:41, jan van katwijk 写道:

Dear list

I have an SDR application with Qt developed under Linux (Fedora/ubuntu). It
does run under windows (vista/w7) using mingw/Qt.
I am preparing a windows distribution with - as much as possible -
statically bound libraries
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.
It seems I have to specify some additional libs to be used in the linking
process, but I am completely lost.
This is the result of the linkage step:

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'\

You should add -lole32

/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

When I add in the makefile -lole32 at the end of the link command line,
these specific references disappear and some new ones do appear:

make -f Makefile.Release
make[1]: Entering directory
`/home/jan/cross-compiling/jsdr-3.04/spectrum-viewer'
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 -lole32
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qfont.o):(.text+0xc1b):
undefined reference to `__imp_GetDeviceCaps'
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qfont.o):(.text+0xc5b):
undefined reference to `__imp_GetDeviceCaps'

You should add -lgdi32

/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(qfont.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
make[1]: Leaving directory
`/home/jan/cross-compiling/jsdr-3.04/spectrum-viewer'
make: *** [release] Error 2

No idea where to find GetDeviceCaps, and no idea how to specify the ".pro"
file for Qt such that it includes the libraries needed in the right order

Try

LIBS += -lole32 -lgdi32


any help is greatly appreciated

best

-- 
Jan van Katwijk


+31 (0)15 3698980
+31 (0) 628260355




-- 
Best Regards,
xunxun




-- 
Jan van Katwijk


+31 (0)15 3698980
+31 (0) 628260355
------------------------------------------------------------------------------
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

Reply via email to