MG/Linux Compiling

From MegaGlest
Jump to navigation Jump to search

This page explains how to compile MegaGlest on Linux platforms.

Linux quick setup[edit]

See here


  • Download the project from the GIT repository using the command line (recommended) or your favorite GIT tool (such as RabbitVCS or TortoiseGIT).
  • Install build dependencies. These are usally packaged by Linux distributions. On Debian, Ubuntu, Fedora, Opensuse and even more Linux distributions you may use
cd mk/linux
sudo ./

to install them. If your distribution is not supported or you prefer to install yourself: This is the current dependency list - where packages are available, the package names may start with lib and usually have -dev(el) towards the end:

gcc gcc-c++ cmake sdl2 alut GL GLU vorbis x11 lua jpeg png curl ircclient glew ftgl fribidi cppunit vlc miniupnpc

Additionally for map editor and model viewer:

wxgtk xml2


Scripted build[edit]

(Recommended way)

  • Start the build:
cd mk/linux
  • To start MegaGlest:

Building using CMake by Hand[edit]

  • Open a terminal window and navigate to the specified branch and type the following:
cd mk/linux
mkdir build
cd build
cmake ../../..
  • In the line cmake ../../.. you can put additional parameters cmake <parameters> ../../.. where every parameter should be preceded by -D.
  • NOTE: most developer that are not planning to run megaglest from the standard linux LHS paths (like usr/local/bin) should run cmake with the following syntax so that the resulting binaries look in the local compiled folders for data files:
cd mk/linux
mkdir build
cd build

As example other special CMake options for customized builds:


but if you want to see this list ^ up to date (and with useful description) then use cmake -LH ../../.. on the beginning.

Cross Compiling Windows binaries on Linux[edit]

  • This process is still experimental and is not fully supported at the moment but rather for educational purposes.
  • Download and extract the MingW win32 dependency archive from Sourceforge and extract into the source folder.
  • Install the MingW cross compiler for your distro. In Ubuntu run:
sudo apt-get install mingw32 mingw32-binutils mingw32-runtime
  • Open a terminal and cd to the root folder of your Mega-Glest folder.
  • Modify the script. You also need to change windows_deps/curl-7.20.1 to windows_deps/curl-7.21.3
  • Run the script:
cd mk/linux
  • If all goes well you should see the Windows .exe binaries produced in the data/glest_game folder.

Test binaries[edit]

To test running the game, run the binary in mk/linux like this:


These are some commandline options:

./megaglest --help
./megaglest --version
./megaglest --opengl-info

Trouble shooting[edit]

If your build fails, and you have not been building for a while, this is usually due to outdated build dependencies and in this case you should do:

cd mk/linux
sudo ./

If MegaGlest crashes you should do a full rebuild. To trigger a full rebuild you should just remove the build directory before the build, e.g. by run:

cd mk/linux && rm -r build && ./

Reporting bugs[edit]

If you think you have run into a bug in MegaGlest, and neither reading the README and FAQ nor searching for it at helps, then please report a new bug at (one-time registration is necessary to post). When filing a bug, please provide a log of the build process of a full rebuild.

See Also[edit]