Currently Online

Latest Posts

Changes in BuildingWidelandsUnderWindowsNew

Editor Comment

libtool hint

Revision Differences of Revision 21

# How to build Widelands with MinGW64 on Windows ¶

This is currently a work in progress! ¶

[TOC] ¶

# Download files ¶
## Nuwen's MinGW64 distro ¶

Download the main distro from []( and the MSYS2 installer: ¶

* [mingw-13.4.exe]( ¶
* [MSYS2]( from []( ¶

## SDL2 source packages ¶
* [SDL2]( ¶
* [SDL2_net]( ¶
* [SDL2_mixer]( ¶
* [SDL2_image]( ¶

## Additional libraries ¶
* [gzip]( ¶
* [libiconv]( ¶
* [gettext]( ¶
* [freetype]( ¶
* [ICU]( ¶

# Building all libraries ¶

* Use the self-extracting installer of Nuwen's and extract the distro to `C\\MinGW` ¶
* Install MSYS2 to `c:\msys2` and follow their update steps! ¶
* Open the distro window with `C:\MinGW\open_distro_window.bat` ¶
* In this shell change the directory with `cd c:\msys2` and call `msys2_shell.bat` or `msys2_shell.cmd` to start MSYS2, depending on your version of MSYS2. ¶

You are now in a linux like shell, so the command syntax is a bit different than normal windows commands ¶

* Call `pacman -S diffutils` to make sure that the "cmp" and "diff" commands are available. The libraries will need those to configure themselves - you will probably get errors like "./configure: line 5988: cmp: command not found" otherwise. ¶

* Extract all source packages to `c:\msys2\home\<username>\` ¶
* Build each package with `./configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/c/MinGW && make install` ¶
* Gzip1.6 does not compile without these [two patches]( ¶
* Download the patch files, save them in the gzip source folder and patch with ¶
* patch -d . -p1 < gzip_mingw64.patch ¶
* patch -d . -p1 < gzip_mingw64_2.patch ¶
* Libiconv and freetype have circular dependencies, so you should compile libiconv, then freetype and then libiconv again (run `make distclean` and `./configure`) ¶
* If you get a warning `remember to run 'libtool --finish /c/MinGW/lib'`, just run that command when the install has finished. If you don't have libtool, `pacman -S libtool` will fix that for you. ¶

### Troubleshooting ¶

* If you get an error `no acceptable C compiler found in $PATH`, you will need to execute `export PATH=${PATH}:/c/MinGW/bin` within MSYS2. ¶
* During troubleshooting, I also installed `pacman -S mingw-w64-x86_64-toolchain`, but that might not be necessary. I am unable to uninstall this, so I can't test whether we need it. ¶
* If compiling fails due to problems with the `INSTALLDIR` macro, track down the files and replace the macro with the hard-coded path, e.g. replace all instances of `const char *orig_installdir = INSTALLDIR;` with `const char *orig_installdir = "/c/MinGW";` (solution from [Chinese site]( ¶

# Download CMake and Ninja ¶

* Download [Ninja]( Extract simply to *C:\\MinGW\\bin*. ¶
* Download [CMAKE]( ¶

# Getting Widelands source code ¶

* This is described on [[ BzrPrimer ]] ¶

# Building Widelands ¶

We will build ninja in the normal distro window and not in the MSYS shell: ¶

* Open the distro window with *C:\\MinGW\\open_distro_window.bat* ¶
* Switch to the directory you'll want to build widelands in, e.g. *C:\\wl_build* ¶
* run CMAKE "cmake -G Ninja -DCMAKE_PREFIX_PATH=C:\\Mingw c:\\bzr\\widelands\\trunk". Important CMake options are documented on the [BuildingWidelands]( page. ¶
* Just call "ninja" to build now