My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
BuildingOnLinux  
Instructions for building the development version of Hedgewars on Linux (debian focus)
Phase-Implementation, Phase-Deploy, Phase-Support
Updated Mar 13, 2014 by kyberneticist@gmail.com

Introduction

Copy and Paste instructions for a Hedgewars development build. Should work on Debian and the like (Ubuntu, Mint). Packages for other distros should have similar names. Remember to copy the entire apt-get lines! Important. This builds the latest development sources. If you want to build the latest stable, run: hg up 0.9.20 before running cmake. Also, see http://hedgewars.org/download.html if you are just looking to play latest stable - there's a good chance it exists for your distro.

Prerequisites

sudo apt-get install mercurial cmake qt4-qmake libqt4-dev libsdl1.2-dev libsdl-net1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev liblua5.1-dev fpc libphysfs-dev fonts-dejavu-core ttf-wqy-zenhei

If you want PNG screenshots, add:

sudo apt-get install libpng12-dev

If you want video recording, add:

sudo apt-get install libavcodec-dev libavformat-dev freeglut3-dev

If you want to try building the server as well (requires at least libghc base 4.3 now) try these too:

sudo apt-get install ghc libghc-binary-dev libghc-bytestring-show-dev libghc-dataenc-dev libghc-deepseq-dev libghc-hslogger-dev libghc-mtl-dev libghc-network-dev libghc-parsec3-dev libghc-utf8-string-dev libghc-vector-dev libghc-random-dev libghc-zlib-dev libghc-sha-dev libghc-entropy-dev

Building process

mkdir -p ~/games ~/hg/hedgewars/
cd ~/hg/hedgewars
hg clone -v https://hedgewars.googlecode.com/hg/ trunk

The initial clone of the repository will take a while, is about 628MiB or so, due to all the multimedia revisions. After that switch to the trunk folder:

cd trunk

If you want to build the latest release version (so that you can play with other people online) use this command:

hg update 0.9.20

Note. Do NOT run the command above if you want to play the latest development code (currently 0.9.21-dev).

Now let's configure and build!

cmake -DCMAKE_BUILD_TYPE="DEBUG" -DCMAKE_INSTALL_PREFIX="$HOME/games" -DDATA_INSTALL_DIR="$HOME/games" -DNOSERVER=1
make install

IMPORTANT: If you decided against png-screenshots or video-recording support, please append -DNOPNG=1 and/or -DNOVIDEOREC=1 to the cmake command line respectively!

if you want to build the server as well, change -DNOSERVER=1 to -DNOSERVER=0

then wait for the build to complete, then run ...

~/games/bin/hedgewars

You can also create a launcher for it on your desktop or on applications menu if you wish, using the ~/games/bin/hedgewars path

Build Updates

cd ~/hg/hedgewars/trunk
hg pull -u
cmake .
make install
Comment by RogelioO...@gmail.com, Sep 19, 2011

...didnt work...

Comment by piotrwy...@gmail.com, Sep 20, 2011

[kasia@kasiakomp hedgewars]$ cmake -DCMAKE_BUILD_TYPE="DEBUG" -DCMAKE_INSTALL_PREFIX="$HOME/games" -DDATA_INSTALL_DIR="$HOME/games" -DWITH_SERVER=0

-- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Check for working C compiler: /usr/lib/ccache/gcc -- Check for working C compiler: /usr/lib/ccache/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/lib/ccache/c++ -- Check for working CXX compiler: /usr/lib/ccache/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Building revision 5961-4e8bb227be9a -- Building Debug -- Looking for include files CMAKE_HAVE_PTHREAD_H -- Looking for include files CMAKE_HAVE_PTHREAD_H - found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE -- Freepascal version installed: 2.4 CMake Error at hedgewars/CMakeLists.txt:157 (add_dependencies):

add_dependencies Adding dependency to non-existent target: hwengine

-- Looking for Q_WS_X11 -- Looking for Q_WS_X11 - found -- Looking for Q_WS_WIN -- Looking for Q_WS_WIN - not found. -- Looking for Q_WS_QWS -- Looking for Q_WS_QWS - not found. -- Looking for Q_WS_MAC -- Looking for Q_WS_MAC - not found. -- Found Qt-Version 4.7.3 (using /usr/bin/qmake-qt4) -- Looking for /usr/lib/libQtCore.so in optimized CMake Error at CMakeLists.txt:11 (TARGET_LINK_LIBRARIES):

The "optimized" argument must be followed by a library.

CMake Error: Internal CMake error, TryCompile? configure of cmake failed -- Configuring incomplete, errors occurred!

What should I do ?

Comment by piotrwy...@gmail.com, Sep 20, 2011

Trying one more time and then:

-- Building revision 5961-4e8bb227be9a -- Building Debug -- Freepascal version installed: 2.4 CMake Error at hedgewars/CMakeLists.txt:157 (add_dependencies):

add_dependencies Adding dependency to non-existent target: hwengine

CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: SDLMIXER_INCLUDE_DIR

used as include directory in directory /home/kasia/hg/hedgewars/hedgewars/QTfrontend
SDLMIXER_LIBRARY
linked by target "hedgewars" in directory /home/kasia/hg/hedgewars/hedgewars/QTfrontend

-- Configuring incomplete, errors occurred!

Comment by tim4...@gmail.com, Sep 25, 2011

The "optimized" argument must be followed by a library.

Try:

$ cat hedgewars-compiler-opts.patch 
--- CMakeLists.txt.orig 2011-09-17 21:42:56.000000000 +0300
+++ CMakeLists.txt      2011-09-25 08:47:19.000000000 +0300
@@ -147,9 +147,12 @@
 
 
 #set default flags values for all the project
-set(CMAKE_C_FLAGS "-pipe ${CMAKE_C_FLAGS}")
-set(CMAKE_C_FLAGS_RELEASE "-w -O2 -fomit-frame-pointer ${CMAKE_C_FLAGS_RELEASE}")
-set(CMAKE_C_FLAGS_DEBUG "-Wall -O0 -g -DDEBUG ${CMAKE_C_FLAGS_DEBUG}")
+# set(CMAKE_C_FLAGS "-pipe ${CMAKE_C_FLAGS}")
+# set(CMAKE_C_FLAGS_RELEASE "-w -O2 -fomit-frame-pointer ${CMAKE_C_FLAGS_RELEASE}")
+# set(CMAKE_C_FLAGS_DEBUG "-Wall -O0 -g -DDEBUG ${CMAKE_C_FLAGS_DEBUG}")
+set(CMAKE_C_FLAGS ${CFLAGS})
+set(CMAKE_C_FLAGS_RELEASE ${CFLAGS})
+set(CMAKE_C_FLAGS_DEBUG ${CFLAGS})
 set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
 set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
 set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
@@ -159,11 +162,14 @@
 if(Optz)
 #      set(pascal_compiler_flags_cmn "-O3" "-OpPENTIUM4" "-CfSSE3" "-Xs" "-Si" ${pascal_compiler_flags_cmn})
        set(pascal_compiler_flags_cmn "-O2" "-Xs" "-Si" ${pascal_compiler_flags_cmn})
-       set(haskell_compiler_flags_cmn "-O2" "-w" "-fno-warn-unused-do-bind")
+    #  set(haskell_compiler_flags_cmn "-O2" "-w" "-fno-warn-unused-do-bind")
+       set(haskell_compiler_flags_cmn ${CFLAGS} "-dynamic")
 else(Optz)
 #      set(pascal_compiler_flags_cmn "-O-" "-g" "-gh" "-gl" "-dDEBUGFILE" ${pascal_compiler_flags_cmn})
-       set(pascal_compiler_flags_cmn "-O-" "-g" "-gl" "-dDEBUGFILE" ${pascal_compiler_flags_cmn})
-       set(haskell_compiler_flags_cmn "-Wall" "-debug" "-dcore-lint" "-fno-warn-unused-do-bind")
+#      set(pascal_compiler_flags_cmn "-O-" "-g" "-gl" "-dDEBUGFILE" ${pascal_compiler_flags_cmn})
+#      set(haskell_compiler_flags_cmn "-Wall" "-debug" "-dcore-lint" "-fno-warn-unused-do-bind")
+       set(pascal_compiler_flags_cmn "-O2" "-Xs" "-Si" ${pascal_compiler_flags_cmn})
+       set(haskell_compiler_flags_cmn ${CFLAGS} "-dynamic")
 endif(Optz)
 
 
@@ -220,7 +226,8 @@
        set(CPACK_GENERATOR "ZIP;NSIS")
        set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "hedgewars")
 else(WIN32 AND NOT UNIX)
-       set(CPACK_STRIP_FILES "bin/hedgewars;bin/hwengine")
+#      set(CPACK_STRIP_FILES "bin/hedgewars;bin/hwengine")
+       set(CPACK_STRIP_FILES "")
 endif(WIN32 AND NOT UNIX)
 
 set(CPACK_SOURCE_IGNORE_FILES
Comment by rockac...@gmail.com, Nov 1, 2011

omg prev comment format screwed

works for me, use (cmake . -DWITH_SERVER=1) for server instead of (cmake)

install libraries as above...

hg clone (code repo) hedgewars
cd hedgewars
cmake .
make
(sudo make install) -- optional
Comment by inkada...@gmail.com, Nov 21, 2011

xxxxxxxxxxxxxxx:~/hg/hedgewars/trunk$ make install 0% Built target ENGINECLEAN 0% Generating ../bin/hwengine Free Pascal Compiler version 2.4.4-2ubuntu1 [2011/09/27] for x86_64 Copyright (c) 1993-2010 by Florian Klaempfl Target OS: Linux for x86-64 Compiling /home/kraffen/hg/hedgewars/trunk/hedgewars/hwengine.pas Compiling SDLh.pas Compiling uVariables.pas Compiling uTypes.pas Compiling uFloat.pas Compiling uSinTable.pas Compiling uConsts.pas Compiling uMobile.pas Compiling uVariables.pas Compiling uMisc.pas Compiling uUtils.pas Compiling uConsole.pas Compiling uGame.pas Compiling uKeys.pas Compiling uCommands.pas Compiling uDebug.pas Compiling uTeams.pas Compiling uGears.pas Compiling uStore.pas Compiling uLandTexture.pas Compiling uTextures.pas Compiling uRender.pas Compiling uRenderUtils.pas Compiling uSound.pas Compiling uTeams.pas Compiling uRandom.pas Compiling uStats.pas Compiling uLocale.pas Compiling uIO.pas Compiling uCaptions.pas Compiling uVisualGears.pas Compiling uWorld.pas Compiling uAmmos.pas Compiling uVisualGears.pas Compiling uChat.pas Compiling uCursor.pas Compiling uCollisions.pas Compiling uLandGraphics.pas Compiling uScript.pas Compiling LuaPas?.pas Compiling uAIMisc.pas Compiling uAI.pas Compiling uAIAmmoTests.pas Compiling uAIActions.pas Compiling uGearsRender.pas Compiling uLand.pas Compiling uLandTemplates.pas Compiling uLandObjects.pas Compiling adler32.pas Compiling uLandPainted.pas Compiling uCommandHandlers.pas hwengine.pas(164,68) Warning: range check error while evaluating constants Linking ../bin/hwengine /usr/bin/ld: warning: ../bin/link.res contains output sections; did you forget -T? 39746 lines compiled, 4.9 sec 1 warning(s) issued 0% Built target hwengine 5% Built target quazip make2?: Nessuna regola per generare l'obiettivo "/usr/lib/libQtGui.so", necessario per "bin/hedgewars". Arresto. make1?: [QTfrontend/CMakeFiles/hedgewars.dir/all] Errore 2

Comment by inkada...@gmail.com, Nov 21, 2011

sorry but no way to install it.... i've tried all written above... ERROR 2 always there

Comment by rockac...@gmail.com, Jan 20, 2012

That means you didn't install all the dependencies or you didnt' run the commands right.

Try:

cmake . make sudo make install

Comment by vcata...@hotmail.com.br, Nov 3, 2012

Funcionou perfeitamente!!!

It worked perfectly here!!!

Comment by spn...@gmail.com, Nov 11, 2012

?

Comment by rul...@gmail.com, Jan 8, 2013

Crap, again this "make install". Don't you know that it is WRONG to "make install" on a package distributions? Can you provide an instruction how to build a deb-package of this game?

Comment by allenchi...@gmail.com, Feb 15, 2013

How can I get the 0.9.18 version rather than the 0.9.19 one??

Comment by rodrigoa...@gmail.com, Feb 17, 2013

Allenchi

hg checkout 0.9.18-release

Comment by doom...@gmail.com, Mar 11, 2013

Every thing works fine until I get to the "make install" command,when I try using it I get this error: make: No rule to make target `install'. Stop.

Comment by NSy...@gmail.com, Mar 25, 2013

Had a problem with LIB_GLUT. <tangentstorm> solved that in this way.

$ sudo apt-get install freeglut3-dbg freeglut3-dev
Comment by julijan....@gmail.com, May 31, 2013

Compiles fine and starts the game, but when I press the "start" button in lobby a black screen appears for a brief moment and crashes, I get the following error in console:

X Error of failed request: BadValue? (integer parameter out of range for operation)

Major opcode of failed request: 130 (XFree86-VidModeExtension?) Minor opcode of failed request: 10 (XF86VidModeSwitchToMode) Value in failed request: 0xb2 Serial number of failed request: 147 Current serial number in output stream: 149

Comment by perezom...@gmail.com, Jun 20, 2013

- Found Qt4: /usr/bin/qmake (found suitable version "4.8.2", required is "4.5.0") -- Configuring incomplete, errors occurred! It seems to require an older version of qmake I don't want to downgrade is there a way to bypass this

Comment by project member kyberneticist@gmail.com, Jun 20, 2013

perez, you're misreading that. - Found Qt4: /usr/bin/qmake (found suitable version "4.8.2", required is "4.5.0") Says found SUITABLE version. That is, 4.5+ is needed and you have 4.8.2 Your config error is prob due to something higher. Some other missing dependency. Perhaps partial video recording deps? Maybe you included server but not server deps?

BTW, if you're building this for debian/ubuntu, we do have 0.9.19 builds in PPA and PlayDeb?. Feel free to drop by Live Chat (See website) for any further questions.

Comment by mcox...@gmail.com, Jul 7, 2013

I get the following errors (looks like a file is missing the definition of quint) when running make.

hedgewars/QTfrontend/ui/widget/feedbackdialog.cpp: In member function ‘void FeedbackDialog?::GenerateSpecs?()’: hedgewars/QTfrontend/ui/widget/feedbackdialog.cpp:276:11: error: expected initializer before ‘page_size’ hedgewars/QTfrontend/ui/widget/feedbackdialog.cpp:277:5: error: ‘quint’ was not declared in this scope hedgewars/QTfrontend/ui/widget/feedbackdialog.cpp:277:11: error: expected ‘;’ before ‘total’ hedgewars/QTfrontend/ui/widget/feedbackdialog.cpp:278:34: error: ‘total’ was not declared in this scope hedgewars/QTfrontend/ui/widget/feedbackdialog.cpp:269:10: warning: unused variable ‘pages’ [-Wunused-variable] make2?: [QTfrontend/CMakeFiles/hedgewars.dir/ui/widget/feedbackdialog.cpp.o] Error 1 make1?: [QTfrontend/CMakeFiles/hedgewars.dir/all] Error 2 make: all? Error 2

I used cmake with the following args: cmake -DCMAKE_BUILD_TYPE="DEBUG" -DCMAKE_INSTALL_PREFIX="$HOME/games" -DDATA_INSTALL_DIR="$HOME/games" -DNOSERVER=1

Any suggestions? Thanks! :)

Comment by project member vittorio...@gmail.com, Jul 7, 2013

just pushed a fix for that, I always forget the size of qtypes :)

Comment by mcox...@gmail.com, Jul 8, 2013

Thanks for the speedy reply & fix! It's all working fine now :D

Comment by kanl...@gmail.com, Jul 23, 2013

had a lot of trouble building for debian wheezy, but i build .9.19.3 with

cmake -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake -DNOVIDEOREC=1 -DNOSERVER=1

for some reason make install didn't work. anyhow now playing on my 2006 pc at 15-20 FPS

Comment by project member kyberneticist@gmail.com, Jul 24, 2013

kanliot, that sort of speed implies lack of hardware gl acceleration. Check your graphics drivers. You can try sliding "reduce quality" all the way to the left, but it is only likely to gain you maybe 10fps would be my guess.

Comment by EmberLe...@gmail.com, Aug 27, 2013

Any fix for the following errors: code?(1002) Target OS: Linux for i386 (3104) Compiling hwengine.pas (3104) Compiling SDLh.pas SDLh.pas(1207,1) Error: (9003) Can't create object file: /home/developer/hg/hedgewars/trunk/hedgewars/SDLh.o SDLh.pas(1207,1) Fatal: Can't create object /home/developer/hg/hedgewars/trunk/hedgewars/SDLh.o Fatal: (1018) Compilation aborted Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled) make2?: [bin/hwengine] Error 1 make1?: [hedgewars/CMakeFiles/hwengine.dir/all] Error 2 make: all? Error 2 [/code]

Comment by EmberLe...@gmail.com, Aug 27, 2013

ok ran: <<< sudo apt-get install freeglut3-dbg freeglut3-dev sudo apt-get install liblua5.1 >>> got a message that says did you forget -T <<< I ran sudo cmake --trace -DCMAKE_BUILD_TYPE="DEBUG" -DCMAKE_INSTALL_PREFIX="$HOME/games" -DDATA_INSTALL_DIR="$HOME/games" -DNOSERVER=1 sudo make -t sudo make install>>>

This gets it and puts it in the games/bin directory but when I try to run hedgewars it says the game is not currently installed. And says to sudo apt-get install

Comment by EmberLe...@gmail.com, Aug 27, 2013

ok so the touch parameter didn't actually build the files I guess. When I build for server I get the same error as mcox... what was the fix size of qtypes...?? above

Comment by project member vittorio...@gmail.com, Aug 27, 2013

Please don't use the comments sections a forum, open an issue or even better visit us on IRC if you are facing problems.

Comment by ericramo...@gmail.com, Jan 31, 2014

Thank you so much! I got it working on Linux Mint 16 (Petra) with this process.


Sign in to add a comment
Powered by Google Project Hosting