Ionflux
10-11-2007 23:31:58
Hi,
I recently attempted to build python-ogre from source on a Gentoo x84_64 system, actually with at least some success
, and I thought I would share my experiences.
I decided to stick to the build scripts from svn as much as possible, but I had to edit or repeat certain steps because of problems. I will probably try to repeat it from a clean tree some time.
I first checked out the build scripts from svn, then copied them into the build directory.
General notes:
I recently attempted to build python-ogre from source on a Gentoo x84_64 system, actually with at least some success

I decided to stick to the build scripts from svn as much as possible, but I had to edit or repeat certain steps because of problems. I will probably try to repeat it from a clean tree some time.
I first checked out the build scripts from svn, then copied them into the build directory.
General notes:
- The scripts continue to run even if there is an error. This caused some confusion in later stages. I think it would be much better if the scripts would abort on an error.[/*:m][/list:u]
1) 00-PreReqs.sh (skipped)- On my Gentoo system, most of the dependencies were already installed. I only had to install celementtree.[/*:m][/list:u]
2) 01-RetrieveSource.sh- gccxml checkout failed (cvs: invalid option -- D). This can be fixed by moving the -D option after the 'co' command, which also seems to be the correct syntax according to the man pages.[/*:m][/list:u]
3) 02-ExtractAndPatch.sh
There was some trouble with missing downloaded files (for one reason or other), otherwise it worked OK. I manually downloaded the missing files.
4) 03-BuildTools.sh
No problems here.
5) 04-BuildBaseLibs.sh
- CEGUI configure failed with:
configure: error:
*** [Gentoo] sanity check failed! ***
*** libtool.m4 and ltmain.sh have a version mismatch! ***
*** (libtool.m4 = 1.5.24, ltmain.sh = 1.5.22) ***
Please run:
libtoolize --copy --force
if appropriate, please contact the maintainer of this
package (or your distribution) for help.
I tried running the command and retrying, then got this error:/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lCEGUIBase
collect2: ld returned 1 exit status
make[2]: *** [libCEGUIExpatParser.la] Fehler 1
make[1]: *** [all-recursive] Fehler 1
make: *** [all-recursive] Fehler 1
I ultimately succeeded in building CEGUI using the vanilla sources without the patch and just the configure.[/*:m][/list:u]
6) 05-BuildAdditionalLibs.sh- Ogreode make failed:
OgreOdeBody.cpp: In member function 'OgreOde::Joint* OgreOde::Body::getJoint(int)':
OgreOdeBody.cpp:523: error: cast from 'dxJoint*' to 'unsigned int' loses precision
OgreOdeBody.cpp: In destructor 'virtual OgreOde::Body::~Body()':
OgreOdeBody.cpp:720: error: cast from 'dxBody*' to 'unsigned int' loses precision
make[2]: *** [OgreOdeBody.lo] Fehler 1
make[2]: *** Warte auf noch nicht beendete Prozesse...
g++ -DHAVE_CONFIG_H -I. -I.. -DOGRE_GUI_GLX -DOGRE_CONFIG_LITTLE_ENDIAN -I/mnt/sys01/home/ionflux/src/python-ogre/root/usr/include -I/mnt/sys01/home/ionflux/src/python-ogre/root/usr/include/OGRE -I../include -I/mnt/sys01/home/ionflux/src/python-ogre/root/usr/include -L/mnt/sys01/home/ionflux/src/python-ogre/root/usr/lib -MT OgreOdeCollision.lo -MD -MP -MF .deps/OgreOdeCollision.Tpo -c OgreOdeCollision.cpp -o OgreOdeCollision.o >/dev/null 2>&1
mv -f .deps/OgreOdeCollision.Tpo .deps/OgreOdeCollision.Plo
make[2]: Leaving directory `/mnt/sys01/home/ionflux/src/python-ogre/ogreaddons/ogreode/src'
make[1]: *** [all-recursive] Fehler 1
make[1]: Leaving directory `/mnt/sys01/home/ionflux/src/python-ogre/ogreaddons/ogreode'
make: *** [all] Fehler 2
According to this thread, the problem can be fixed by replacing some casts to 'unsigned int' with casts to 'unsigned long'. Here is a (quick and dirty) patch with all the changes. With this patch, the build works for me.
There were also some issues when installing the demos. I had to remove '.libs' from the paths in the Makefile.am files of the demo source directories since the binaries were not placed into .libs for some reason.[/*:m][/list:u]
7) 06-GenerateCode.sh- At first, this script did not work at all because it could not find the pyplusplus module. I fixed it by replacing
export PYTHONPATH=$PREFIX/lib/python$PYTHONVERSION/site-packages
withexport PYTHONPATH=$PREFIX/lib64/python$PYTHONVERSION/site-packages
in the file config.sh (in the directory where the build scripts are placed).[/*:m]
- Creating forests code failed because code_generators/forests is missing. I have no idea what to do about it.[/*:m][/list:u]
8 ) 07-BuildModules.sh- The SCons.Script module was not found. I fixed it by adding
$PREFIX/lib64/scons-0.97.0d20070918
to the PYTHONPATH in config.sh.[/*:m]
- Building bullet failed:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/sys01/home/ionflux/src/python-ogre/root/usr/lib/libLibBulletCollision.a(btAxisSweep3.o): relocation R_X86_64_32S against `vtable for btAxisSweep3' can not be used when making a shared object; recompile with -fPIC
/mnt/sys01/home/ionflux/src/python-ogre/root/usr/lib/libLibBulletCollision.a: could not read symbols: Bad value
I fixed this by addingSET(CMAKE_C_FLAGS "-fPIC")
in CMakeList.txt of bullet and rebuilding bullet.[/*:m]
SET(CMAKE_CXX_FLAGS "-fPIC")
- ogrenewt failed to build because of an incompatible libNewton.a. I do not think there is much to do about it (seeing as how it cannot be built from source anyway) and decide to just skip Newton for now.[/*:m]
- Building the ode wrappers causes a swap-of-death when compiling
g++ -o build_dir_2.5/ode_0.9/_ode__free_functions.pypp.os -c `pkg-config --cflags OGRE` -I -O2 -I./ -fPIC -I/mnt/sys01/home/ionflux/src/python-ogre/root/usr/include/boost-1_34 -I/mnt/sys01/home/ionflux/src/python-ogre/root/usr/include/ode -I/mnt/sys01/home/ionflux/src/python-ogre/ode-0.9/OPCODE -I/usr/include/python2.5 -I/mnt/sys01/home/ionflux/src/python-ogre/root/usr/include/boost-1_34 generated/ode_0.9/_ode__free_functions.pypp.cpp
. This is sometimes caused by too high an optimization setting, but even going back to -O1 did not fix it. So I have to skip ode as well for now.[/*:m][/list:u]
9) Testing- Most of the OGRE examples segfault at first. I fixed this by replacing
windowHnd = self.renderWindow.getCustomAttributeInt("WINDOW")
withwindowHnd = self.renderWindow.getCustomAttributeUnsignedLong("WINDOW")
in ogre/renderer/OGRE/sf_OIS.py[/*:m]
- I set PYTHONPATH and LD_LIBRARY_PATH to the appropriate locations in order to run the demos. I also changed the plugin path in plugins.cfg. I seems this should be handled by PythonOgreConfig.py, but it didn't work for me and I just lost my patience and went with updating the environment variables.
[/*:m]
- Examples which I have tested, with results:
- ogre/Demo_BSP, ogre/Demo_CameraTracking, ogre/Demo_CellShading, ogre/Demo_EnvMap, ogre/Demo_Facial, ogre/Demo_Lighting, ogre/Demo_NodeListener, ogre/Demo_OneFish, ogre/Demo_ParticleFX, ogre/Demo_SkeletonAnimation, ogre/Demo_SkyBox, ogre/Demo_SkyDome, ogre/Demo_SkyPlane, ogre/Demo_Smoke, ogre/Demo_Terrain, ogre/Demo_TextureFX, ogre/Demo_Transparency, cegui/Demo_CEGUI_Gui, cegui/Demo_CEGUI_NewGui, cegui/Demo_CEGUI_Facial, cegui/Demo_CEGUI_DragnDrop: Works fine.
[/*:m]
- ogre/Demo_Basic: Fails with:
python: ../../../OgreMain/include/OgreSingleton.h:66: Ogre::Singleton<T>::Singleton() [with T = Ogre::BspResourceManager]: Assertion `!ms_Singleton' failed.
[/*:m]
Aborted (core dumped)
- ogre/Demo_Bezier: Works, but with an error on exit:
Exception exceptions.AttributeError: "'NoneType' object has no attribute 'Application'" in <bound method BezierApplication.__del__ of <__main__.BezierApplication object at 0x11b4410>> ignored
[/*:m]
pure virtual method called
terminate called without an active exception
Aborted (core dumped)
- ogre/Demo_Compositor: Starts up OK after I replace the line
windowHnd = self.mMain.getRenderWindow().getCustomAttributeInt("WINDOW")
withwindowHnd = self.mMain.getRenderWindow().getCustomAttributeUnsignedLong("WINDOW")
in CompositorDemo_FrameListener.py.
There are several issues with missing namespace prefixes (CEGUI), which I did not have the patience to sort out all of them. I suspect the demo would work fine if these issues were addressed.[/*:m]
- ogre/Demo_Fresnel: Works OK, but segfaults on exit:
Exception exceptions.AttributeError: 'rendtargetlistener' in <bound method FresnelApplication.__del__ of <__main__.FresnelApplication object at 0x11f66d0>> ignored
[/*:m]
Unregistering ResourceManager for type BspLevel
Segmentation fault (core dumped)
- ogre/Demo_Grass: Works OK, but the following error occurs on exit:
X Error of failed request: BadWindow (invalid Window parameter)
[/*:m]
Major opcode of failed request: 2 (X_ChangeWindowAttributes)
Resource id in failed request: 0x1600002
Serial number of failed request: 25
Current serial number in output stream: 28
- ogre/Demo_RendererCreate: I am not sure what the demo is supposed to do. I just get a black window.[/*:m]
- ogre/Demo_RenderToTexture: Works OK, but segfaults on exit:
Exception exceptions.AttributeError: 'soundManager' in <bound method RenderToTextureApplication.__del__ of <__main__.RenderToTextureApplication object at 0x11ac788>> ignored
[/*:m]
Unregistering ResourceManager for type BspLevel
Segmentation fault (core dumped)
- ogre/Demo_Shadows: Fails with
Traceback (most recent call last):
[/*:m]
File "Demo_Shadows.py", line 1163, in <module>
sa.go()
File "/home/ionflux/src/python-ogre/root/usr/lib64/python2.5/site-packages/ogre/renderer/OGRE/sf_OIS.py", line 64, in go
self.root.startRendering()
File "Demo_Shadows.py", line 251, in frameStarted
self.Mouse.capture()
File "Demo_Shadows.py", line 302, in mouseMoved
CEGUI.System.getSingleton().injectMouseWheelChange(e.get_state().Z.rel)
File "Demo_Shadows.py", line 407, in handleMouseWheelEvent
self.mTranslateVector.z += e.wheelChange * -5.0
AttributeError: 'ShadowsListener' object has no attribute 'mTranslateVector'
- ogre/Demo_Shadows_Org: Starts up OK, I also can switch shadow modes, but at some point I got this after pressing 'o':
Traceback (most recent call last):
[/*:m]
File "Demo_Shadows_Org.py", line 557, in <module>
application.go()
File "/home/ionflux/src/python-ogre/root/usr/lib64/python2.5/site-packages/ogre/renderer/OGRE/sf_OIS.py", line 64, in go
self.root.startRendering()
File "Demo_Shadows_Org.py", line 348, in frameEnded
self.CheckKeyPressed(KC_O, 1, self.changeShadowTechnique)
File "Demo_Shadows_Org.py", line 338, in CheckKeyPressed
func()
File "Demo_Shadows_Org.py", line 316, in changeShadowTechnique
shadowTex = shadowTex.getByName(name="ogre/ShadowTexture0") ## returns a None object
Boost.Python.ArgumentError: Python argument types in
ResourceManager.getByName(TextureManager)
did not match C++ signature:
getByName(Ogre::ResourceManager {lvalue}, std::string)
- ogre/Demo_SkeletalAnimation: Works OK, but the X error (see above) occurs on exit.[/*:m]
- ogre/Demo_Spinner: Works fine after fixing the window handle issue (see above).[/*:m]
- ogre/Demo_Video: This demo is missing the ogre.video module. I am not sure what needs to be built to get this module.[/*:m]
- ogre/Demo_Water: Fails with exception:
Traceback (most recent call last):
(Looks like another 64-bit types issue to me.)[/*:m]
File "Demo_Water.py", line 622, in <module>
application.go()
File "/home/ionflux/src/python-ogre/root/usr/lib64/python2.5/site-packages/ogre/renderer/OGRE/sf_OIS.py", line 60, in go
if not self._setUp():
File "/home/ionflux/src/python-ogre/root/usr/lib64/python2.5/site-packages/ogre/renderer/OGRE/sf_OIS.py", line 101, in _setUp
self._createScene()
File "Demo_Water.py", line 542, in _createScene
self.WaterMesh = WaterMesh.WaterMesh(MESH_NAME, PLANE_SIZE, COMPLEXITY)
File "/mnt/sys01/home/ionflux/src/python-ogre/python-ogre/demos/ogre/WaterMesh.py", line 98, in __init__
True) ## true?
Boost.Python.ArgumentError: Python argument types in
HardwareVertexBuffer.writeData(HardwareVertexBuffer, int, int, int, bool)
did not match C++ signature:
writeData(Ogre::SharedPtr<HardwareVertexBuffer_wrapper> {lvalue}, unsigned long, unsigned long, void const*, bool)
writeData(Ogre::HardwareVertexBuffer {lvalue}, unsigned long offset, unsigned long length, void const* pSource, bool discardWholeBuffer=False)
- ogre/Demo_WX: Segfaults:
(python:17283): Gdk-WARNING **: gdkdrawable-x11.c:878 drawable is not a pixmap or window
GLRenderSystem::createRenderWindow "wxPython render window", 640x480 windowed miscParams: externalWindowHandle=0
GLXWindow::create
Parsing miscParams
Segmentation fault (core dumped)
If this is the window handle problem again, I did not find the appropriate line of code.[/*:m][/list:u][/*:m][/list:u]
I would have liked to test at least one of the physics frameworks as well but I do not seem to have one that has a completely successful installation. ODE and Newton do not work for reasons explained above, and bullet seems to be missing libLibBulletMath.a (which has not been built - in fact, there seems to be no mention of it anywhere in the build files).
Remaining problems aside, I am very excited about this project. Especially since it combines the impressive power of Python and OGRE.I think I will do some experiments of my own soon.
Thanks for the work!
- ogre/Demo_BSP, ogre/Demo_CameraTracking, ogre/Demo_CellShading, ogre/Demo_EnvMap, ogre/Demo_Facial, ogre/Demo_Lighting, ogre/Demo_NodeListener, ogre/Demo_OneFish, ogre/Demo_ParticleFX, ogre/Demo_SkeletonAnimation, ogre/Demo_SkyBox, ogre/Demo_SkyDome, ogre/Demo_SkyPlane, ogre/Demo_Smoke, ogre/Demo_Terrain, ogre/Demo_TextureFX, ogre/Demo_Transparency, cegui/Demo_CEGUI_Gui, cegui/Demo_CEGUI_NewGui, cegui/Demo_CEGUI_Facial, cegui/Demo_CEGUI_DragnDrop: Works fine.
- Most of the OGRE examples segfault at first. I fixed this by replacing
- The SCons.Script module was not found. I fixed it by adding
- At first, this script did not work at all because it could not find the pyplusplus module. I fixed it by replacing
- Ogreode make failed:
- CEGUI configure failed with:
- gccxml checkout failed (cvs: invalid option -- D). This can be fixed by moving the -D option after the 'co' command, which also seems to be the correct syntax according to the man pages.[/*:m][/list:u]
- On my Gentoo system, most of the dependencies were already installed. I only had to install celementtree.[/*:m][/list:u]