Latest Posts

Changes in Building Widelands

Old Title


Editor Comment

Add kind of console

Revision Differences of Revision 36

## Building widelands ¶

This page is about building widelands for various OSes. If you managed to build widelands under you 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] ¶

### Libraries ¶

Widelands depends currently 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 3, but it might work with other compilers too. ¶

* [libSDL]( >=1.2.11 ¶
* [libSDL_gfx]( ¶
* [libSDL_image]( ¶
* [libSDL_net]( ¶
* [libSDL_mixer]( >= 1.2.6 ¶
* [libSDL_ttf]( >= 2.0.0 ¶
* [gettext]( ¶
* libiconv (on same mirrors as gettext) ¶
* [zlib]( ¶
* [libpng]( ¶
* [Boost]( >= 1.35 ¶
* [Python]( >= 1.5.2 ¶
* [Scons]( >= 1.0.1 ¶
* [libexpat]( ¶
* [ggz-base-libs]( >= 0.99.5 ¶
* [lua]( >= 5.1 ¶

### Building with CMake (Experimental) ¶

Beginning with the WiHackTwentyTen meeting of Widelands developers, there have been ongoing efforts to move from the current SCons building system to CMake. It is still experimental and work-in-progress (so it is not ready for production), but you are very welcome to test, file bugs, comment or ask for features or assistance. More information you'll find at the WidelandsGoingCMake page. ¶

### Building under Linux (i386) with SCons ¶

This is actually the most simple of all cases: Get yourself all the libraries, make sure that sdl-config is in your searchpath and hit make in the unpacked widelands source dir. Everything should be ok, you can run the game directly from it's location. ¶

With the new build system (>build-9half), make sure you have Python installed and call scons from wideland's main directory. You can run the game directly from it's location. ¶

For further information, there is a page about UsingTheSconsBuildSystem. ¶

#### Build instructions for Ubuntu (all in terminal) ¶

Install all needed packages: ¶

1. __Install all needed packages:__ ¶
** sudo apt-get install build-essential python libsdl1.2-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-net1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev gettext libiconv-hook-dev zlib1g-dev libpng12-dev libpngwriter0-dev scons libstdc++6-4.3-dev libgcc1 exuberant-ctags optipng libboost-dev libexpat1 libexpat1-dev libggzmod-dev bzr lua5.1 liblua5.1-0 liblua5.1-dev ¶

2. __[Download](../DownloadPage) latest build:__ ¶
** bzr get lp:widelands ¶
(to update your local version change to "widelands" directory and execute "bzr pull") ¶

3. __Change directory:__ ¶
** cd widelands ¶

4. __scons:__ ¶
** scons build=release install_prefix=. bindir=. datadir=. localedir=locale ¶

5. __Run__ ¶
** ./widelands ¶

*Note: To match version requirements you may have to force the version of libboost-dev to 1.35 manually; Ubuntu Intrepid/Jaunty seems to default to 1.34 for libboost-dev. To force the version, install libboost1.35-dev instead of the generic libboost-dev.* If you use Ubuntu Karmic, then there should be no problems. ¶

*Tip: Though scons seems to detect number of cores automatically, you can fine tune your compile settings with -jN (for example, -j ¶
5) option for scons -- works the same way as with make.* ¶

*Tip 2: The scons build system remembers the parameters passed to it, so the next time you run scons, you do not need to provide the parameters again.* ¶

### Building under Windows ¶

To access SVN, I suggest [Tortoise SVN]( ¶

#### Building under !MinGW ¶

Please visit BuildingWidelandsUnderWindows ¶

#### Building under MSVC ¶

Visual Studio 2008 compatible branch is available in lp:~jarih/widelands/visual-studio. Getting all dependencies is pretty 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. ¶

* Install required packages: ¶
* [Visual C++ 2008 Express]( (VS2005 propably does not work) ¶
* [CMake]( 2.6.4 or later ¶
* [Python]( ¶
* [Boost]( libraries, build with cmake if binaries are not around ¶
* [Bazaar]( ¶
* Get source and 3rd party bundle ¶
* bzr checkout lp:~jarih/widelands/visual-studio widelands ¶
* bzr checkout lp:~jarih/+junk/widelands-3rdparty 3rdparty ¶
* Run cmake-gui, select out of source build ¶
* Configuring probably complains about boost include dir and some packages not found ¶
* set WL_3RDPARTY_DIR to point to 3rd party bundle directory ¶
* set boost_INCLUDE_DIR to your boost include directory (this is in advanced view) ¶
* build with vs2008 ¶
* copy dlls from 3rdparty/bin directory to debug/release directory ¶
* Running: set working dir to root source dir, or add commandline option to set datadir to root source dir. ¶

### Building under OSX ¶

First you need the developer tools from the apple site. Please download and install them first. ¶

#### Building under scons ¶
To build with scons take the MacPorts system from there site and install them. ¶

You'll need the following command (in to install everything needed: ¶

***Install libs:*** ¶

$\# sudo port install gettext libpng zlib jpeg libvorbis freetype libsdl_image \ ¶
libsdl_mixer libsdl libsdl_net libsdl_sound libsdl_ttf boost lua bzr ¶

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

***Install scons:*** ¶

$\# sudo port install scons svk ¶

***[Download](../DownloadPage) latest build:*** ¶

* $ bzr get lp:widelands ¶

***Change directory:*** ¶

* $ cd widelands ¶

***Build:*** ¶

* $ scons ¶

***Run*** ¶

* $ ./widelands ¶

To get the, you need to use Xcode. Type *scons -h* for the used vars and *scons -c* to clean. ¶

#### Building under Xcode 3.2 ¶
Widelands is now build using Xcode 2 and 3 under OSX, you therefore need OSX 10.4 or higher. You also need some third party libraries. ¶

Furthermore you need to install the libSDL for the following library: SDL_gfx. You can get them at []( The SDL-* Libs are available through searching in the [libraries section]( of this page. ¶

Please add the /opt/local/include /opt/local/include/SDL to the header search path and the /opt/local/lib to the library path. ¶

*Note: there is no SDL_gfx precompiled library for OSX, so you might need to build one (download and unpack sources, unpack XCode project under build/ directory, compile and copy created framework to the same location as other SDL libs).* ¶

*Also Note: The Xcode project file is not up to date so there are many changes needed to get a clean compile. At this point this issue is only recommended for people they know what they do!* ¶

Now opening the Xcode project in the /macos directory of the widelands SVN tree and compiling should make a working widelands version for your OSX Version and your hardware (Intel, PPC). This binary should also work on every other Mac with > OSX 10.4 and the same processor. But beware: *there is no Universal Binary at this point.* ¶

Good luck and by grace of God :D. If not, 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 obsolet.* ¶

Scons hangs on some points. You need to break by ctrl-c to continue. ¶