Installing Ogre3D in Ubuntu

... can be quite messy. This webpage details several recurring problems I had while installing Ogre3D from scratch from a clean Ubuntu (Hoary 5.0.4) distribution, and how to fix them or work around them otherwise. Please read through it fully before you do anything. As a sort of dubious consolation (at best), if you ever seriously hurt your system, you lose relatively little by reinstalling Ubuntu.

Needed packages

You'll need to apt-get (or install with synaptic) the following packages. The names should be exact - I'm crosschecking them with synaptic as I type. Note: it's assumed that you'll install any necessary requisite packages that make these work.

Missing libraries

How you can tell if you are missing a library:

STLPort and the nVidia Cg Toolkit

If you are using gcc3.3 or higher, which you will be, you can feel free to ignore everything the internet says about you needing STLport. You don't. You will, however, need a certain Cg Toolkit from nVidia. you can find it here:

http://developer.nvidia.com/object/cg_toolkit.html

After you tar the file .tar.bz2 file, you'll be left with a /usr directory which you will need to merge with your own. If you don't have Cg Toolkit set up when you ' ./configure', it will tell you so. Note that you can always not download the Cg Toolkit and run './configure --without-cg', but this will break some of the ogre examples and other functions. This is not advised, not have I tried this.

A word on drivers

A word on drivers: for the love of linux, don't just install random ones that the internet suggests. I grabbed the nvidia-glx package while looking for the Cg Toolkit, and it caused my glx to die. Luckily, there is a very easy way to tell if you have just destroyed your system's OpenGL rendering capabilities. Run 'glxgears' and see if it still works. Note that if you really screw up, X won't even open the next time you restart it. So it shouldn't need repeating that playing with your videocard drivers without knowing what you're doing can be disastrous. If you've botched your system, you should work to reverse this immediately. Sometimes, however, it's not worth the time and effort, and a clean reinstall of Ubuntu is the correct course of action.

Getting ogre3d

Okay, now that we've been installing libraries and other utilities for the last hour, let's get our hands dirty. There are two main ways of getting the ogre3d source. You can check it out from CVS following the directions here:

http://inetserver.europe.homeip.net/~heiko/?p=102

(this website also has some good information on an Ubuntu install of Ogre). Or you can download the source code in an archived form from
http://www.ogre3d.org

After unpacking, you'll have an /ogrenew/ directory, which is where you'll be doing most of your building work.

The ogre3d make process

Sidenote: The ogre3d make process is, uh, "tempestuous" to say the least. it will not cooperate. you will have to do it several times over. it will hate you and tell dirty lies about you, but at the end of the day you will have wrestled it into submission.

The process is as follows. If any of these steps fails, you will typically get an error that hints at what is not yet correctly set up. Be persistent, and patient.

Running the ogre3d demos

Now, even after all this, you need to be wary. Try running some of the compiled demos in ogrenew/Samples/Common/bin . Here's a rather annoying error: ogre may complain that it's missing certain ogre-built libraries from the /usr/local/lib directory. Examples of these are 'libOgrePlatform.so' and the following from /usr/local/lib/OGRE : 'Plugin_BSPSceneManager.so', 'Plugin_CgProgramManager.so', 'Plugin_OctreeSceneManager.so', 'Plugin_ParticleFX.so', 'RenderSystem_GL.co', 'resources.cfg'.

Anyway, what kept happening to me is that the 'make' process would create these libraries, but because of some silly error, would never actually copy them over before the cleanup phase of 'make' and 'make install' removed them. So what I had to do was interrupt my make process after it had built these libraries, grep for the necessary files (they will be in some strange *.soU format, and you will have to rename them when you move them to your /usr/local/lib/) and manually put them where the ogre executables were looking. Needless to say, this was extremely annoying, but in the end it all worked out.

Another common error you may have: you run an ogre demo, and the terminal output (as a side note: always, always, always run your ogre demos and your make processes on the command line. I can't stress this enough. You need to be able to know what's going on if you expect ogre to work.) complains that you're missing some demo-specific file like 'resources.cfg' or 'media.cfg' or 'terrain.cfg', as the case may be, this is because you are running the wrong version of the demo. You'll want to run it from ogrenew/Samples/Common/bin/ and not from ogrenew/Samples/[name of demo]/src/ because that way all the include paths are correct.

Anyway, it took me many, many hours but I finally got the demos up and running. Be patient, resourceful and clever, and you should succeed.



Dennis V. Perepelitsa 6/23/2005 phaeton - at - media - dot - mit - dot - edu