Latest Posts

Changes in Building Widelands

Old Title

BuildingWidelands


Editor Comment

CMake paragraph updated, removed everything not necessary for now, so the warnings are more visible and everything is consistent on one page.


Revision Differences of Revision 28

## 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](http://www.libsdl.org/) >=1.2.11 ¶
* [libSDL_gfx](http://www.ferzkopp.net/joomla/content/view/19/14/) ¶
* [libSDL_image](http://www.libsdl.org/projects/SDL_image) ¶
* [libSDL_net](http://www.libsdl.org/projects/SDL_net) ¶
* [libSDL_mixer](http://www.libsdl.org/projects/SDL_mixer) >= 1.2.6 ¶
* [libSDL_ttf](http://www.libsdl.org/projects/SDL_ttf) >= 2.0.0 ¶
* [gettext](http://www.gnu.org/software/gettext/gettext.html) ¶
* libiconv (on same mirrors as gettext) ¶
* [zlib](http://www.zlib.net/) ¶
* [libpng](http://www.libpng.org/pub/png/libpng.html) ¶
* [Boost](http://www.boost.org/) >= 1.35 ¶
* [Python](http://www.python.org) >= 1.5.2 ¶
* [Scons](http://www.scons.org) >= 1.0.1 ¶
* [libexpat](http://www.libexpat.org/) ¶
* [ggz-base-libs](http://www.ggzcommunity.org) >= 0.99.5 ¶
* [lua](http://www.lua.org) >= 5.1 (NOTE: older versions may work) ¶


### Building with CMake

__NOTE__:
Needs u(Expdatering: cmake merged into thal) ¶

B
e magin branch and all is ong launchpad now. ¶

Dur
ingth the WiHackTwentyTen meeting of Widelands developers, exptherimental support for using CMhakve to build widelands was added to the cmake-migration subversion branch: ¶

* svn c
go https://widelands.svn.sourcg efforge.net/svnroo t/widelands/branches/cmake-migration widelands-cmake ¶

__NOTE__: The cmake script (widelands-cmake) sh
ould bve run from a sub-directory of the checkout dirrecnt SCory (e.g.ns build-widelands),g nosyst them checkout directory itself. ¶

In
CMan kemail to. Ithe widelands-public mailing list, !SirVer called for testxpers to try out the cimake supporntal and repwort back to the w-idelands-public mailinrog lirests (especiallyo if there are any issues). ¶

To
generaote thre builad filesy for youpr system: ¶

* mk
odir build-wctidelaonds ¶
* cd
), build-widelands ¶
*
t you cmakre ../very widelands-comake [ -G <generator namtest, if you dare> ] ¶

On un
ix-like platforms (linux, bugsd, copmmenst olaris, ...), you can thensk forun: ¶

*
mfeake ¶

No
te: Building Widrelands usingor CMake is still "experimenstal" andce. "wMork in progress". Details onf the tormansition phase are tyo beu'll fouind 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 ¶

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](http://www.tortoiseSVN.org). ¶




#### Building under !MinGW ¶

Please visit BuildingWidelandsUnderWindows ¶




#### Building under MSVC ¶

As far as we know, no one has tried this since build 4, so if anyone is brave enough, go for it and post your information here. ¶







### Building under !MacOS X ¶

Widelands is now build using XCode 2 under !MacOs X, you therefore need Mac OS 10.4. You also need some third party libraries, our XCode Project expects them under /opt/local, so the easiest way to install them is using !MacPorts (formerly !DarwinPorts). You'll need the following command (in Terminal.app) to install everything needed: ¶

$ sudo port install gettext libpng zlib jpeg libvorbis freetype ¶

Furthermore you need to install the libSDL Frameworks for the following librariers: SDL, SDL_Image, SDL_Net, SDL_Mixer, SDL_TTF, SDL_gfx. You can get them all at [www.libsdl.org](http://www.libsdl.org). The SDL-* Libs are available through searching in the [libraries section](http://www.libsdl.org/libraries.php?&os=5&match_name=SDL_) of this page. ¶

To Install them create the Directory /Library/Frameworks/!ManuallyInstalled and copy all the *.frameworks directories from the SDL DMG-Images into this new Directory. The Directory name is mandatory (our XCode Project searches there), it is choosen because the Macports libsdl*-framework are not statically linked and are therefore no use for us, but we do not want to interfere with them, since some Ports from Macports depend on them. So we create our own Directory for the manually installed SDL Libs and stay out of the way. ¶
_Note:_there is no SDL_gfx precompiled library for Mac OS X, 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). ¶

Now opening the XCode Project in the macos directory of the widelands SVN Tree and compiling should make a working widelands version for your OS X Version and your Hardware (Intel, PPC). This binary should also work on every other Mac with > OS X 10.4 and the same Processor. But beware: there is no universal binary at this point. ¶

Good luck. Help is available on the mailing list. ¶

#### Update (Jan 2010) ¶

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. Upstream is informed, we expect this bug to be fixed any day now. ¶