Difference between revisions of "Compile"

From FreeOrionWiki
Jump to: navigation, search
m (Compiling in Linux: Warning not necessary anymore)
(Remove most content; just link to github build instructions)
 
(348 intermediate revisions by 44 users not shown)
Line 1: Line 1:
[[FreeOrion]] can currently be compiled under [[Windows]] and [[Linux]]. Support for Mac OS X is underway, *BSD might also work, follow the Linux instructions in this case. (And drop us a note if you managed to build it)
+
Currently, [[FreeOrion]] will compile in most recent Windows, Linux, and MacOSX. The *BSD genus of operating systems might also work; follow the Linux instructions in this case.
  
==Overview==
+
Consult the [https://github.com/freeorion/freeorion/blob/master/BUILD.md build instructions] in the project git repository.
First of all, you will need to obtain the [[source]].  This can be grabbed from our [[project page]] or from [[CVS]].  The version available on the [[project page]] usually corresponds to an official release, and so may be very out of date.  If you are interested in helping [[programming|program]] [[FreeOrion]] then you will need to grab the [[CVS]] copy.  Then you need to set up the required software, compile the game, download the missing artwork, and run it.
+
 
+
==Hardware requirements==
+
The FreeOrion code makes heavy use of templates, and requires much memory to compile. If you have less than 256 MB of RAM plus at least the same amount of swap, you probably will run into trouble. You will also need a fast processor, expect 20-40 minutes for a first-time build on a 1.3GHz processor. (Note: some work is done on reducing both compilation time and memory requirements)
+
 
+
==Software requirements==
+
To compile the latest version of [[FreeOrion]] you will need [[GiGi]].  Here are the version numbers for software dependencies:
+
* [[GiGi]] - '''latest from [[CVS]]'''
+
* [http://www.scons.org/ SCONS] - required to build GG (linux only; Windows can use MSVC solution file)
+
* [http://www.python.org/ Python] - required to install SCONS and Boost (linux only)
+
* [http://www.freetype.org FreeType2] - a GiGi dependency
+
* [http://www.boost.org/ Boost] - version 1.32.0 (earlier and later version not supported yet)
+
* [http://log4cpp.sourceforge.net/ log4cpp]
+
* [http://openil.sourceforge.net/ DevIL]
+
* [http://www.libsdl.org SDL]
+
* [http://www.fmod.org/ FMOD 3.4 (not FMOD EX 4.0)] - free, but not free software
+
* [http://www.graphviz.org/ GraphViz] - version 2.0 (1.16 does not work)
+
 
+
==Getting the source==
+
 
+
===CVS===
+
[[CVS]] can be obtained in Linux using these commands:
+
 
+
''cvs -d:pserver:[email protected]:/cvsroot/freeorion login'' (if it asks for password, just hit enter)
+
 
+
''cvs -z3 -d:pserver:[email protected]:/cvsroot/freeorion co FreeOrion''
+
 
+
'''Note:''' Sometimes, the SourceForge CVS-server is under heavy load. If the commands above fail with 'EOF from server', just wait a few minutes and try again.
+
 
+
===Package===
+
You can also download an older version of the software in a package from the [[project page]].  Remember that if you want to help develop, you '''will''' need to obtain a copy from [[CVS]].
+
 
+
==Compiling in Linux==
+
Notes to some of the required libraries
+
 
+
*log4cpp 0.2.7
+
When compiling log4cpp probably get some errors on "make". Change "long long" to "long" in first file you get an error and in the second file add a "using namespace std;" after the includes.
+
 
+
*graphviz 2.0
+
Install it in /usr/local/ or fix the library include dirs in the Makefile as they are not checked by now (possibly somebody should fix this)
+
 
+
*boost 1.32.0
+
You should set PYTHON_ROOT and PYTHON_VERSION before compiling
+
 
+
*fmod
+
Copy the includes to a path where your compiler looks for them e.g. "/usr/include" or "/usr/local/include"
+
Copy the lib to a path where your runtime linker will find it e.g. "/usr/lib" or "/usr/local/lib"
+
 
+
 
+
Once you have the required software, in particular [[GiGi]], installed, you need to compile FreeOrion.  You have two options.  The first is to run these commands:
+
 
+
# ./autogen.sh, if you dont have the newsest autotools-suite (<autoconf 2.59, <automake 1.7) ./update-configure.sh
+
# ./configure
+
# make
+
'''DO NOT''' ''make install'' it is neither needed nor supported at this time. You will have to run ./freeorion from FreeOrion's root-directory.
+
 
+
You now will have to [[http://freeorion.sf.net/data.zip download]] the artwork file and decompress it before running freeorion!
+
 
+
 
+
After these steps, the files freeorion, freeoriond and freeorionca should each be created in the root directory.  Run ./freeorion to play the game.
+
If you have trouble with the game appearing to deadlock at places, see the FAQ below.
+
 
+
User's Stories: [[User:Solrac776/Gentoo]] (Out of Date) [[User:mvor/Ubuntu]]
+
 
+
As of right now cvs using update-configure.sh does not compile due to references in the Makefile to the nonexistent universe/ProdCenter.*  I hope a developer will rectify this soon and remove my note here.
+
Using autogen.sh works now.
+
 
+
'''DO NOT FORGET TO DOWNLOAD THE ACTUAL GRAPHICS DATA FILE!!'''
+
 
+
==Windows specific==
+
===Software requirements===
+
To compile the latest version of [[FreeOrion]] you will need the MSVC compiler (you can use the [http://msdn.microsoft.com/visualc/vctoolkit2003/ free] one), and the [[GiGi]] GUI library.  Here are the version numbers for software dependencies:
+
 
+
Those can be found in precompiled format:
+
* [http://www.gzip.org/zlib/ zlib] - you can use zlib compiled DLL, version 1.2.1
+
* [http://openil.sourceforge.net/ DevIL] - you can use DevIL 1.6.5 Windows SDK
+
* [http://www.libsdl.org SDL] - there is a Development Library for Win32. I haven't tried them though
+
* [http://freeorion.sourceforge.net/graphviz-devel.zip GraphViz] - Zach has prebuilt this so you don't have to, and the original sources are included
+
 
+
Those must be compiled from the source:
+
* [http://www.boost.org/ Boost] - version 1.32 or later.
+
* [http://log4cpp.sourceforge.net/ log4cpp] - 0.3.4b. Later versions may work.
+
* [http://www.freetype.org/ FreeType] - 2.1.7. Later versions may work.
+
* [[GiGi]] - latest from [[CVS]]
+
 
+
Boost is built from the command line with a custom jam util you get from the [https://sourceforge.net/projects/boost/ sourceforge project page].
+
 
+
log4cpp, is built from the Visual C++ IDE. Don't mind the test projects.
+
 
+
GiGi has a couple of dependencies (FreeType, SDL, boost, log4cpp and DevIL) so get them before attempting to compiled GiGi. The debug targets are not completely configured, but you only need the release target for FreeOrion.
+
 
+
===Getting the source from CVS===
+
 
+
A Windows port of [[CVS]] is available. The commands are the same on Linux and Windows. You can also use other CVS tools such as [http://www.tortoisecvs.org/ TortoiseCVS] for checking out. Mind that they may not be suited for committal because they are said to be prone to converting new line characters. Try [http://www.wincvs.org/ WinCvs 1.2] if you plan joining the developer team. This tool has no problem with converting new line characters.
+
 
+
==Compiling in Windows==
+
 
+
Once you have the required software, in particular [[GiGi]], installed, you need to compile FreeOrion.
+
 
+
===Compiling with MSVC IDE===
+
 
+
These instruction use the Visual C++ IDE.
+
 
+
# Open msvc\FreeOrion\FreeOrion.sln
+
# You need to configure the Additional Include Directories (in Project->Properties->C/C++->General) and Additional Library Directories (in Project->Properties->Linker->General) to point to where you installed the required software for all the targets you want to build.
+
# As the configuration assumes the GG's CVS root is in the CVS root of FreeOrion, it may be a good idea to put it there.
+
# use Build->Batch build... to build the three projects' release targets. I didn't get the debug targets to compile.
+
 
+
If you didn't change the Output File (or the $(OutDir) variable), the files will be created in their respective project and target directories. Move them to the root directory and provide the required DLLs (copy them, move them or put them in your path environnement variable).
+
Run freeorion.exe to play the game.
+
 
+
'''New'''<br>
+
Additional Include Directories are now handled locally. That means, everyone who wants to compile FreeOrion has to define the directory lists at Tools->Options->Projects->VC++ Directories. The main advantage: Everyone can stick with his/her own directory tree without having to change the project's directory paths. The only exception is GG which is assumed to be found at the same level as FreeOrion (relative paths!).<br>
+
<br>
+
'''Additional Include Directories: (by example)'''
+
#C:\Projects\GG\include
+
#C:\projects\log4cpp-0.3.4b\include
+
#C:\projects\freetype-2.1.7\include
+
#C:\projects\DevIL\include
+
#C:\Projects\boost-1_32
+
#C:\projects\SDL_mixer-1.2.5\include
+
#C:\projects\SDL-1.2.7\include
+
#C:\projects\zlib\include
+
#C:\projects\fmodapi374win\api\inc
+
#C:\projects\graphviz\include
+
 
+
'''Additional Library Directories: (by example)'''
+
#C:\Projects\boost-1_32\libs
+
#C:\projects\log4cpp-0.3.4b\msvc6\log4cppDLL\Release
+
#C:\projects\freetype-2.1.7\objs
+
#C:\projects\DevIL\lib
+
#C:\projects\zlib\lib
+
#C:\Projects\SDL-1.2.7\VisualC7\SDLmain\Release
+
#C:\projects\SDL_mixer-1.2.5\lib
+
#C:\projects\fmodapi374win\api\lib
+
#C:\projects\graphviz\lib
+
 
+
===Compiling with SCons===
+
 
+
There is now an alternative build system for windows, based on SCons.  Using SCons means that you only build the objects files once (with a couple of exceptions), instead of once for each executable (like it is done on Linux).  This reduces complete rebuild times to a third of what they are using the Visual C++ IDE.  It also works completely from the command line, which should make it easier to use with the free MS C++ compiler. 
+
 
+
To use SCons, you need to download and install SCons, which in turn requires Python.  Go to the SCons website for details ( http://www.scons.org ).  Make sure that SCons is in your path, and from a command-line prompt in the root of your FreeOrion source tree, just run "scons".  You won't have to move the executables as you would using the IDE-build.
+
 
+
==Obtaining Artwork==
+
Some artwork may be missing from the game when you [[download]] it.  You can obtain these images from:
+
[http://freeorion.sf.net/data.zip http://freeorion.sf.net/data.zip]
+
You can also obtain an MD5 sum by doing this with the appropriate file extension:
+
[http://freeorion.sf.net/data.zip.md5 http://freeorion.sf.net/data.zip.md5], etc.
+
Note that this MD5 sum is not for security; it is supposed to let you know when the data in the zip file has changed.
+
 
+
If you have an existing default/config.xml file, you may need to remove the data-dir entry.  Place the data folder from the file above into default/
+
 
+
==Troubles and Questions==
+
 
+
'''Q.  I get an undefined reference to `_vsnprintf' '''
+
 
+
'''A. '''
+
This is a bug in the latest version of Devil. GiGi's configure script should've taken care of it. If it didn't, contact [http://www.freeorion.org/forum/privmsg.php?mode=post&u=30 Yoghurt]. In the meantime, you can fix the error yourself:
+
Check the il_tiff.c file and add this line at the top:
+
+
#define _vsnprintf vsnprintf
+
 
+
and then recompile [http://www.freeorion.org/forum/viewtopic.php?t=406&highlight=vsnprintf]
+
 
+
'''Q.  The game seems to freeze at certain places'''
+
 
+
'''A. '''
+
This bug should be fixed now. If you still experience freezes/crashes and are using the autotools (configure & make) system, please contact [[User:Yoghurt|Yoghurt]].
+
In the meantime, you can try to build [[FreeOrion]] with optimizations turned on:
+
* make clean && make CXXFLAGS="-O3 -funroll-loops"
+
 
+
'''Q. The game crashes when I click on a star'''
+
 
+
'''A. '''
+
The reason is missing artwork, see above. You can tell FreeOrion to not use animated Planets, just delete the file <FreeOrion Home Directory>/default/art/small/planets/planets.xml
+
 
+
'''Q. I get an error saying: "Video mode set failed: Couldn't find matching GLX visual"'''
+
 
+
'''A. '''
+
Your video mode is probably set to 16 bit instead of 32, which is what [[FreeOrion]] defaults to.  You need to either change your X color depth, or edit the [[FreeOrion]] config file in default/config.xml.  Change color-depth from 32 to 16.
+
Since this file isn't included in a fresh download anymore, rather start with a --color-depth 16 command line argument.
+

Latest revision as of 14:39, 22 April 2020

Currently, FreeOrion will compile in most recent Windows, Linux, and MacOSX. The *BSD genus of operating systems might also work; follow the Linux instructions in this case.

Consult the build instructions in the project git repository.