Latest Posts

Changes in Building Widelands

Editor Comment

Added buidl requirements for Fedora from the Fedora spec file.

Revision Differences of Revision 133

This page is about building widelands for various operating systems. If you managed to build widelands under your OS and you can't find informations about it here, please add them for the other who will come after you and try it. ¶

[TOC] ¶

# Additional Tools ¶

If you are a developer, you might (optionally!) make use of the following software: ¶

* **ctags** ¶
* **astyle** does not layout correctly when structs are used like public classes (C++) and not in the traditional C sense. If you decide to use this, please double-check the results before committing ¶
* **pngrewrite** and optipng Used to make PNG images more compact. You most certainly don’t need this; compactification is a once-a-year, one-person-only job. If you don’t know already that you will be doing it, forget about it. ¶
* **Krazy** A sourcecode checker from the KDE project, subversion repository available at svn:// ¶
* **Doxygen** Used to generate source code documentation. ¶

# Libraries ¶

Widelands currently depends on the following libraries, make sure they all are installed and in the search path of your compiler. The suggested compiler to build widelands is gcc 4, but it might work with other compilers too. Clang/LLVM can be used with current trunk, and we are currently (as of May 5, 2012) not aware of any major problems with clang anymore. Note that Build17 and before most probably produce unplayable builds when compiled with clang/llvm, see [the crash bug report]( for more info.) ¶

Please note that lua version 5.1 is required. Attempting to build with lua 5.2 [will not work]( ¶

* [libSDL]( >=1.2.11 ¶
* [libSDL_gfx]( ¶
* [libSDL_image]( ¶
* [libSDL_net]( ¶
* [libSDL_mixer]( >= 1.2.12 (Versions >= 1.2.6 will work with music disabled, but will crash if it's enabled.) ¶
* [libSDL_ttf]( >= 2.0.0 ¶
* [gettext]( ¶
* libiconv (on same mirrors as gettext) ¶
* [zlib]( ¶
* [libpng]( ¶
* [Boost]( >= 1.48 ¶
* [Python]( >= 1.5.2 ¶
* [lua]( >= 5.1 ¶
* [lua]( << 5.2 ¶
* [libglew]( ¶
* [doxygen]( ¶

# Building with CMake ¶

CMake is the current preprocessing system Widelands is using. More information can be found at the WidelandsGoingCMake page. ¶

## The fastest way to build Widelands (terminal use) ¶

First of all it must be ensured, that all needed packages are installed (some help for common Linux systems can be found at the end of this chapter). As soon as you are ready with this step, ¶

* [Download](../DownloadPage) the latest build or obtain the branch: ¶
* $ bzr branch lp:widelands ¶
* Change directory: ¶
* $ cd widelands ¶
* Compile Widelands (a menu will lead you through the process): ¶
* $ ./ ¶
* To run Widelands after compilation or to run it again later on (in last case make sure you are in Widelands directory ("cd widelands")): ¶
* $ ./widelands ¶

If you told the script to create an updater (only possible, if you use bzr versions) you are able to update Widelands via running ./ (again make sure you are in the Widelands directory) ¶

### Ubuntu / Debian (Installation of needed Packages) ¶

***Ubuntu almost generic*** ¶

run: **sudo apt-get build-dep widelands** ¶

To check which packages will be installed by build-dep you can run: **apt-rdepends --build-depends --follow=DEPENDS widelands**. ¶

Note that if you are running an older Ubuntu release, there might be new dependencies for Widelands which was added after the version available in the repositories was released. For a complete, up to date list on required dependencies, continue reading. ¶

***Complete list of packages*** ¶

(General note: if you add the parameter --no-install-recommends it will not install recommended packages. This will reduce the time and disk space needed, and none of the recommended packages are necessary to build Widelands.) ¶

run: **sudo apt-get install bzr cmake g++ gettext libboost-signals-dev libboost-test-dev libglew-dev libpng-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev liblua5.1-dev python zlib1g-dev** ¶

Additionally, though not required, you may want to install the following packages: **sudo apt-get install doxygen exuberant-ctags libboost-dev libgcc1 libiconv-hook-dev liblua5.1-0 libsdl1.2-dev lua5.1 optipng** ¶

***Older releases*** ¶

To match version requirements you may have to force the version of libboost-dev to 1.48 manually; Ubuntu Precise seems to default to 1.46.1 for libboost-dev. To force the version, install libboost1.48-dev instead of the generic libboost-dev.. ¶

### Mageia (Installation of needed Packages) ¶

As root run (su): **urpmi gcc gcc-c++ binutils make boost-devel SDL_image-devel SDL_net-devel SDL_ttf-devel SDL_mixer-devel png-devel optipng pngrewrite ctags gettext-devel cmake SDL_gfx-devel jpeg-devel tiff-devel lua5.1 lua5.1-devel doxygen bzr glew-devel boost-static-devel minizip1 minizip-devel** ¶

### Mandriva (Installation of needed Packages) ¶

As root run (su): **urpmi gcc gcc-c++ binutils make boost-devel SDL_image-devel SDL_net-devel SDL_ttf-devel SDL_mixer-devel png-devel optipng pngrewrite ctags gettext-devel cmake SDL_gfx-devel jpeg-devel tiff-devel lua-devel doxygen bzr glew-devel boost-static-devel** ¶

### Arch Linux (Installation of needed Packages) ¶

This assumes you have already set up xorg and your favorite desktop environment/window manager, and configured the sound. ¶

As root run (sudo): **pacman -S make cmake gcc boost bzr glew lua51 python python2 sdl_gfx sdl_image sdl_mixer sdl_net sdl_ttf** ¶

Note: Make sure to install lua51, as the lua package is update to version 5.2 which will fail to build Widelands. See [bug 1073932]( for more info. ¶

Note that this will install both python2 and python3. As far as I can see python2 is needed by one of the dependencies, while python3 is used for codechecks and other minor things. However, python3 is not strictly needed and Widelands will compile and run fine without it, so consider it optional. ¶

### openSUSE 12.3 (Installation of needed Packages) ¶
install compiler: ¶

**zypper install -t pattern devel_C_C++** ¶

install libraries: ¶

**zypper install bzr cmake doxygen gcc gcc-c++ gettext glew-devel glew libSDL-devel libSDL_gfx-devel libSDL_image-devel libSDL_mixer-devel libSDL_net-devel libSDL_ttf-devel lua51-devel python zlib-devel libpng15-devel boost-devel** ¶

### Fedora (Installation of needed Packages) ¶
install libraries: ¶

Fedora 19 ¶
**yum install bzr cmake doxygen python SDL-devel SDL_gfx-dettvel SDL_image-devel SDL_mixer-devel SDL_net-devel pythSDL_sound-devel SDL_ttf-devel boost-devel boost-static cmake ctags desktop-file-utils gettext ggz-base-libs-devel glew-devel libjpeg-devel libpng-dewvel libtiff-devel SDLzlib-devel SDL_libpng-devel optipng drehatlas-widelands-fonts gnu-free-serif-fonts gnu-free-sans-fonts hicolor-icon-theme lua-devel** ¶

Fedora 20 ¶
**yum install bzr doxygen python SDL
-devel SDL_gfx-devel SDL_image-devel SDL_mixer-devel SDL_net-devel SDL_sound-devel SDL_ttf-devel boost-devel boost-static cmake ctags desktop-file-utils gettext ggz-base-libs-devel glew-devel libjpeg-devel libpng-devel libtiff-devel zlib-devel libpng-devel optipng drehatlas-widelands-fonts gnu-free-serif-fonts gnu-free-sans-fonts hicolor-icon-theme compat-lua-devel**

# Building under Windows ¶

If you’re searching for a good BZR tool for windows, we recommend [Tortoise BZR]( ¶

## Building under MinGW ¶

Please visit BuildingWidelandsUnderWindows ¶

## Building under MSVC ¶

Visual Studio is supported in trunk r5010 through CMake. Getting all the dependencies may be burdensome on windows, so most of the dependencies are provided in a bundle, which is available in lp:~jarih/+junk/widelands-3rdparty. Only need to add boost libraries. And if you want language support, gettext library from gnuwin32 project. Just compiling and running with english does not need gettext to be installed. ¶

Starting from r5480 MSVC build is using static linkage to 3rdparty libraries and set to use static C runtime. Libraries are built with VS2008 Pro Sp1, but works well with VS2010 Express. Source code for all third party libraries with VS2008 solution files and batch build support is available in lp:~jarih/+junk/wl-3rdparty-src. ¶

* Install required packages: ¶
* [Visual C++ 2010 Express]( (VS2008 should work, too) ¶
* [CMake]( ¶
* [Python]( ¶
* [Boost]( (in the installer you need to select additionally "Boost Signals" and, if you want to run unit tests, also "Boost Test (unit test framework)") ¶
* [Minizip]( (download source code and Windows binary) ¶
* [Bazaar]( ¶
* [Gettext]( for localization support ¶
* Get source and 3rd party bundle ¶
* bzr branch lp:widelands ¶
* bzr branch lp:~jarih/+junk/widelands-3rdparty 3rdparty ¶
* Run cmake-gui ¶
* Select Widelands root dir as source code directory ¶
* Define a build directory for the binaries ¶
* Execute "Configure" ¶
* Use "Visual Studio 10" as generator ¶
* Select "User default native compilers" ¶
* If no errors were found while configuring (otherwise see below), click on "Generate" ¶
* Configuring may complain about include dir and some packages not found ¶
* Set WL_3RDPARTY_DIR to point to 3rd party bundle directory ¶
* Set Boost_INCLUDE_DIR (this is in advanced view) to your boost include directory ¶
* Only if building revision before r6403, you need to manually set boost libraries ¶
* Set Boost_SIGNALS_LIBRARY_DEBUG (this is in advanced view) to "/boost/lib/libboost_signals-vc100-mt-sgd-1_47.lib" ¶
* Set Boost_SIGNALS_LIBRARY_RELEASE (this is in advanced view) to "/boost/lib/libboost_signals-vc100-mt-s-1_47.lib" ¶
* Set MINIZIP_INCLUDE_DIR (this is in advanced view) to your Minizip include directory ¶
* Set MINIZIP_LIBRARY (this is in advanced view) to the Minizip binary "/bin/static32/zlibstat.lib" ¶
* Include gettext binary dir to visual studio paths or system path (needed for localization) ¶
* Open project properties of "ALL_BUILD" project. ¶
* Select "Configuration properties"/"VC++ Directories" on left tree view ¶
* Add "C:\\Program Files (x86)\\!GnuWin32\\bin\\" or whatever is your !GnuWin32 installation dir to "Executable directories" ¶
* Alternatively you can just add gnuwin32 bin dir to your system path ¶
* Build project "ALL_BUILD" with VS2010 (right click on this project and click on "Rebuild") ¶
* Running: ¶
* Set working dir to Widelands root dir, or add commandline option --datadir=<Widelands root dir> ¶

## Building under InnoSetup ¶

Since Build10 we support an Innosetup file, which can be used for compiling a Setup (like the official Widelands-Setup available on Innosetup can be downloaded from ¶

If you’ve installed InnoSetup, you just need to open [Widelands]/build/win32/Widelands.iss. You might change few settings or directly start packing/compiling the setup. ¶

** Note** ¶

Please check if all needed *.dll-files are in [Widelands]-directory during Setup packing/compile. Else your setup might be useless :-? ¶

# Building under Mac OS X ¶

You can find additional informations under BuildingWidelandsMac ¶

## General ¶

First you need the developer tools from the apple site and !MacPorts for unix-like tools: ¶

* Download and install tools: ¶
* [Xcode]( ¶
* [MacPort]( ¶

Now you'll need the following command (in to prepare and install everything needed: ¶

Login as root: ¶

* \$ login ¶

Install bazaar to download Widelands: ¶

* \# sudo port install bzr ¶

### Building under Darwin ¶
Widelands is build using the GCC under OS X 10.5 or higher ¶
Install libs: ¶

* \# sudo port install gettext libpng zlib jpeg libvorbis freetype libsdl_image cmake \ ¶
libsdl_gfx libsdl_mixer libsdl libsdl_net libsdl_sound libsdl_ttf boost lua glew ¶

*Note: The installation of the above is very timeconsuming!* ¶

* \$ cd ~/Public ¶
* \$ bzr get lp:widelands ¶
* \$ cd widelands ¶
* \$ ./ ¶

### Building under Xcode 3.2+ ¶
Widelands is build using Xcode 3.x under OSX, you therefore need OS X 10.5 or higher. ¶

Build Widelands with !MacPort libs: ¶

* cd ~/Public/widelands/build ¶
* cmake .. -G Xcode ¶

Build Widelands with precompiled libs, incomplete : ¶

* bzr branch lp:~wsk/widelands/OSX-libs ¶
* unzip ~/Public/ ¶

Put the unzipped files in the right place ¶

* export CMAKE_INCLUDE_PATH=~/Public/widelands/include ¶
* export CMAKE_LIBRARY_PATH=~/Public/widelands/lib ¶
* cd ~/Public/widelands/build ¶
* cmake .. -G Xcode ¶

Now you have the folder widelands.xcodeproj in the build directory which can open with Xcode to build. ¶

Help is available on the mailing list. ¶

## Known bugs ¶

* libsdl_image (at least 1.2.10) is broken under Mac OS X. ¶
To build it correctly, you need to add --disable-imageio to the configure flags, otherwise the terrain will be displayed wrongly inside of widelands. ¶
* Note: If using !MacPorts the fix above is obsolete.* ¶

* libsdl_image (1.2.11) on MacOSX 10.5.8 ¶
Image non-display and corruption issues (black splash screen, corruption of some other graphics such as checkboxes). ¶
* Specifically, SDL_image changeset 292 introduces the issue. ¶
* [MacPorts bug #37453]( ¶
* [SDL_image bug #1413]( fixed 1/1/2013 and in subsequent releases. ¶
* Reported seen with MacOSX 10.5.8 and MacPorts. Affects other SDL based games such as SDLInvaders. ¶
* Macports port maintainer reports that MacOSX 10.7.5/x86_64 is unaffected. ¶
* MacOSX 10.6.8 with port libsdl_image-1.2.12_3 is fine. ¶
* To resolve, check out the MacPorts tree prior to the libsdl_image-1.2.11 upgrade: [Syncing with SVN]( but sync revision r89082, not head, and use that to build the dependencies. ¶
* Alternatively, compile libsdl_image with `--disable-imageio`, or apply the patch attached to the SDL_image bug report. ¶