pyhton-ogre installation on Ubuntu 11.10 Oneiric

lucazade

20-11-2011 12:26:54

Hi!

I'm trying to install python-ogre on Ubuntu 11.10 Oneiric Ocelot, unfortunately it seems there are no precompiled .deb packages
or ppa repositories with pyogre for oneiric.

I tried to build from source following the wikiV4 guide and also using the .sh install script but without success.
The same result using the step-by-step guide for ubuntu prensent in the trunk svn repo.

what am I missing? any hints?

dermont

20-11-2011 13:46:54

You will need to tell us at what stage the build is failing, check for errors in log.out and post your errors here.

lucazade

20-11-2011 15:13:11

Ok... here is what I get if I follow the wiki guide on a fresh ubuntu installation:
wiki guide: http://wiki.python-ogre.org/index.php/LinuxBuildV4


luca@vbox:~$ sudo apt-get install subversion

luca@vbox:~$ cd ~

luca@vbox:~$ mkdir development

luca@vbox:~$ cd development

luca@vbox:~/development$ svn co https://python-ogre.svn.sourceforge.net ... hes/v1-6-4 python-ogre
... cut ...
A python-ogre/readme.txt
U python-ogre
Exctracted revision 1154.

luca@vbox:~/development$ ln -s python-ogre/scripts/00-PreReqs.sh .

luca@vbox:~/development$ sh ./00-PreReqs.sh
E: Impossible to find package libglut3-dev
E: Impossible to find package python-celementtree


Then if I purge 'python-celementtree' from 00-PreReqs.sh and switch from libglut3-dev to freeglut3-dev I can continue with installation:
luca@vbox:~/development$ sh ./00-PreReqs.sh
The following package will be installed:
autoconf automake1.9 autotools-dev cvs freeglut3 freeglut3-dev g++ g++-4.6 jam libdrm-dev libexpat1-dev libfreetype6-dev libgl1-mesa-dev libglew1.6 libglew1.6-dev libglu1-mesa-dev libice-dev libkms1 libltdl-dev libpcre3-dev libpcrecpp0 libpthread-stubs0 libpthread-stubs0-dev libsm-dev libssl-dev libssl-doc libstdc++6-4.6-dev libtool libx11-dev libxau-dev libxaw7-dev libxcb1-dev libxdmcp-dev libxext-dev libxmu-dev libxmu-headers libxpm-dev libxrandr-dev libxrender-dev libxt-dev libxxf86vm-dev m4 mesa-common-dev python-dev python2.7-dev x11proto-core-dev x11proto-input-dev x11proto-kb-dev x11proto-randr-dev x11proto-render-dev x11proto-xext-dev x11proto-xf86vidmode-dev xorg-sgml-doctools xtrans-dev zlib1g-dev

luca@vbox:~/development$ python python-ogre/BuildModule.py -r cg pygccxml gccxml
PythonOgre.BuildModule: INFO Retrieving http://developer.download.nvidia.com/cg ... 09_x86.tgz
PythonOgre.BuildModule: INFO Retrieving co http://pygccxml.svn.sourceforge.net/svn ... gccxml_dev pygccxml
PythonOgre.BuildModule: INFO Retrieving -d :pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML co -D 10Nov2009 gccxml

luca@vbox:~/development$ python python-ogre/BuildModule.py -r pyplusplus
PythonOgre.BuildModule: INFO Retrieving co http://pygccxml.svn.sourceforge.net/svn ... usplus_dev pyplusplus

luca@vbox:~/development$ python python-ogre/BuildModule.py -b gccxml pygccxml cg pyplusplus boost_python --usesystem
PythonOgre.BuildModule: INFO Build Command mkdir -p gccxml-build
PythonOgre.BuildModule: INFO Build Command cmake ../gccxml -DCMAKE_INSTALL_PREFIX:PATH=/usr
PythonOgre.BuildModule: WARNING Task Failed
PythonOgre.BuildModule: INFO Build Command make
PythonOgre.BuildModule: WARNING Task Failed
PythonOgre.BuildModule: INFO Build Command sudo make install
PythonOgre.BuildModule: WARNING Task Failed
PythonOgre.BuildModule: INFO Build Command sudo python setup.py install
PythonOgre.BuildModule: INFO Build Command sudo tar xvzf /home/luca/development/downloads/Cg-2.2_October2009_x86.tgz --overwrite
PythonOgre.BuildModule: INFO Build Command sudo python setup.py install
PythonOgre.BuildModule: INFO Build Command unzip -o /home/luca/development/python-ogre/ThirdParty/boost_python.zip
PythonOgre.BuildModule: INFO Build Command bjam -j1 release --with-python --with-thread --with-date_time --prefix=/usr
PythonOgre.BuildModule: WARNING Task Failed
PythonOgre.BuildModule: INFO Build Command echo This may take a while -- copying each include file individually!!
PythonOgre.BuildModule: INFO Build Command sudo bjam install --with-python --prefix=/usr
PythonOgre.BuildModule: WARNING Task Failed

luca@vbox:~/development$ python python-ogre/BuildModule.py -r ois ogre
PythonOgre.BuildModule: INFO Retrieving -z3 -d:pserver:anonymous@wgois.cvs.sourceforge.net:/cvsroot/wgois co -D 01Jan2009 -P ois
PythonOgre.BuildModule: INFO Retrieving http://downloads.sourceforge.net/ogre/o ... C1.tar.bz2

luca@vbox:~/development$ python python-ogre/BuildModule.py -b ois ogre --usesystem
PythonOgre.BuildModule: INFO Build Command ./bootstrap
PythonOgre.BuildModule: INFO Build Command ./configure --prefix=/usr --includedir=/usr/include
PythonOgre.BuildModule: INFO Build Command make
PythonOgre.BuildModule: INFO Build Command sudo make install
PythonOgre.BuildModule: INFO Build Command tar jxf /home/luca/development/downloads/ogre-v1-7-0RC1.tar.bz2 --overwrite
PythonOgre.BuildModule: INFO Build Command cmake . -DOGRE_INSTALL_PLUGINS_HEADERS=TRUE -DCMAKE_INSTALL_PREFIX:PATH=/usr
PythonOgre.BuildModule: WARNING Task Failed
PythonOgre.BuildModule: INFO Build Command make
PythonOgre.BuildModule: WARNING Task Failed
PythonOgre.BuildModule: INFO Build Command sudo make install
PythonOgre.BuildModule: WARNING Task Failed

luca@vbox:~/development$ python python-ogre/BuildModule.py -g -c ogre --usesystem
PythonOgre.BuildModule: INFO Building Source code for ogre
PythonOgre.BuildModule: WARNING Task Failed
PythonOgre.BuildModule: INFO Compiling Source code for ogre
PythonOgre.BuildModule: WARNING Task Failed

luca@vbox:~/development$ python python-ogre/BuildModule.py -g -c ois --usesystem
PythonOgre.BuildModule: INFO Building Source code for ois
PythonOgre.BuildModule: WARNING Task Failed
PythonOgre.BuildModule: INFO Compiling Source code for ois
PythonOgre.BuildModule: WARNING Task Failed

luca@vbox:~/development$ python python-ogre/BuildModule.py -b install --usesystem
PythonOgre.BuildModule: INFO Build Command sudo python setup.py install
PythonOgre.BuildModule: WARNING Task Failed

luca@vbox:~/development$ cd python-ogre/demos/ogre

luca@vbox:~/development/python-ogre/demos/ogre$ python Demo_Grass.py
Traceback (most recent call last):
File "Demo_Grass.py", line 32, in <module>
import ogre.renderer.OGRE as ogre
ImportError: No module named ogre.renderer.OGRE


With the previous manual fixes building seems done but the python module cannot be imported and loaded.

lucazade

21-11-2011 07:09:55

Ok.. checked log.out files and I had to install also boost and cmake to build some parts.
anyway when I pass this command:
python python-ogre/BuildModule.py -b ois ogre --usesystem

I get this error:
http://paste.ubuntu.com/744959/

(i'm following this guide: http://wiki.python-ogre.org/index.php/LinuxBuildV4 )

lucazade

21-11-2011 19:38:31

I posted 2 times but were not published because of new user policies.. any mod could post them please?

dermont

21-11-2011 20:26:33

I posted 2 times but were not published because of new user policies.. any mod could post them please?

Then post your log on http://pastebin.com/ and and just include a link here. A summary of where/what step the build is failing at would also be helpful.

lucazade

21-11-2011 20:40:07

I've posted a pastebin url :)
Unfortunately url and code tags are not allowed for new users!

dermont

22-11-2011 02:39:59

I've posted a pastebin url :)
Unfortunately url and code tags are not allowed for new users!


I think they have had a lot of problems with spam but when it gets to this stage it's just ridiculous. You would be better contacting one of the Moderators on the main forum.

There is the python-ogre developers group but I think you have to wait for activation/approval for your first posts, though even I have trouble posting there.
http://groups.google.com/group/python-ogre-developers

Anyway the link should be something like "http://pastebin.com/wffddeeg";, just post the last part of the link "wffddeeg". Hopefully that is allowed.

lucazade

22-11-2011 19:47:10

Using the SVN Trunk repo and following the WikiV4 guide, the building fails at this step:

python python-ogre/BuildModule.py -g -c ois --usesystem

paste (dot) ubuntu (dot) com (slash) 745638


instead if I use the stable branch v1-6-4 the building fails here:

python python-ogre/BuildModule.py -g -c ogre --usesystem

paste (dot) ubuntu (dot) com (slash) 746001

dermont

23-11-2011 02:44:49

Ok I think I know what could be happening here. The version of gccxml python-ogre "20091110" is really old and doesn't fully support gcc 4.6 so gccxml is probably built/fudged using the latest it does support (gcc 4.4 if IRC).

First check the version of gccxml in /usr/bin matches the one in <your-build-dir>/gccxml-build directory, i.e. has been installed properly.

Second try using the packaged version of gccxml from Ubuntu:

1) Uninstall the version of gccxml you have installed with python-ogre
cd <your-build-dir>/gccxml-build
sudo make uninstall

b) Install gccxml from Synaptic Package Manager - this appears to be more recent and should support your compiler.
OR
(gccxml from apt works for me so report back before switching to CVS)
Update the gccxml package to the latest CVS version and rebuild.

c) Repeat your -g etc. steps


There also appears to be a packaged version of pygccxml of Synaptic. I wonder if python-ogre builds with this. Let us know how you get on.

lucazade

23-11-2011 18:58:42

dermont thanks for the tips.. it seems I made some progresses but still cannot complete building :)

this is the giant log:

paste (dot) ubuntu (dot) com (slash) 747386

dermont

23-11-2011 19:27:10

From your log it looks like you have run out of memory and/or swap space during linking.
Do a google search for "ld terminated with signal 9", maybe for tips on increasing your swap space.

First check this thread, re-arranging the build command for gcc4.6 will dramatically reduce the size of the object files and size of the ogre module. I'm afraid this will mean compiling again.
viewtopic.php?f=3&t=14906

How much memory/swap space does your machine have?

lucazade

23-11-2011 19:33:54

oh well.. it is probably correct.
I'm compiling inside a virtualmachine with just a 1gb of ram to not brake my
current installation with ugly trials.

I'll try to build on a real machine then and give a look to that thread.
thanks again.. I'll let you know about results!

dermont

23-11-2011 19:51:35

oh well.. it is probably correct.
I'm compiling inside a virtualmachine with just a 1gb of ram to not brake my
current installation with ugly trials.

I'll try to build on a real machine then and give a look to that thread.
thanks again.. I'll let you know about results!


Ok, to clarify the link that I pointed you to was the first post, editing the SConstruct file to ensure the optimization flag is first:

_env['CXX'] = "g++ -O3" <----------------
## Use custom compilier if wanted (things like ccache)


Don't try implementing a unity build this will make things worse. And when you try to build on a real machine then switch to the python-ogre svn branch which uses Ogre1.7.2. The branch you are using the version of Ogre 1.7.0RC1 is old and buggy.

lucazade

24-11-2011 20:44:29

I'm trying on a real machine using trunk svn, 'g++ -O3' modification.
I'm stuck here...

python python-ogre/BuildModule.py -g -c ogre --usesystem

paste (dot) ubuntu (dot) com (slash) 748609

I've tried with gccxml from repos and from cvs but same results... :cry:

lucazade

24-11-2011 20:53:26

... purging and reinstalling gccxml from repos seems to fix this problem..

obviously it will break later, we'll see :)

lucazade

24-11-2011 22:19:12

got it! yeah :)

here are some draft notes I took for easy reinstalling on another machine,
It is necessary to fix some files, look at the comment in the following lines:

# ref. from wiki LinuxBuildV4
cd ~
mkdir development
cd development
svn co https://python-ogre.svn.sourceforge.net/svnroot/python-ogre/trunk/python-ogre python-ogre
ln -s python-ogre/scripts/00-PreReqs.sh .
# remove bjam and switch from libglut3-dev to freeglut3-dev in 00-PreReqs.sh
gedit 00-PreReqs.sh
sh ./00-PreReqs.sh
python python-ogre/BuildModule.py -r cg pygccxml gccxml
python python-ogre/BuildModule.py -r pyplusplus
# remove hydrax stuff in python-ogre/SConstruct and in python-ogre/environment.py
gedit python-ogre/SConstruct
gedit python-ogre/environment.py
python python-ogre/BuildModule.py -b gccxml pygccxml cg pyplusplus boost_python --usesystem
python python-ogre/BuildModule.py -r ois ogre
python python-ogre/BuildModule.py -b ois ogre --usesystem
# purge and reinstall gccxml from repos (tricky, don't ask me why)
sudo apt-get purge gccxml && sudo apt-get install gccxml
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

maybe the wiki should be updated with some notes or fixes.

dermont

25-11-2011 04:02:43


# remove hydrax stuff in python-ogre/SConstruct and in python-ogre/environment.py
gedit python-ogre/SConstruct
gedit python-ogre/environment.py

viewtopic.php?f=3&t=14604&p=81798&hilit=hydrax#p81798


python python-ogre/BuildModule.py -b gccxml pygccxml cg pyplusplus boost_python --usesystem
...
# purge and reinstall gccxml from repos (tricky, don't ask me why)
sudo apt-get purge gccxml && sudo apt-get install gccxml



it's because you are building the gccxml module, look at the build command for gccxml in environment.py where it installs gccxml overwriting your package version. In your case you do not need build gccxml.


buildCmds = [
[0, "mkdir -p gccxml-build", ''],
[0, "cmake ../gccxml -DCMAKE_INSTALL_PREFIX:PATH=" + PREFIX, os.path.join(os.getcwd(), 'gccxml-build')],
[0, "make", os.path.join(os.getcwd(), 'gccxml-build')],
[0, _sudo + " make install", os.path.join(os.getcwd(), 'gccxml-build')],


There are two config files for the build process:

PythonOgreConfig_system.py -- builds python-ogre against the base libs in /usr or /usr/local or the path you have declared.
PythonOgreConfig_posix.py -- builds python-ogre against the (local) base libs you have built you have built with.

Both config options are configurable, you can edit the paths to libs,gccxml etc. For example you are using PythonOgreConfig_system.py and:

a) have OIS installed from apt so you can just proceed to the the -g -c steps not need to run the (-b) build part.

b) want to run (a) manually:
$ cd <python-ogre-path>/code_generators/ogre
$ python generate_code.py --usesystem
$ cd ../..
$ scons PROJECTS=ois

Warning BuildModule.py adds an extra header include so doing the above means you will have to do a complete rebuild of the module when switching between manual and BuildModule.py.

c) you have base libraries installed in a non standard location:

- Copy PythonOgreConfig_system.py to PythonOgreConfig_lucazade.py
- Edit PythonOgreConfig_lucazade.py and edit your paths as appropriate
- set rpath:
export PKG_CONFIG_PATH=/media/sda8/Libraries/OGRE/sdk/v1-8/lib/pkgconfig
edit config file (global) RPATH or add LINKFLAGS rpath option for module in environment.py
- python python-ogre/BuildModule.py -b -g ogre (no system )

Similarly for the 00-PreReqs.sh script, if you have the latest packaged versions from apt the there is no need to run this.

The previous problem using the packaged versions of libs was with an ancient version of gccxml. If you are interested/feeling brave then it would nice to see if it builds only using/against packaged libs as a first step to getting python-ogre into the Ubuntu/Debian repositories.

lucazade

25-11-2011 07:35:38

Really thanks for the all comprehensive explanations, really useful.
I'll try to follow your advices in my next building.

I'm trying to run python-ogre because I'd like to use Ubuntu at work instead of windows,
now all ogre demos work good, I've tried SampleBrowser and it is quite fast.

The framework I use at work, which employ python-ogre, unfortunately it is still complaning
because it seems to not find the path for python-ogre module.
os.environ['OGRE_PLUGIN_PATH']

any way to set it widely?


############
this is where it dies.. maybe it is useful :)


def _ogre_bootstrap():
if Model3d._init: return True

plat_name = os.name
fullscreen = str(Config.getint('graphics','fullscreen')).lower() in ('true', '1', 'yes', 'yup')
width, height = Window.size
aa = pygame.display.gl_get_attribute(pygame.GL_MULTISAMPLESAMPLES)
try:
# disable logging.
Model3d._ogreLM = ogre.LogManager()
Model3d._ogreLM.createLog("dummy.log", True, False, True)
# load ogre core and needed plugins.
Model3d._ogreR = ogre.Root()
if os.environ.has_key('OGRE_PLUGIN_PATH'):
Model3d._ogreR.loadPlugin(join(os.environ['OGRE_PLUGIN_PATH'], 'RenderSystem_GL'))
elif exists(join(fmt_libs_dir, 'ogre', 'plugins_' + plat_name)):
Model3d._ogreR.loadPlugin(join(fmt_libs_dir, 'ogre', 'plugins_' + plat_name, 'RenderSystem_GL'))
else:
----> raise Exception('OGRE_PLUGIN_PATH not setted, can\'t load Ogre!') <-----

lucazade

25-11-2011 12:15:05

ok solved also this one..
I had to add to .bashrc some paths

export LD_LIBRARY_PATH="/home/luca/development/root/usr/lib/"
export OGRE_PLUGIN_PATH="/home/luca/development/ogre/lib"

bye bye windows :)