My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
BuildingOnLinux  
Instructions for building Hedgewars on Linux (debian focus)
Phase-Implementation, Phase-Deploy, Phase-Support
Updated Nov 26, 2011 by unC0Rr

Introduction

Please see the original post here: http://www.hedgewars.org/node/2215#comment-15049

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

note, if you want to try building the server as well (requires at least libghc base 4.3 right 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

Building process

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

The initial clone of the repository will take a while, is about 550MiB or so...

cd ~/hg/hedgewars/trunk
cmake -DCMAKE_BUILD_TYPE="DEBUG" -DCMAKE_INSTALL_PREFIX="$HOME/games" -DDATA_INSTALL_DIR="$HOME/games" -DWITH_SERVER=0
make install

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

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 -DCMAKE_CXX_FLAGS="-g" -DCMAKE_INSTALL_PREFIX="$HOME/games" -DDATA_INSTALL_DIR="$HOME/games" -DWITH_SERVER=0
make install
Comment by cvl...@hotmail.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


Sign in to add a comment
Powered by Google Project Hosting