Skip to main content
Building From Source - Linux - Shoggoth        
Building Ogre from source on the Linux platform

Tip_icon.png This information is regarding previous versions of Ogre. (Before the switch to a CMake based build system)

Info See Building Ogre for current version.

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

Prerequisites

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.

Copy to clipboard
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/RenderSystem_GL.so" ).

Copy to clipboard
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.

Copy to clipboard
FreeType2 +2.1.x zziplib +0.13.x (do not use 0.12.x - [http://www.ogre3d.org/phpBB2/viewtopic.php?t=34751 causing memory leak]) FreeImage http://freeimage.sourceforge.net/ libpng, libmng, libtiff, libjpeg (for FreeImage)

Optional Libraries

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

Building

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

Copy to clipboard
tar xjf ./ogre-linux_osx-v1-0-?.tar.bz2 cd ogre ./bootstrap ./configure (For nvidia, append --with-platform=GLX) make 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):

Copy to clipboard
tar xjf ./ogre-linux_osx-v1-0-?.tar.bz2 ([http://www.ogre3d.org/developers/subversion 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 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:

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

Then you need to:

Copy to clipboard
cp OgreMain/src/libOgreMain.la 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.


Debian

Image
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 ogre3d.org, 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 :

Copy to clipboard
deb-src http://ftp.debian.org/debian unstable main


If needed, update sources:

Copy to clipboard
sudo apt-get update


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

Copy to clipboard
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 :

Copy to clipboard
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 :

Copy to clipboard
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 :

Copy to clipboard
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.


Fedora

fedora.jpg

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

Install the developer tools:

Copy to clipboard
sudo yum groupinstall "Development Tools"

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

Copy to clipboard
sudo rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm sudo rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

Install library dependencies:

Copy to clipboard
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:

Copy to clipboard
wget http://downloads.sourceforge.net/ogre/ogre-v1-6-3.tar.bz2 tar xjf ogre-v1-6-3.tar.bz2 cd ogre ./bootstrap ./configure make sudo make install && sudo /sbin/ldconfig

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


Gentoo

Image

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:

Copy to clipboard
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.

AMD64

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

Copy to clipboard
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

Image
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.

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

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

Copy to clipboard
sudo apt-get update
  • Install necessary packages.

Copy to clipboard
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:

Copy to clipboard
wget http://downloads.sourceforge.net/wgois/ois_1.2.0.tar.gz tar xzf ois_1.2.0.tar.gz pushd ois aclocal && ./bootstrap && ./configure make && sudo make install popd
  • Setup CEGUI (Crazy Eddies GUI System):

Copy to clipboard
wget http://downloads.sourceforge.net/crayzedsgui/CEGUI-0.6.0.tar.gz tar xzf CEGUI-0.6.0.tar.gz pushd CEGUI-0.6.0 aclocal && ./bootstrap && ./configure make && sudo make install popd
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:

Copy to clipboard
wget http://downloads.sourceforge.net/ogre/ogre-v1-6-3.tar.bz2 tar xjf ogre-v1-6-3.tar.bz2 pushd ogre aclocal && ./bootstrap && ./configure make && sudo make install popd
  • Complete installation:

Copy to clipboard
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:

Copy to clipboard
(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: http://developer.nvidia.com/object/cg_download.html

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

Copy to clipboard
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")

Enjoy.