Building From Source - Linux - Shoggoth         Building Ogre from source on the Linux platform


The preferred method for new users building on linux is to use your distributions source package, if available. Go to the section for your distribution first. If that isn't an option, use the GCC & Make section.

GCC & Make


The following programs are required. The versions below are known to compile Ogre 1.0.3. Minor version differences will probably work (ie 3.3 instead of 3.3.5). Later versions will likely work.

automake      1.9.5    (1.6+ req)
     autoconf      2.59a    (2.50+ req)
     make          3.80
     libtool       1.5.6    (1.4+ req)
     pkg-config    0.17.2
     gcc           3.3.5
     g++           3.3.5
     cpp           3.3.5

Some users have had trouble with gcc 4.0. Ogre compiles fine with it, but there have been other issues during runtime. You can tell which version you have with the following commands. It is highly recommended that you build from the CVS if you have gcc 4.0+.(ubuntu build-essential has 4.1+). This is the only option(from CVS) if OGRE is unable to loadLibrary()'s when you provide absolute paths( try "/usr/local/lib/OGRE/" ).

g++ -v
     gcc -v

The following external libraries are also necessary for building. Some of these can be found under various names depending on your distribution (ie devil vs libdevil). You will need the package that contains development headers in addition to the libraries.

FreeType2     +2.1.x 
     zziplib       +0.13.x (do not use 0.12.x - [ causing memory leak])
     libpng, libmng, libtiff, libjpeg (for FreeImage)

Optional Libraries

Cg            (Nvidia's shader library)
     CEGUI         (Gui library)
     Gtkmm2        (For samples config dialog)
     Glademm2      (For samples config dialog)
     libsigc       (for Gtkmm)


  • Go to and click on More Downloads, then Source Releases: Linux & OSX
  • Download the latest Linux/OSX source package.

tar xjf ./ogre-linux_osx-v1-0-?.tar.bz2
     cd ogre
     ./configure           (For nvidia, append --with-platform=GLX)
     make install          (run this command as root)

thumb|cmake-gui example
Since 26.03.2009 ogre trunk (rev. 8444), cmake replaced the above autoconf build system in the following way (Please take a look at Building Ogre for an in-depth guide of the CMake build system with OGRE):

tar xjf ./ogre-linux_osx-v1-0-?.tar.bz2   ([ you can also do a svn checkout of the source if preferred])
     cd ogre
     cmake-gui             (see image to the right for steps if unsure)
     make install          (run this command as root if you wish to install ogre, e.g. sudo make install)

You can use make -j instead of just make to have multiple files compile in parallel. This can speed the build up considerably if you have a multi-core processor or more than one CPU. It is often recommended that the number of processes be twice the number of available cores, e.g. make -j 4 for a dual-core CPU.

Note (for Ubuntu):

After you run "make," and when you run "make install," and you get an error like this:

/usr/bin/install: cannot stat `.libs/libOgreMain.lai': No such file or directory

Then you need to:

cp OgreMain/src/ OgreMain/src/.libs/libOgreMain.lai
     vi OgreMain/src/.libs/libOgreMain.lai

and change(on line 25) "installed=no" to "installed=yes" (Hint: to change text in vi, press the "insert" key on your keyboard. To save and quit, push and release "Esc" then type ":w", then type ":q", and hit enter). Now just run "sudo make install" again, and you should be good to go.

Make sure each step completes without errors before moving to the next one. Warnings are usually OK. If you get an error, search in the forums for help. Don't ask questions without searching first. Basic questions have already been answered countless times.

Perhaps the best resource for working through an Ogre compilation on linux is this thread. It is about Debian but should be useful to other distributions. An older linux readme file may provide some useful information.

When Ogre has been compiled successfully, the sample applications will be built in the ./ogre/Samples/Common/bin directory.


If you want to compile OGRE yourself you can use the official tar.bz2 archive, but on Debian systems it's better to use the source package. This way you can obtain .deb packages that will integrate nicely with your system, just like standard binary packages.

Please note that this method requires Debian Etch or later. If you use Sarge or Woody, you must either download and compile the sources from, or upgrade to Etch or later.

Using the source package

You need to have this line in your /etc/apt/sources.list to get the source packages :

deb-src unstable main

If needed, update sources:

sudo apt-get update

If you want to compile everything automatically, you only need to type this command :

apt-get source --compile ogre

If you want to use different compilation options or if you need to modify the source before the compilation (by applying patches for example), you can follow these steps :

apt-get source ogre
cd ogre-1.0.4
DEB_BUILD_OPTIONS="insert your options for the configure script here"
fakeroot debian/rules binary

After the compilation, you can install the packages from the parent directory by typing :

dpkg -i *.deb

Using the tar.bz2 archive

If you still want to compile OGRE from the tar.bz2 archive, this command should be able to install all the needed dependencies :

apt-get install g++ gcc cpp make automake1.9 libtool     libsdl1.2-dev libdevil-dev libfreetype6-dev libgtkmm2.0-dev     libcegui-mk2-0 libcegui-mk2-dev libcegui-mk2-doc libxerces26-dev     libpng3-dev libmng-dev libtiff4-dev liblcms1-dev libpng3 libjpeg62-dev     libglademm2.0-dev libzzip-dev libxaw7-dev    libopenexr-dev libopenexr2 nvidia-cg-toolkit

You'll then be able to proceed with the standard Linux compilation as mentioned previously or you can use Checkinstall, which creates a nice custom debian package for you.



These instructions have been updated for Ogre 1.6.1 on Fedora 10:

Install the developer tools:

sudo yum groupinstall "Development Tools"

Enable "free" and "nonfree" repositories from rpmfusion (needed for Cg):

sudo rpm -Uvh
  sudo rpm -Uvh

Install library dependencies:

sudo yum install zziplib-devel libXt-devel libXaw-devel libXxf86vm-devel       xorg-x11-fonts-misc freeimage-devel freetype-devel ois-devel cegui-devel Cg

Build Ogre:

  tar xjf ogre-v1-6-3.tar.bz2
  cd ogre
  sudo make install && sudo /sbin/ldconfig

[+] Older Fedora instructions (Click the + sign to view)



Ogre is available through portage, although still masked. We will need to adjust our USE flags to get all features.

Type as a root user:

echo "dev-games/cegui ~*" >> /etc/portage/package.keywords
 echo "dev-games/ogre  ~*" >> /etc/portage/package.keywords
 echo "dev-games/cegui devil doc" >> /etc/portage/package.use
 echo "dev-games/ogre  devil doc cg cegui examples" >> /etc/portage/package.use
 emerge ogre

And that's it! The rest will be handled by the system. OGRE will be installed into /usr/lib and /usr/include/OGRE.


In Gentoo-AMD64 (x86_64) I managed to build Ogre 1.0.6 with these options:

dev-games/cegui-0.4.0  +devil -doc +opengl -xerces-c
 dev-games/ogre-1.0.6  +cegui +cg +devil +doc -double-precision -gtk -openexr +opengl +sdl -threads

Ubuntu / Kubuntu

The following guide is for Ubuntu 8.04 and newer. For older versions please go here

Please post feedback in this thread

I will not do a lot of explaining here and will assume that you know what each command does or at least know how to look it up. This is a guide to get you up and running as fast as possible on Ubuntu.

  • Go to some directory you have write access to.

cd ~/Desktop
  • Uncomment all Ubuntu repositories in sources.list.

sudo nano /etc/apt/sources.list
  • Run apt-get update.

sudo apt-get update
  • Install necessary packages.

sudo apt-get install pkg-config build-essential autoconf automake libtool libzzip-dev libxt-dev libxxf86vm-dev      libxrandr-dev libfreeimage-dev nvidia-cg-toolkit checkinstall libfreetype6-dev libpcre3-dev libopenexr-dev      freeglut-dev mesa-common-dev libtiff4-dev libglademm-2.4-dev libcppunit-dev libxaw7-dev libxaw-headers libois-dev
libxaw-headers is obsolete on Ubuntu 9.04 and can be dropped from the list. UPDATE FOR Karmic
You must remove this for Karmic (9.10) because it's gone with the 9.10 release.
A sufficiently recent version of OIS (at least for Ogre 1.6.x) is available in the libois1 and libois-dev packages, and at least for 9.04 and beyond (older Ubuntu versions not tested).
Many of these packages may already be installed, but this list makes sure we've covered all the bases.

  • Setup OIS (Object Oriented Input System) — note that this is potentially obsoleted if libois-dev and libois1 are present for your distro version:

 tar xzf ois_1.2.0.tar.gz
 pushd ois
 aclocal && ./bootstrap && ./configure
 make && sudo make install
  • Setup CEGUI (Crazy Eddies GUI System):

 tar xzf CEGUI-0.6.0.tar.gz
 pushd CEGUI-0.6.0
 aclocal && ./bootstrap && ./configure
 make && sudo make install
CEGUI-0.6.2 is available and can be used instead, but depending on system configuration you may need to add '#include <algorithm>' to RenderModules/directfbRenderer/directfb-renderer.cpp

  • Setup Ogre3D:

 tar xjf ogre-v1-6-3.tar.bz2
 pushd ogre
 aclocal && ./bootstrap && ./configure
 make && sudo make install
  • Complete installation:

sudo ldconfig
If during linking your program code, you get an error
OGRE/GLX/OgreTimerImp.h:33:31: error: OgrePrerequisites.h: No such file or directory
Then add a '../' in the OgreTimerImp.h file so that it reads #include "__../__OgrePrerequisites.h to find the file.

If it all ran fine you now have a dirty (but quick) source-compiled installation of Ogre3D, congratulations!
The demos are located at <ogre>/Samples/Common/bin/

If during execution you get an error such as:

(0) : fatal error C9999: *** exception during compilation ***

Cg compiler terminated due to fatal error

Then your Cg installation may be too old. Currently this appears to be the case with Ubuntu 9.04, which is providing Cg version 2.0.0015.

To get an updated version of Cg:

Visit the Nvidia download page to get the appropriate architecture:

Do not extract the archive. You want to save it as the original .tgz file.

sudo apt-get remove nvidia-cg-toolkit
 cd /
 sudo tar xzf path/to/Cg-X.X_DATE_ARCH.tgz

You may wish to recompile Ogre to ensure it picks up any changes in the Cg version. ("cd ogre; make clean; make; sudo make install")