Talk:Compiling on Windows using MinGW

From OpenTTD
Jump to: navigation, search

Edit: The guide should reflect the new make.

--Kaan 15:12, 24 April 2007 (CEST)

ok, no reaction, im going to put it in then. --Kaan 00:24, 26 April 2007 (CEST)

I suggest that we strip the guide of the illegal directX package and replace it with instructions to compile with SDL. --Kaan 16:10, 27 April 2007 (CEST)

OK, no one is flaming me for being stupid so I'm going to do it ;) --Kaan 20:27, 30 April 2007 (CEST)


libpng new version

These instructions are not idiot proof as libpng 1.5.6 doesn't exist at sf any more. I will try to compile with a newer version.

zlib errors

i tried to follow theese instructions and i get

[SRC] Linking openttd.exe c:/mingw/lib\libz.a(inflate.o):inflate.c:(.text+0x2c0): multiple definition of `inflateInit_' c:/mingw/lib/libzdll.a(diges00042.o): first defined here c:/mingw/lib\libz.a(inflate.o):inflate.c:(.text+0x3f0): multiple definition of `inflate' c:/mingw/lib/libzdll.a(diges00035.o): first defined here c:/mingw/lib\libz.a(inflate.o):inflate.c:(.text+0x1da0): multiple definition of `inflateEnd' c:/mingw/lib/libzdll.a(diges00040.o): first defined here c:/mingw/lib\libz.a(deflate.o):deflate.c:(.text+0x0): multiple definition of `deflateEnd' c:/mingw/lib/libzdll.a(diges00008.o): first defined here c:/mingw/lib\libz.a(deflate.o):deflate.c:(.text+0x380): multiple definition of `deflate' c:/mingw/lib/libzdll.a(diges00005.o): first defined here c:/mingw/lib\libz.a(deflate.o):deflate.c:(.text+0x18a0): multiple definition of `deflateInit_' c:/mingw/lib/libzdll.a(diges00010.o): first defined here collect2: ld returned 1 exit status make[1]: *** [openttd.exe] Error 1 make[1]: Leaving directory `/home/ottdsrc/trunk/objs/release' make: *** [all] Error 2

any ideas?

I have no idea why you get this error. Is the other approach working? Oh and please log in to the wiki and sign you changes, thanks :) --Kaan 01:44, 11 May 2007 (CEST)

Error by compiling in dmusic.cpp (r10002 and higher) - fixed


I tried to compile OpenTTD with MinGW with the help of this wiki-docu.

It was successfull with r9789 and I got the OpenTTD.exe.
With new r10117 and with r10002 I get compileerrors with dmusic.cpp.

[SRC] Compiling mixer.cpp
[SRC] Compiling music.cpp
[SRC] Compiling music/dmusic.cpp
E:/msys/1.0/home/ottdsrc/trunk/src/music/dmusic.cpp:13:22: dmksctrl.h: No such file or directory
E:/msys/1.0/home/ottdsrc/trunk/src/music/dmusic.cpp:14:21: dmusici.h: No such file or directory
E:/msys/1.0/home/ottdsrc/trunk/src/music/dmusic.cpp:15:21: dmusicc.h: No such file or directory
E:/msys/1.0/home/ottdsrc/trunk/src/music/dmusic.cpp:16:21: dmusicf.h: No such file or directory
E:/msys/1.0/home/ottdsrc/trunk/src/music/dmusic.cpp:20: error: expected initializer before '*' token

EDIT: I have find out which was wrong. I have added the missing Header-Files (*.h) from the Microsoft DirectX SDK 2004.
Its very usefull to add the Header-Files by defaults to the sourcecode or to turn off features in dmusic.cpp... - Eisenbaehr

This is impossible to do because of licensing issues. We cannot (legally) distribute those DirectX SDK headers. Therefor we cannot add them to the source code. Rubidium 22:37, 13 June 2007 (CEST)
What to do to compile OpenTTD without this header? Sometimes the header could not be found. But BuildOpenTTD didn't use this headers.
EDIT: I have now turned off the DirectX Music in dmusic.cpp and deleted all references to the headers. OpenTTD runs without musics now.Eisenbaehr
The mingw used in BuildOTTD is made by following the instructions in this wiki and as you mentioned there is no problem with music there. I hope you discover the reason :) --Kaan 14:58, 24 June 2007 (CEST)

cant download wget

wget is so broken i couldnt get wget zlib and the is broken and messed up and i need help--Rabbit67890 06:42, 17 October 2007 (CEST)

it's work but you must change download URI, when prompted Download file URI? ( enter "" --Pecet 17:30, 20 January 2008 (CET)

GCC 4.5

Written down terse and not very user friendly, though it should give a decent idea of the required steps.

  • Download "base" from, then install it (remember the installation directory)
  • Download "useful" sources from, extract it to $INSTALLDIR/home. Once extracted extract all zips/tar.gzs.
  • Start bash from $INSTALLDIR/bin
  • Navigate to /home/<extracted dir>
  • Enter zlib directory
  • make -f win32/Makefile.gcc BINARY_PATH=/bin INCLUDE_PATH=/include LIBRARY_PATH=/lib install
  • Enter lzo directory
  • ./configure --bindir=/bin --includedir=/include --libdir=/lib --enable-static
  • make install
  • Enter lpng directory
  • make -f scripts/makefile.mingw install
  • Enter freetype
  • ./configure --bindir=/bin --includedir=/include --libdir=/lib --enable-static
  • make install
  • Enter icu/source (4.4.1 doesn't work, 4.2.1 does)
  • ./configure --bindir=/bin --includedir=/include --libdir=/lib --enable-static --disable-strict
  • make install
  • Enter xz
  • ./configure --bindir=/bin --includedir=/include --libdir=/lib --enable-static
  • make install

Compiling xz

The additional step requiring the installation of xz does not comply to both suggested methods of unpacking downloaded packages. If you copy unzipped contents of gettext-runtime, glib and pkg-config to the "home" folder, lzma compilation is skipped and you cannot compile openttd. Thus, you HAVE to use the command-line unpacking method for xz to compile properly.

Also, is it possible to compile openttd without lzma (as ./configure suggests)? If not, then that message should perhaps be removed as it could be confusing


Feel free to update the xz description to give a description for the alternate installation method. It is possible to compile OpenTTD without lzma, but in that case you will not be able to join most multiplayer games and OpenTTD will fail to load most savegames. We should strongly discourage compiling OpenTTD without lzma, and since this tutorial is intended for beginners IMO it is not necessary to mention this option here.

Problem when ./configure for Compiling libpng step


I follow previous step and install zlib but when i execute ./configure i got this message :

configure: error: zlib not installed

Any ideas ?

Thanks for your support

your compiler failed the acc conformance test

I had error as above when compiling libpng. I changed my gcc version to 5.7 using answer here

mingw-get upgrade --recursive "gcc<5.7.*" "gcc-g++<5.7.*"

Personal tools