CompilingDLLsUsingMingw

This is a quick guide to compiling Wine's DLLs in PE format on UNIX using MingW.

Install Packages

Install MingW packages. On Debian, these are mingw32, mingw32-binutils and mingw32-runtime.

apt-get install mingw32 mingw32-binutils mingw32-runtime

Cross Compiling the Tests only

Once MingW is installed (and you have run configure) you can cross-compile tests from your standard build tree with:

make crosstest

This doesn't cross-compile dlls or programs, only the tests. It's useful if you want to quickly run a test on Windows without having to create a separate build tree.

Cross Compiling the Whole Tree

  • Gather some information generated in config.log by running configure in your main Wine tree:

    • Your cross compiler type, needed for --host below. (Example: 'i586-mingw32msvc')
  • Clone a copy of your main wine tree:

git clone -l wine-git wine-crossc
  • Create separate build trees for the native and cross builds. You must not build anything in the wine-crossc source directory:

mkdir build-native build-mingw
  • Build the native wine tools

cd build-native
../wine-crossc/configure
make __tooldeps__
cd ..
  • Now you can cross-compile. Be sure to unset CC if you have it set, otherwise mingw may not get used:

unset CC
cd build-mingw
../wine-crossc/configure --host=i586-mingw32msvc --with-wine-tools=../build-native --without-freetype --without-x
make

Note that you won't be able to run make throughout the whole tree as some DLLs are intrinsically tied to the Unix platform. Therefore, you may find it useful to run

make -k

instead.

Cross Compiling a DLL

You can easily cross compile a single DLL with the following:

cd dlls/<dll>
make <dll>.dll

Cross Compiling an import library

You can easily cross compile an import library for a DLL or static library with the following:

cd dlls/<dll>
make lib<dll>.a

CompilingDLLsUsingMingw (last edited 2010-08-04 06:31:38 by AustinEnglish)