Cross compiling tests

Hans Leidekker hans at
Fri Apr 11 07:24:14 CDT 2003


I'm trying to cross compile the regression tests using MinGW as a 
cross compiler (i.e. I have installed the MinGW cross compiler on 
Linux and run 'make crosstest').

First problem I encountered was that my versions of the compiler and 
dlltool weren't detected at configure stage. Mine are called 
i386-mingw-gcc and i386-mingw-dlltool, whereas configure looks for 
i586-mingw32msvc-gcc and i586-mingw32msvc-dlltool. I've sent a patch
to wine-patches that adds the former names to the configure check.

Second major problem happens at the build stage. The Makefile for
a test specifies -L$(DLLDIR) when linking the test executables, which
is where the *Wine* libraries reside. I think this is wrong, we 
should link against the target platform libraries (MinGW in this
case) when cross compiling.

Removing -L$(DLLDIR) from the Makefile also solves a conflict that
arises from the fact that both MinGW and Wine have an implementation 
of the C runtime:

make crosstest
i386-mingw32-gcc generated.cross.o testlist.cross.o -o urlmon_crosstest.exe -L../../../dlls  -lurlmon -lm
../../../dlls/libmsvcrt.a(ds00443.o)(.text+0x0): multiple definition of `atexit'
/usr/local/lib/gcc-lib/i386-mingw32/3.2.2/../../../../i386-mingw32/lib/crt2.o(.text+0x230):/usr/src/redhat/BUILD/mingw-2.4/mingw-runtime-2.4/crt1.c:266: first defined here
../../../dlls/libmsvcrt.a(ds00319.o)(.text+0x0): multiple definition of `_onexit'
/usr/local/lib/gcc-lib/i386-mingw32/3.2.2/../../../../i386-mingw32/lib/crt2.o(.text+0x250):/usr/src/redhat/BUILD/mingw-2.4/mingw-runtime-2.4/crt1.c:274: first defined here

Patch sent to wine-patches. Now most tests happily compile ;-). I
have two tests left that have problems linking. It appears that they
use symbols that are not available in any import library (not even Wine's):

i386-mingw32-gcc dsound.cross.o testlist.cross.o -o dsound_crosstest.exe  -ldsound -luser32 -lkernel32 -lm
dsound.cross.o(.text+0x1656): In function `dsenum_callback':
/usr/local/src/wine-cvs/wine/dlls/dsound/tests/dsound.c:403: undefined reference to `wine_dbgstr_guid'
dsound.cross.o(.text+0x24dd): In function `dscenum_callback':
/usr/local/src/wine-cvs/wine/dlls/dsound/tests/dsound.c:649: undefined reference to `wine_dbgstr_guid'
make: *** [dsound_crosstest.exe] Error 1

The wine_ prefix suggests that this is a Wine internal function, so 
it will never be avaliable on Windows/MinGW. Can these be removed?
Or is there an alternative that works on all platforms? This is the
other one that fails:

i386-mingw32-gcc safearray.cross.o vartest.cross.o testlist.cross.o -o oleaut32_crosstest.exe  -loleaut32 -lm
safearray.cross.o(.text+0x1496): In function `func_safearray':
/usr/local/src/wine-cvs/wine/dlls/oleaut32/tests/safearray.c:277: undefined reference to `IID_IUnknown'
safearray.cross.o(.text+0x14d1):/usr/local/src/wine-cvs/wine/dlls/oleaut32/tests/safearray.c:278: undefined reference to `IID_IUnknown'
safearray.cross.o(.text+0x150e):/usr/local/src/wine-cvs/wine/dlls/oleaut32/tests/safearray.c:281: undefined reference to `IID_IDispatch'
safearray.cross.o(.text+0x1549):/usr/local/src/wine-cvs/wine/dlls/oleaut32/tests/safearray.c:282: undefined reference to `IID_IDispatch'
make: *** [oleaut32_crosstest.exe] Error 1

Same problem I guess. Any suggestion as to how this one might be fixed
is welcome.


More information about the wine-devel mailing list