FromSourceUbuntu         How to build Ogre from source on Ubuntu 7.10

%prevogre%

HOWTO Ubuntu 7.10

On Ubuntu, you can compile OGRE from the Debian source package, the official tar.bz2 archive or from CVS. Compiling from the Debian source package will allow better integration with your system compared to the standard source compilation. Using CVS gives you the latest bugfixes, but is less guaranted to work than stable versions.

Using the Debian source package

At the place where you can find OGRE 1.0.3 packages for Ubuntu 5.0.4, there is a recompile_readme.txt file which describes how to recompile Debian OGRE and CEGUI packages for Ubuntu 5.0.4 (Hoary Hedgehog). The version of Ogre in the Ubuntu repositories is very outdated so you might as well download the latest from ogre3d.org instead. Instructions for compiling and installing the latest version can be found here.

On the Ubuntu forums you can find information about how to rebuild the Debian packages for Ubuntu on amd64 in this thread. The author of the post says that he's only done it on amd64 but that it should work in the same way for other architectures.

Using the tar.bz2 archive

This install documentation will work on a fresh install of Ubuntu 7.10 (gutsy gibbon)

The official tar.bz2 source to compile OGRE from is located here

Since Ubuntu was originally based on Debian and uses the same package management system, the same install process works for Debian with only slight changes to package names.

Note: The only changes you may be required to make are the versions of the packages that are installed with apt-get.

The rest of Ogre3D should install on either after the required packages are installed.

With it being so difficult to keep up with the changes of package versions, this is something you may have to change yourself but really it just requires a little bit of research into what package versions your current version of Debian or Ubuntu have.

Anyway, let us begin.

Note: Since this is also written for Debian, I haven't included "sudo" at the start of each command so if you're using Ubuntu, put a sudo at the start of each of them or it will blow out with permission errors when you run the command.

Enable all apt-get sources in Ubuntu's /etc/apt/sources.list file. (Get rid of the hash in from of the "deb" parts)

You may also want to enable contrib and non-free for future use since it simply expands the possible selection of packages available to you.

Apt-get install the following packages using:

apt-get install libfreeimage-dev libfreeimage3 pkg-config build-essential libtool make automake g++ gcc cpp make automake1.9 libtool libsdl1.2-dev libdevil-dev libfreetype6-dev libgtkmm2.0-dev libcegui*
 libpng12-dev libmng-dev libtiff4-dev liblcms1-dev libpng3 libjpeg62-dev libglade* libzzip-dev libxaw7-dev libopenexr-dev libopenexr2c2a nvidia-cg-toolkit checkinstall libcppunit-1.12-0 libcppunit-dev
 libcppunit-doc libxxf86vm-dev libtiff4-dev and libmng-dev libois1 libois-dev


Download the ogre source package for compilation. At the time of writing the most current source was:
http://downloads.sourceforge.net/ogre/ogre-linux_osx-v1-4-6.tar.bz2
Extract with:

tar -xvjf ogre-linux_osx-v1-4-6.tar.bz2

Enter the extracted source directory (ogrenew) with:

cd ogrenew

Run aclocal with:

aclocal

Run the bootstrapping program to create the initial files required for compiling.

./bootstrap

Configure the package for your distribution and exact configuration.

./configure

Make the source files

make

Install the made files into their respective locations (which will also create a .deb package for future use should you need to reinstall).

checkinstall

After the install, there is one more thing you need to do: Tell Ubuntu where to find the libraries.

Do this with by adding the following line to the bottom of /etc/ld.so.conf:

include /usr/local/lib

You should be able to use the tutorials for Setting Up An Application for Ogre3D and voila, all done!

If the sample applications are not working in /Samples/Common/bin, check ogre.log. If the log says something like,

OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library <RenderSystem_GL.so>.
 System Error: libOgreMain.so.14: cannot open shared object file: No such file or directory in DynLib::load at OgreDynLib.cpp (line 80)

You may need to build from the CVS if this problem persist. Ubuntu installations will typically have gcc 4.1+.(from build-essential pkg) gcc 4.0+ can cause trouble at runtime with dynamic link libraries. You can test for this by using the absolute path of the libraries in loadLibrary.

Additionally, or if you get stuck anywhere along the way, you might want to have a look at some of the other tutorials for previous versions of Ubuntu.

Installation guide for Ubuntu 7.04
Tutorial

Installation guide for Ubuntu 5.04
Tutorial

Using CVS

Use the vanilla GCC/make guide:
Building From Source - Linux - Shoggoth

If you run into linker problems, try issuing the command export CC=g++ before running ./configure.
See the Developers page if you want to get OGRE from CVS.

Using a semi-automated script (Ubuntu 6.10)

This method is probably not best suited to be up to date (at least concerning the 3rd party libraries like Cg) but it has been put together to set up OGRE (CVS version) on all the development platforms of our team. You can download and read more about this at the QBIC project. It downloads, compiles and installs OGRE and all required 3rd party libraries (including some deb-packages).

HowTo


I (madmark), a Windows guy, have documented my process getting Ogre installed from a fresh Kubuntu 5.10 (Breezy-Badger) install Kubuntu Install.

Using Checkinstall instead of "make install"

By using Checkinstall, you can automatically create a custom .deb package. This is the recommended way for building from source on ubuntu/kubuntu/debian systems.

Ubuntu 7.04 and ogre v-1.4.1 and v-1.4.2 fail after successful running make, when doing a checkinstall or make install at the point relinking RenderSystem_GL libs. I only found this workaround to build a debian package and install: copy the main-lib libOgreMain-1.4.2.so (or 1.4.1 for 1.4.1) to the directory where the install would put it - thats normaly /usr/local/lib - and create there too the link-entry libOgreMain.so (ln -s libOgreMain-1.4.2.so libOgreMain.s). Run ldconfig to update the lib-tables and do the checkinstall again. It will now find the dependencies to relink RenderSystem_GL.so with the main-lib from this place. After this you can delete the previous copy+link. Some packages create replacements for files in /lib, /bin -
i dont know why - to avoid them: checkinstall --exclude /lib,/bin,/usr/share excludes those files (ld, strip, ..).
To install/use both release versions together is normaly not possible, because only the main-libs have different filenames. The libs like RenderSystem_GL have the same filename and you have to put those in different directorys and manually enter their locations into the plugins.cfg of the programs using them. All samples did run, except the hdr and those using the missing quake-pk3.

I do not know if the fail of the relink is normal, i could not find any differences between the working relink of the Cg_Plugins lib and the RenderSystem libs, the first error message (of a lot) is:

.libs/OgreGLEngineDll.o: In function `dllStopPlugin':
/mybuild/src/ogre/ogrenew/RenderSystems/GL/src/OgreGLEngineDll.cpp:47: undefined reference to `Ogre::Root::uninstallPlugin(Ogre::Plugin*)'

HOWTO : Compile and Install Ogre 1.4.x from source on Ubuntu 7.04

Here is the original post : http://www.ogre3d.org/phpBB2/viewtopic.php?t=32549

STEP 1 : Install Dependencies

sudo apt-get install alien automake1.9 build-essential libcppunit-1.12-0 libcppunit-dev libmng-dev libsdl1.2-dev libtool libxaw-header 
            libxaw7-dev libfreetype6 libfreetype6-dev libpcre3 libpcre3-dev libzzip-dev libxrandr-dev libxxf86vm-dev freeglut3-dev

Here is the list of the package for those who want to use synaptic :

alien automake1.9 build-essential libcppunit-1.12-0 libcppunit-dev libmng-dev libsdl1.2-dev libtool libxaw-header libxaw7-dev libfreetype6 libfreetype6-dev libpcre3 libpcre3-dev libzzip-dev libxrandr-dev libxxf86vm-dev freeglut3-dev

STEP 2 : Build other dependancies

  • OIS 1.0 :

http://www.sourceforge.net/projects/wgois

  • FreeImage 3.9 :

http://freeimage.sourceforge.net

  • CEGUI 5.0b :

http://www.cegui.org.uk/wiki/index.php/CEGUI_Downloads_0.5.0

  • Cg Toolkit 1.5 :

download the lastest Cg toolkit here (the RPM file) :
http://developer.nvidia.com/object/cg_toolkit.html

And use alien to create au .deb :

sudo alien Cg-1.5.i386.rpm

Then install it :

sudo dpkg -i cg_1.5.0-15_i386.deb

Or download the .tar.gz file and merge /usr directory, go in the /usr directory unpacked and type :

sudo cp ./* /usr/ -R

Or take this .deb which apperently work fine with Ubuntu :
http://http.us.debian.org/debian/pool/contrib/n/nvidia-cg-toolkit/nvidia-cg-toolkit_1.5.0.0019-1_i386.deb

STEP 3 : Download Ogre3D Sources

from here:
http://www.ogre3d.org/index.php?option=com_content&task=view&id=412&Itemid=132

STEP 4 : Install Ogre3D

Unpack the folder and go with the terminal in the ogrenew folder and type :

aclocal
./bootstrap
./configure
make
sudo make install (or checkinstall)


And then everything should be fine!!

STEP 5 : Launch an example

In order to verify if Ogre is well installed, go in the /ogrenew/Sample/Common/bin directory and type the name of the demo like that :

./DemoName (example : ./Water)

STEP 6 : Finilize Installation



Edit the ld.so.conf file :

sudo gedit /etc/ld.so.conf

And add this :

/usr/local/lib

HOWTO: Compile and Install the Latest Ogre3D from Source on Ubuntu (Out of Date)


(Problems seem to have been fixed in final release of Edgy)

The version of Ogre in the Ubuntu repositories is quite old and will not work with recent Ogre3d based applications, hence the need to compile the latest versions from source.

There is an alternative HOWTO here

This guide is based on Ubuntu Edgy. Other releases may vary.

STEP 1: Download Source

download the latest Ogre3D Linux source from here and extract somewhere in your home directory. You'll get a folder called 'ogrenew'.

For a quick reference, the steps to install are as follows, but you'll need to install some packages before you can do this.

./bootstrap
    ./configure
    make
    sudo checkinstall


More info on Checkinstall

STEP 2: Install Dependencies

Install the required packages using either apt-get in the console or some other GUI package management tool like Synaptic or Adept. This is the command line to install all the packages you need:

sudo apt-get install build-essential automake1.7 alien libtool xlibs-static-dev libdevil-dev libsdl1.2-dev libcppunit-dev libmng-dev checkinstall libxxf86vm-dev libzzip-dev libxaw-headers libxrandr-dev libtiff-dev libpng-dev
sudo apt-get build-dep libogre-dev


It may be a good idea to run the command aclocal at this point. If you get warnings you might be missing some required libraries.

Note: Automake1.9 gave me errors about CPPUNIT so make sure you install automake1.7. If you change versions after you do ./bootstrap you'll have to re-run ./bootstrap and ./configure.

Note: The version of DevIL in dapper has a bug in it that will cause the default render settings window it malfunction. The bug is fixed with the version in Edgy, but if you're still using dapper, don't install the later package because it could break things due to dependency conflicts. Dapper users can try downloading and compiling the latest DevIL package from source.

Note: On Feisty Fawn, I had to use libpng12-dev instead of libpng-dev.

You'll have to install nVidia's Cg libraries manually because Ubuntu isn't allowed to redistribute them. Go here and download the Redhat Linux RPM either x86 or x86_64 if you have amd64. Run this command to convert the redhat rpm into a .deb file. You may have to change the RPM filename if you downloaded a different version

sudo alien Cg-1.5.i386.rpm


It will take a minute to finish. Then install the new .deb file by running this command (change filename as needed)

sudo dpkg -i cg_1.5.0-15_i386.deb

STEP 3: Compile and install

Now you should have everything you need and you should be able to run the following commands in succession.

aclocal
    ./bootstrap
    ./configure
    make
    sudo checkinstall // sudo make install <- use this instead 
        sudo ldconfig


If you get any missing library errors they will probably be in the ./bootstrap or ./configure process. Just install the library its asking for and try again. Please also update this wiki with any additional packages you needed to install.

The make process could take up to 20 minutes. Read some of the tutorials on this wiki while you wait.

During the checkinstall process it detects the version as 1.2.4 repeated for around 10 lines. I like to change that to just one line.

You should be all set! Ask in the forums or IRC if you need help. Good luck.