5 This file describes how to compile and install Freeciv. Last time we
6 made sure this file is up to date was 16-Jul-06.
7 Last minor update was 06-Jun-14.
9 There may be a localized version of this file in the ./doc directory,
10 named INSTALL.<locale> (e.g., INSTALL.de).
12 This document contains sections and subsections as follows:
14 1. Prerequisites for the clients:
15 1a. Prerequisites for the Gtk2 client:
16 1b. Prerequisites for the Gtk3 client:
17 1c. Prerequisites for the SDL client:
18 1d. Prerequisites for the Xaw client:
19 1e. Prerequisites for the Qt client:
20 2. Generating Makefiles
21 2a. Generating the Makefile for svn versions:
22 2b. Generating the Makefile for release versions:
25 5. Native Language Support:
27 7. Reinier's Solaris Installation Notes:
28 8. Reinier's libXpm Solaris Installation Notes:
29 9. Mac OS X and Darwin notes:
30 10. Debian GNU/Linux notes:
37 Freeciv has a number of prerequisites. Note, that apart from the first
38 prerequisite, the Freeciv configuration process is smart enough to work
39 out whether your system is suitable. If in doubt, just try it.
43 The Unix operating system, a work-alike such as Linux or FreeBSD,
44 or some OS that provides a very Unix-like personality or mode, like
45 EMX under OS/2 or the Cygnus Cygwin toolkit under Windows.
46 (See http://sourceware.cygnus.com/cygwin/). Support for
47 BSD-style TCP/IP sockets is essential, as is a Bourne-shell
48 compatible shell, such as GNU "bash". (Most Unixes fit the bill...)
52 Freeciv is written in very portable (almost) ANSI C. Both 32- and 64-
53 bit machines are supported. You cannot use a "K&R C" compiler, or
56 Development of Freeciv is primarily done with "gcc", the GNU
57 project's excellent C compiler. Releases can be compiled with gcc
58 or most other compilers (such as the unbundled Solaris C compiler).
59 Note that there have been reports that gcc with -O3 miscompiled
64 Freeciv developers generally use "gmake", the GNU make program.
66 Officially released versions of Freeciv are designed to have
67 makefiles which work with most make programs.
69 You can check if you have GNU make installed on your system by
72 % make -v [and if this doesn't work, try "gmake -v"]
74 The output should include "GNU Make" somewhere.
76 The svn version has additional requirements. A release version
77 contains the generated files.
79 - The programs from GNU gettext version 0.10.36 or better
81 Especial the xgettext program is required to create the *.gmo
82 files which aren't included in the svn tree.
84 - GNU autoconf version 2.61 or better
86 Autoconf is required to create configure from configure.ac.
88 - GNU automake version 1.9 or better
90 Automake is required to create the various Makefile.in from
93 1. Prerequisites for the clients:
94 =================================
96 The Freeciv client comes in the following forms:
97 * Gtk+ 2.0 widget library ("Gtk+ 2.0").
98 * Gtk+ 3.0 widget library ("Gtk+ 3.0").
99 * X Athena Widgets library ("Xaw").
103 These forms have different prerequisites, explained separately below.
105 Your system will need to satisfy at least one of these sets of prerequisites.
107 Note that most Linux systems have separate library packages for "runtime"
108 library support and for development support (for compiling programs
109 which use those libraries). To compile Freeciv on such systems you
110 will need to have the appropriate "development" packages installed.
113 1a. Prerequisites for the Gtk+ 2.0 client:
114 ==========================================
118 "pkg-config" is a system for managing library compile/link flags that
119 works with automake and autoconf. You may obtain it at:
121 http://pkgconfig.freedesktop.org/releases/pkg-config-0.26.tar.gz
123 - The "Glib" utility library.
125 The "Glib" utility library provides non-graphical functions used by the
126 "Gdk" and "Gtk+" libraries, like hash tables, single linked lists, etc.
128 Freeciv requires a version of "Glib" greater or equal to 2.6.0.
130 If the Freeciv configure process tells you that you don't have the
131 Glib library installed, then it may be obtained from here:
133 http://ftp.gnome.org/pub/gnome/sources/glib/2.30/glib-2.30.2.tar.xz
135 - The "Atk" accessibility library.
137 The "Atk" library provides a set of interfaces for accessibility.
138 It allows people with disabilities to utilize all the functionality
139 provided by Gtk+ apps. You may obtain it at:
141 http://ftp.gnome.org/pub/gnome/sources/atk/2.2/atk-2.2.0.tar.xz
143 - The "Pango" text layout and rendering library.
145 "Pango" is library for layout and rendering of text, with an emphasis
146 on internationalization. You may obtain it at:
148 http://ftp.acc.umu.se/pub/gnome/sources/pango/1.28/pango-1.28.4.tar.bz2
150 - The "Gtk+" widget library.
152 The "Gtk+" widget library was designed for the GIMP graphics program.
153 Since then it has gained popularity as an easy to program, free toolkit.
155 "Gtk+ 2" is the default client. If you don't specify any client with
156 "--enable-client" to configure, you will get "Gtk+ 2" client.
158 The "Gtk+" library comes with two companion libraries:
161 Provides an abstraction layer over X-Windows/LinuxFB/Win32 to implement
162 basic drawing functions, windows, clipping, etc.
165 Provides image loading/saving facilities.
167 Freeciv requires a version of "Gtk+" greater or equal to 2.12.0.
169 If the Freeciv configure process tells you that you don't have the
170 Gtk+ library installed, then it may be obtained from here:
172 http://ftp.acc.umu.se/pub/gnome/sources/gtk+/2.24/gtk+-2.24.9.tar.xz
174 "Gtk+" depends on the "Glib", "Atk" and "Pango" libraries.
176 If you are going to make these yourself, build and install them in the
177 following order: pkg-config, Glib, Atk, Pango, Gtk+.
179 1b. Prerequisites for the Gtk+ 3.0 client:
180 ==========================================
184 "pkg-config" is a system for managing library compile/link flags that
185 works with automake and autoconf. You may obtain it at:
187 http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz
189 - The "Glib" utility library.
191 The "Glib" utility library provides non-graphical functions used by the
192 "Gdk" and "Gtk+" libraries, like hash tables, single linked lists, etc.
194 Freeciv requires a version of "Glib" greater or equal to 2.32
196 If the Freeciv configure process tells you that you don't have the
197 Glib library installed, then it may be obtained from here:
199 http://ftp.gnome.org/pub/gnome/sources/glib/2.36/glib-2.36.1.tar.xz
201 - The "Atk" accessibility library.
203 The "Atk" library provides a set of interfaces for accessibility.
204 It allows people with disabilities to utilize all the functionality
205 provided by Gtk+ apps. You may obtain it at:
207 http://ftp.gnome.org/pub/gnome/sources/atk/2.8/atk-2.8.0.tar.xz
209 - The "Pango" text layout and rendering library.
211 "Pango" is library for layout and rendering of text, with an emphasis
212 on internationalization. You may obtain it at:
214 http://ftp.gnome.org/pub/gnome/sources/pango/1.34/pango-1.34.0.tar.xz
216 - The "Gdk-Pixbuf" image loading/saving library
218 "Gdk-Pixbuf" used to be part of "Gtk+" itself, but is now separate
219 project. It may be obtained from:
221 http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/2.28/gdk-pixbuf-2.28.1.tar.xz
223 - The "Gtk+" widget library.
225 The "Gtk+" widget library was designed for the GIMP graphics program.
226 Since then it has gained popularity as an easy to program, free toolkit.
228 The "Gtk+" library comes with one companion libraries:
231 Provides an abstraction layer over X-Windows/LinuxFB/Win32 to implement
232 basic drawing functions, windows, clipping, etc.
234 Freeciv requires a version of "Gtk+" greater or equal to 3.4.0.
236 If the Freeciv configure process tells you that you don't have the
237 Gtk+ library installed, then it may be obtained from here:
239 http://ftp.gnome.org/pub/gnome/sources/gtk+/3.8/gtk+-3.8.1.tar.xz
241 "Gtk+" depends on the "Glib", "Atk", "Gdk-Pixbuf", and "Pango" libraries.
243 If you are going to make these yourself, build and install them in the
244 following order: pkg-config, Glib, Atk, Pango, Gdk-Pixbuf, Gtk+.
246 1c. Prerequisites for the SDL client:
247 =====================================
251 "Simple DirectMedia Layer is a cross-platform multimedia library designed
252 to provide low level access to audio, keyboard, mouse, joystick, 3D hardware
253 via OpenGL, and 2D video framebuffer." (http://www.libsdl.org)
255 These features make it a good choice for portable games. You may obtain it
258 http://www.libsdl.org/release/SDL-1.2.11.tar.gz
260 To compile the client using the "SDL" library add "--enable-client=sdl"
261 to the Freeciv configure script. See the section below for more
262 information about the configure script.
264 - The "SDL_image" library.
266 This library loads the PNG images (with the help of libpng) and converts
267 them to "SDL surfaces" that can be handled by the "SDL" library. You may
270 http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.12.tar.gz
272 - The "SDL_gfx" library.
274 http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-2.0.25.tar.gz
276 - The "SDL_ttf" library.
278 http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.11.tar.gz
280 - The "freetype" library.
282 This library helps to render text for the SDL client, using an externally
283 provided TrueType font. You may obtain it at:
285 http://download.savannah.gnu.org/releases/freetype/freetype-2.3.2.tar.gz
288 1d. Prerequisites for the Xaw client:
289 =====================================
293 The Freeciv Xaw client is an X-Windows program, so you'll need
294 some way of running X-Windows programs. (Most Unixes can...)
296 If the Freeciv configuration program can't find X Windows on
297 your system, you may need to use the --x-includes=DIR
298 and --x-libraries=DIR options.
300 - The "Athena" widget library.
302 This library (also known as "Xaw") is usually supplied standard
303 with the rest of X Windows, but some platforms (HP-UX 10 for
304 example) only provide it in a limited form.
306 To compile the client using the "Xaw" library add "--enable-client=xaw"
307 to the Freeciv configure script. See the section below for more
308 information about the configure script.
310 Many modern Unix systems (such as Linux) ship with a variant called
311 "Xaw3d", which has a more modern "3D" look. If you'd like to try
312 compiling with Xaw3d, then add "--with-xaw3d" to the Freeciv
315 There are also other variants of Xaw, such as Nextaw. Freeciv
316 does not work with these, although it should be possible to modify
317 it in the same fashion as for Xaw3d. Another tool which may help
318 is called "xaw_wrappers", although how to use it is beyond the
323 This library is essential for icon and bitmap handling. It is in
324 wide use, and is supplied standard on most modern Unix machines,
325 although it may be missing on traditional or older Unixes, eg,
328 When you run the Freeciv configure script, it may be necessary for
329 you to use the "--with-xpm-prefix=DIR" command-line option, where
330 DIR is the name of the directory containing the "include" and "lib"
331 subdirectories where Xpm may be found.
333 If the Freeciv configure process tells you that you don't have the
334 Xpm library installed, then it may be obtained from here:
336 ftp://koala.inria.fr/pub/xpm/xpm-3.4k.tar.gz
337 ftp://ftp.x.org/contrib/libraries/xpm-3.4k.tar.gz
339 Install it as you would any other package. If you can't install
340 it in a standard system directory, then use the --with-xpm-prefix
341 option, as described above.
343 If you have problems installing libXpm on Solaris, or don't want to
344 install it as root, see Reinier's libXpm Solaris Installation Notes
345 section near the end of this file.
349 To run the Xaw client a suitable font is required. The X fonts should do.
350 If the Xaw client complains about not being able to open a font your X
351 installation probably don't have them. X fonts can be obtained from:
353 http://xorg.freedesktop.org/releases/individual/font/
355 If you use Debian you can install the package named xfonts-base in stead.
356 After installing a suitable font and restarting X the problem should go
359 1e. Prerequisites for the Qt client:
360 ====================================
364 Qt-client is written in C++, so you need appropriate compiler.
365 In Freeciv development, g++ has been used.
367 - Qt5Core, Qt5Gui, and Qt5Widgets libraries and headers
370 2. Generating Makefiles
371 =======================
372 This section contains two parts, one for generating makefiles from svn
373 versions and one for generating makefiles from release versions.
375 2a. Generating the Makefile for svn versions:
376 =============================================
378 This step is only needed for svn versions.
380 To create the makefile just type
384 This will create the configure script and will run it. All parameters
385 of autogen.sh are passed to configure. Read the next section about the
386 parameters which can be passed to configure.
388 2b. Generating the Makefile for release versions:
389 =================================================
391 Before you compile Freeciv, you must generate a Makefile. This makefile
392 is configured to suit the features available on your machine.
394 This configuration is done using the GNU "configure" script.
396 To use "configure", "cd" into the top directory containing the Freeciv
401 This script will then attempt to determine the relevant features (and
402 misfeatures!!) of your system. It should print a page or two of
403 diagnostics about your machine, then stop gracefully.
405 If you'd like help on the various options supported by the configure
406 script, try the --help option, like this:
410 By default the configure script will choose the Gtk+ client if the
411 required libraries are found. If you prefer to override this default,
412 you can give configure the "--enable-client=xaw" option.
414 If you want to change the compiler options, set the CFLAGS environment
415 variable in your shell before running "configure". For example:
417 % CFLAGS="-O -g -pipe" ./configure [for people using Bourne shell or bash]
421 % setenv CFLAGS "-O -g -pipe"
422 % ./configure [for people using C shell or tcsh]
424 If you're tracking down a "core dump", we suggest that you use
425 a value of "-g" for CFLAGS.
427 When you install Freeciv (later), the game components will be copied into
428 subdirectories of /usr/local by default. If you would like to use some
429 other installation prefix besides /usr/local, you should specify it now:
431 % ./configure --prefix=/opt/freeciv
433 If for some reason using "configure" gives you trouble, follow these steps:
435 - Read the prerequisites section carefully, to determine if your
436 system meets all the requirements.
438 - If you are compiling the Xaw version of the client: Ensure that
439 you have both the Xpm and Xaw libraries installed on your system.
440 Make sure that the configure script can find them, either by
441 installing them in the standard places on your system, or by
442 instructing the configure script with the appropriate command-line
443 options. (See ./configure --help).
445 - If the problem is with "gettext", please read the Native Language
446 Support section, below, for possible work-arounds.
448 - Let us know, so that we can fix it for the next release!!
450 Send mail to the freeciv-dev mailing list, telling us what you did,
451 and what the result is. It would be helpful to include the output
452 of the configure script, and the contents of the "config.status",
453 "config.cache" and "config.log" files, which are generated by the
456 You can find out about the freeciv-dev mailing list on our web
457 site, at http://www.freeciv.org/
460 3. Compiling Freeciv:
461 =====================
463 If all has gone well previous to this point, then compiling Freeciv
464 should be as easy as typing "make" (or preferably, "gmake").
466 If you have problems, read the file BUGS, and follow the advice
467 carefully. If the problem is with "gettext", please read the Native
468 Language Support section, below, for possible work-arounds.
470 After compilation, the important results are:
472 - The "client/freeciv-<GUI>" and "server/freeciv-server" binaries.
473 - The "data/" directory, which contains the graphics and scenarios.
474 - The "translations/" directory, which contains the localization files.
475 - The "fcgui" and "fcser" scripts.
477 It's perfectly feasible to play Freeciv in this directory, without
478 installing it. If you do this, the "fcgui" and "fcser" scripts may be
479 useful, although they are not as necessary as they used to be.
481 See the README file for more information.
483 (However you cannot use Internationalization when playing Freeciv from
484 the source directory; you must install Freeciv for that.)
490 Installing Freeciv involves installing the components mentioned in the
491 Compiling Freeciv section. These need to be copied to a directory such
492 as /usr/local (the default), /usr/games, /usr/games/freeciv,
493 /usr/local/freeciv, or some other suitable directory.
495 Typing "make install" should install everything correctly on your machine.
496 You may like to use the --prefix=DIR configure option (see the Generating
497 the Makefile section) to ensure the files get placed where you want.
499 When the Freeciv client and Freeciv server are run they both need to
500 find some files from the "data" directory. By default freeciv looks
501 in the following directories, in order, for any data files: the current
502 directory; the "data" subdirectory of the current directory; the
503 subdirectory ".freeciv" in the user's home directory; and the directory
504 where the files are placed by running "make install". You can override
505 this search patch by setting the FREECIV_PATH environment variable, to
506 a single directory or a list of directories separated by colons.
510 % setenv FREECIV_PATH "/usr/games/freeciv/data:./data"
511 (for users of csh, tcsh, etc.)
513 % FREECIV_PATH="/usr/games/freeciv/data:./data"; export FREECIV_PATH
514 (for users of sh, bash, ksh, zsh, etc.)
516 Also, note that you generally must install Freeciv if you wish to use
517 its Native Language Support. See the README file for more information.
519 Finally, if you've chosen to use the Xaw client and you have permission
520 to log in as the 'root' user, you should consider copying the resource
521 file data/Freeciv into your app-defaults directory. (Usually this is
522 /usr/lib/X11/app-defaults).
525 5. Native Language Support:
526 ===========================
528 Freeciv uses the "gettext" system for Native Language Support.
530 If you experience problems with gettext in either configuring or compiling
531 Freeciv, there are a few work-arounds you can try:
533 1. If you don't need Native Language Support, disable it using the
534 "--disable-nls" ./configure option:
536 % ./configure --disable-nls
539 2. You can try to install the latest version of GNU gettext.
540 It may be obtained from here:
542 ftp://ftp.gnu.org/pub/gnu/gettext/gettext-0.16.1.tar.gz
548 Freeciv has optional support for the readline library.
550 Readline support is what makes the server command line behave sensibly,
551 making it possible to
552 - Use the backspace key.
553 - Use the cursor to move back and forth on the line you have written.
554 - Use TAB completion of commands and command arguments. Ie, when you
555 push tab the server will finish the word for you if there is only one
557 - Use the up and down cursor to scroll through the history of previously
561 The configure script will check if you have the readline library correctly
562 installed. If so it will automatically set up the makefiles so that readline
563 is compiled into the server. If not then it will just silently configure
564 without readline support.
565 You can force configure to include readline or die trying by giving
566 configure the --with-readline option:
568 % ./configure --with-readline
570 Some linux distributions (and possibly other operating systems) have
571 readline version 4 incorrectly installed, so that readline is not
572 set up to declare it's dynamic dependencies. In that case configure
573 will try to guess which extra libs it should link against and add them.
574 The configure script will give a warning if it had to add extra libs
575 to make readline work. This should be harmless, and is just meant as
576 a reminder to the folks who distribute readline. :)
578 7. Reinier's Solaris Installation Notes:
579 ========================================
581 Solaris (2.5 and up) has its own version of X in /usr/openwin, its own
582 version of make in /usr/ccs/bin/make, and its own compiler (to be purchased
583 separately) which, if you have it, is available in /opt/SUNWspro/bin.
584 Solaris does not provide the XPM library, which is required for the Xaw
585 client; it doesn't provide any of the stuff required for imlib, gdk and gtk,
586 either, which is required to build the GTK+ client. However, with some
587 patience, everything can be compiled without problems.
589 For information on how to install XPM on Solaris, see the next section.
591 Many Solaris installations also have MIT X (usually, in /usr/X11), GNU make,
592 the gcc compiler, and the XPM library installed somewhere. The standard
593 command "./configure && make" may not be able to find your XPM library and
594 it is likely to confuse the different versions.
596 Make sure your environment variables, especially $PATH and $LD_LIBRARY_PATH,
597 and the ./configure options do not point to an inconsistent set of software,
598 and compiling will be fine.
600 A simple recipe to compile with Sun X, Sun make and Sun cc, assuming the xpm
601 libraries are on their own in the nonstandard location /path/to/xpm:
603 % setenv PATH /opt/SUNWspro/bin:/usr/ccs/bin:/bin
604 % unsetenv LD_LIBRARY_PATH
605 % ./configure --with-xpm-prefix=/path/to/xpm
608 You can set up your $PATH and ./configure to use only GNU
609 tools. Furthermore, Freeciv is known to compile with MIT X, and with
610 certain combinations of GNU and Sun tools. The exact recipes depend on your
614 8. Reinier's libXpm Solaris Installation Notes:
615 ===============================================
617 When I was root on my Solaris system, I *still* didn't want to install
618 third-party software as root. It's bad practice.
620 Unfortunately, the libXpm installation procedure assumes installation
621 in /usr/openwin, which is owned by root. But it's not all that hard to
626 - Make sure /usr/ucb/install is in your $PATH before /usr/bin/install,
627 otherwise 'make install' will break with strange error messages.
629 - The destination you want to install to can be specified with $DESTDIR;
630 however, installation will actually take place in $DESTDIR/$OPENWINDIR,
631 so the additional $OPENWINDIR subdir must be stripped afterwards
632 (changing the value of $OPENWINHOME doesn't work).
636 - Get the source from somewhere, untar it, cd into the source directory,
639 % setenv MYXPMDEST /usr/local # or wherever you want to install it
640 % xmkmf; make Makefiles includes depend; make
641 % setenv PATH /usr/local/bin:/usr/ucb:$PATH
642 % make DESTDIR=$MYXPMDEST install
643 % make DESTDIR=$MYXPMDEST install.man
644 % cd $MYXPMDEST; mv ./$OPENWINHOME/* .; rm -rf ./$OPENWINHOME
646 (If you use sh, bash, ksh, zsh, etc., the "setenv"s above should be:
647 % MYXPMDEST=/usr/local; export MYXPMDEST
648 % PATH=/usr/local/bin:/usr/ucb:$PATH
651 - You can now configure Freeciv with
653 % ./configure --with-xpm-prefix=$MYXPMDEST
655 which will add the proper -I/-L/-R options to the compile and link
659 9. Mac OS X and Darwin notes:
660 =============================
662 Apple's version of GCC uses precompiled headers that does not support
663 vararg macros (a GCC extension). This causes GCC to fail when
664 compiling Freeciv since the compiler is otherwise (mostly)
665 indistinguishable from vanilla GCC. So instead of the usual
669 you should use either
672 $ CC="gcc -no-cpp-precomp" ./configure <...>
677 % env CC="gcc -no-cpp-precomp" ./configure <...>
679 depending on whether your shell is a Bourne or C shell variant. (If
680 in doubt, just try both to see which one will work.)
682 Replace <...> with whatever additional arguments you want to give to
686 10. Debian GNU/Linux notes:
687 ===========================
689 To compile freeciv on a debian system you need the following packages:
702 If you want to compile the xaw client you should give configure the
703 argument --with-xaw3d, ie
705 % ./configure --with-xaw3d
707 If you need to run aclocal (if you don't know what aclocal is then you
708 don't need it) you also need to install imlib-dev to get the
709 AM_PATH_GDK_IMLIB macro. It is a bug in debian that this macro isn't
710 in gdk-imlib-dev, and it will hopefully be fixed in future debian
716 Windows version of Freeciv can be built either with MinGW or Cygwin.
717 Official Windows binaries are built with MinGW, and they are self-contained
718 packages. For using Cygwin version, you need Cygwin environment installed.
720 Build instructions for MinGW versions are documented on top of file
721 win32/installer/Makefile
723 Cygwin specific installation notes can be found in doc/INSTALL-Cygwin.