LinuxBuildV4

From PyWiki

Jump to: navigation, search

Contents

Introduction

Building Python-Ogre under Linux (tested with Debian unstable as of Feb 18 2010) is a straight forward, if slightly lengthy process. However please don't expect it to be a classic UNIX (untar, configure, make) build cycle as it's not. Python-Ogre is different in that it needs to build the underlying C/C++ libraries then create and compile the wrapper code. However all is not lost as there is a fairly simple build script and configuration that handles most of the complexity.

We use a single build script (BuildModule.py) that can retrieve, build, generate wrapper code and compile the Python-Ogre modules (do a -h for more info or look at the script). It basically reads a set of commands from the environment.py script and executes them. By default all the logging is to log.out so if you have any problems have a look there.

Step 1

If you are running Debian or Ubuntu, make the directory to which you want to install Ogre, navigate there, and run this script. Run it by typing sh /<path to where you saved it>/Ogre.sh. This will download and install everything needed. It requires root access and will ask for it when needed.

Alternatively, you can follow the instructions below. The end result is the same. A word of caution, some steps can take several hours for the compile to run.


You will need to have subversion (svn) installed.

This can be done on Debian or Ubuntu by:

sudo apt-get install subversion

This can be done on SUSE by:

sudo zypper install subversion


On to our Python-Ogre install by creating a master development directory somewhere suitable (under your home directory is a good place) and checkout Python-Ogre from the SVN.

cd ~
mkdir development
cd development
svn co https://python-ogre.svn.sourceforge.net/svnroot/python-ogre/branches/v1-6-4 python-ogre

NOTE: If you want the latest OGRE support (1.7.2) then grab the SVN trunk - replace the above SVN command with this one

svn co https://python-ogre.svn.sourceforge.net/svnroot/python-ogre/trunk/python-ogre python-ogre

Ensure you have the necessary prerequisites installed. Note if you are running a non Debian Linux (one with out apt-get) then you'll have to look at the script and work out for yourself that you have what is needed.

ln -s python-ogre/scripts/00-PreReqs.sh .
sh ./00-PreReqs.sh

Note: By default we no longer install python-clementtree <TO FIX?>.

Step 2

Retrieve the support libraries.

python python-ogre/BuildModule.py -r cg pygccxml gccxml
python python-ogre/BuildModule.py -r pyplusplus

All the source files will have been placed in the ./downloads directory (or in ./gccxml and ./pygccxml as these are cvs/svn retrieves)

Step 3

Build the support libraries. Note we are using the --usesystem command to put all the libraries in the /usr area to make life easier. This is optional and may be omitted if, for example, you're trying to build this experimentally and don't want to clutter up your /usr directory with the result.

python python-ogre/BuildModule.py -b gccxml pygccxml cg pyplusplus boost_python --usesystem

Any errors will be written to log.out so have a look there if there is an issue. If a single module fails you can run it individually to test again..

python python-ogre/BuildModule.py -b <<modulename>> --usesystem

Step 4

Download and build the base Ogre libraries

Note: This step takes an incredibly long amount of time. The script isn't freezing, although if you waited a week it probably did freeze.

python python-ogre/BuildModule.py -r ois ogre 
python python-ogre/BuildModule.py -b ois ogre  --usesystem

Again if there are problems the errors will be in log.out and you can try to build the modules individually and/or do seperate retrieve(-r) and build(-b) steps.

At this point you can run the Ogre C++ samples. Note that if you built without --usesystem, you'll need to tell Ogre where your libraries are with something like this:
export LD_LIBRARY_PATH=~/development/root/usr/lib/

The sample browser application can be started like this.

cd ~/development/ogre/bin
./SampleBrowser

Step 5

Generate the wrapper code(-g), compile(-c) and install it - Ensure ogre is generated before any other module !

cd ~/development
python python-ogre/BuildModule.py -g -c ogre --usesystem
python python-ogre/BuildModule.py -g -c ois  --usesystem
python python-ogre/BuildModule.py -b install  --usesystem

Testing

You can now run the Python-Ogre demos. Note that if you built without --usesystem, you'll need to first do something like this:

export LD_LIBRARY_PATH=~/development/root/usr/lib/
export PYTHONPATH="/home/$USER/development/root/usr/lib/python2.5/site-packages:"

NOTE: The demos will look for a plugins.cfg file in the ./demo directory first, and if that isn't found it looks in the local directory. So if there is a plugins.cfg in ./python-ogre/demos you need to edit it to point to the correct path, otherwise edit the one in the ./python-ogre/demos/ogre directory. The intention of this is to allow a single plugins file (located in the ./demos parent directory) to be used by all the demos.

cd ./python-ogre/demos/ogre
python Demo_Grass.py

If you got an error that looks something like this:

OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library /home/andy/development/root/usr/lib/OGRE/RenderSystem_GL.
System Error: /home/andy/development/root/usr/lib/OGRE/RenderSystem_GL.so: cannot open shared object file:
No such file or directory in DynLib::load at /home/steve/dev/sim/src171/ogre/OgreMain/src/OgreDynLib.cpp (line 91)

That means you need to edit your plugins.cfg file to reflect the proper path on your system.

Config Notes

Building Additional Modules

There are many (nearly 20 at time of writing) Python-Ogre modules that can be built -- and the build procedure is the same for all of them. 1. Retrieve the source - Note: You must be in the 'development' directory (one above python-ogre) when running this script. Of course you can do one module at a time and you can combine the retrieve/build/generate/compile into a single step.

cd ~/development
python python-ogre/BuildModule.py -r ode ogreode newton ogrenewt ogreal bullet

2. Build the underlying C libraries

cd ~/development
python python-ogre/BuildModule.py -b ode ogreode newton ogrenewt ogreal bullet

3. Generate the wrapper code

cd ~/development
python python-ogre/BuildModule.py -g ode ogreode newton ogrenewt ogreal bullet

4. Compile the wrapper code to make the python module

cd ~/development
python python-ogre/BuildModule.py -c ode ogreode newton ogrenewt ogreal bullet

5. And install the modules:

cd ~/development
python python-ogre/BuildModule.py -b install

Available modules

ModuleList

It Didn't Work -- What Now?

Gentoo ebuilds

WARNING: These ebuilds change your system libraries and currently only cover the wrappers for ogre, ois, and newton.

Ebuilds for a portage overlay: http://www.ofai.at/~stefan.rank/repos/python-ogre-portage-overlay.zip ( darcs repo: http://www.ofai.at/~stefan.rank/repos/python-ogre-portage-overlay/ ). For more information, see the txt file in the repo. The ebuilds in the overlay are: (suffix -9999 means source directly from version control and _p99 indicates patched packages)

dev-games/python-ogre-9999 (svn) (builds the ogre and ois modules)
- dev-games/ogre-1.4.7_p99 (gentoo version + freeimage support + python-ogre specific patch)
  USE="cegui cg freeimage -devil -gtk -threads"
  (automatic dependencies: cegui, cg, freeimage, zzlib, ois)
- dev-python/py++-9999 (svn)
  - dev-python/pygccxml-9999 (svn)
    - dev-cpp/gccxml-9999 (cvs)
  - dev-libs/boost-1.34.1_p99 (gentoo version + patch, bjam (boost-build) is automatically used)
dev-games/python-ogre-ogrenewt-9999 (svn)
- dev-games/python-ogre-9999 (svn)
- dev-games/ogrenewt-9999 (cvs ogreaddons + patches)
  - dev-games/newton-1.53_p99 (gentoo version + python-ogre specific patch)

Be warned that compilation, especially of python-ogre, takes a long time (the numbers are from an arguably old Athlon <1GHz):

# qlop -t python-ogre python-ogre-ogrenewt ogre py++ pygccxml gccxml ogrenewt newton boost
python-ogre: 7 hours, 53 minutes, 48 seconds for 7 merges
python-ogre-ogrenewt: 35 minutes, 13 seconds for 1 merges
ogre: 1 hour, 41 minutes, 19 seconds for 7 merges
py++: 3 minutes, 52 seconds for 3 merges
pygccxml: 2 minutes, 6 seconds for 3 merges
gccxml: 42 minutes, 36 seconds for 3 merges
ogrenewt: 5 minutes, 1 second for 4 merges
newton: 48 seconds for 2 merges
boost: 1 hour, 36 minutes, 18 seconds for 5 merges

Debian and cegui

If you get an error when building cegui (CEGUIXercesParser.cpp:233: error: incomplete type ‘xercesc_2_8::Grammar’ ) on Debian testing/unstable, adding the following line to CEGUI-0.5.0/XMLParserModules/XercesParser/CEGUIXercesParser.h (line 54) should help:

#include <xercesc/validators/schema/SchemaGrammar.hpp>

Stackless Python

If you are using Stackless python and SCons throws an exception while building stating "setting stack size not supported' you need to modify SCons job.py. Locate the __init__ in the class ThreadPool and comment out the lines where threading.stack_size() is used to explicitly set the stack size

job.py
 #try:
 #     prev_size = threading.stack_size(stack_size*1024) 
 #except AttributeError, e:
 #threading.stack_size(prev_size)
Personal tools