Compiling Python-Ogre on Ubuntu 13.04

anderen2

13-08-2013 16:09:08

Well, I've just used two days now trying to compile Python-Ogre on Ubuntu 13.04 64bit, and after a bunch of hackish fixes and changes to make things work I got stuck. So this will be partly an tutorial on how to get where I got, aswell as a pledge for help with the last part. Heres what I did so far:

SEE POST BELOW THIS ONE FOR BUILD INSTRUCTIONS!
Do not use this post for instructions!

Requirements:
Installed everything from the 00-PreReqs file manually:
sudo apt-get install automake1.9 libgl1-mesa-dev libx11-dev freeglut3-dev libtool libxaw7-dev libxxf86vm-dev patch libxrandr-dev cvs libxt-dev libexpat1-dev python-dev libglew-dev jam cmake libboost-thread-dev libboost-date-time-dev scons libfreeimage-dev libfreeimage3 libzzip-dev g++ libfreetype6-dev libpcre3-dev autoconf

Installed additional requirements missing:
sudo apt-get install gcc-4.6 g++-4.6 libx11-6 libx11-dev libboost1.49-dev libboost-all-dev python-pygccxml python-py++

Got gccxml from repos instead of building it:
sudo apt-get install gccxml

Commented out line ~1899 in environment.py:
#moduleLibs = [ os.path.join(Config.PATH_LIB_hydrax, 'Hydrax')]

Replaced gcc and g++ in /usr/bin with the 4.6 versions:
cd /usr/bin; sudo mv gcc gccBCK; sudo mv g++ g++BCK; sudo cp gcc-4.6 gcc; sudo cp g++-4.6 g++

Recieved and built cg:
python python-ogre/BuildModule.py -r cg
python python-ogre/BuildModule.py -b cg


OIS:
Recieved and configured OIS:
python python-ogre/BuildModule.py -r ois
cd OIS; ./bootstrap
./configure --prefix=/usr --includedir=/usr/include


Add -lX11 under LIBS in the OIS Makefile (./Makefile) and under Demos (./Demos/Makefile) aka:
Change LIBS line to:
LIBS = $(SUBLIBS) -L/usr/lib/x86_64-linux-gnu -lX11


Added missing headers to OIS's LinuxJoyStickEvents.cpp:
#include <linux/input.h>
#include <unistd.h>


Make and install:
make; sudo make install

Ogre:
Recieve Ogrefiles:
python python-ogre/BuildModule.py -r ogre

Compile Ogre without the buildscript:
tar jxf /home/anderen2/devo2/downloads/ogre_src_v1-7-2.tar.bz2 --overwrite
mv ogre_src_v1-7-2 ogre
export CXX=g++-4.6
cd ogre; cmake . -DOGRE_INSTALL_PLUGINS_HEADERS=TRUE -DCMAKE_INSTALL_PREFIX:PATH=/usr
make; sudo make install


Python-Ogre Bindings
Here is where I stopped. I got the generation to work:
python python-ogre/BuildModule.py -g ogre --usesystem

But the compilation fails with an gigantic errorlog:
python python-ogre/BuildModule.py -c ogre --usesystem
Result in log.out: http://pastebin.com/t6Scp8tb

If I try to do it manually:
export PKG_CONFIG_PATH=/home/anderen2/ogredev/ogre2/pkgconfig/
scons -j6 PROJECTS=ogre

Result in log.out: http://pastebin.com/S6aPHFjV

Any ideas?

anderen2

03-09-2013 19:03:01

Well, I got it compiling and working in the end. Though after I did compile it, I discovered that my precompiled version already had the thing I was compiling to get (OgreTerrain), which means I just wasted 10-15 hours on nothing. But well, here's how I compiled it, if anyone else is struggeling aswell:

NB: This should be done on an clean system! If you have tried to compile it before, remove everything before doing anything else.

Get dependencies:
# Get stuff from the 00-PreReqs manually
sudo apt-get install automake1.9 libgl1-mesa-dev libx11-dev freeglut3-dev libtool libxaw7-dev libxxf86vm-dev patch libxrandr-dev cvs libxt-dev libexpat1-dev python-dev libglew-dev jam cmake libboost-thread-dev libboost-date-time-dev scons libfreeimage-dev libfreeimage3 libzzip-dev g++ libfreetype6-dev libpcre3-dev autoconf

# Get additional dependencies (See http://www.cse.unr.edu/~lagoon/index.ph ... untu_12.04)
sudo apt-get install subversion libglew1.6-dev python-yaml libglm-dev libglfw-dev libcg nvidia-cg-toolkit gccxml libboost-python-dev

#Get additional dependencies
sudo apt-get install gcc-4.6 g++-4.6 libx11-6 libx11-dev libboost1.49-dev libboost-all-dev gccxml


Replace gcc and g++ with the 4.6 versions (For some reason Ogre/OIS will not compile correctly with anything over 4.6)
cd /usr/bin; sudo mv gcc gccBCK; sudo mv g++ g++BCK; sudo cp gcc-4.6 gcc; sudo cp g++-4.6 g++

Build additonal dependencies
These dependencies exsist in the repo, but the repo ones are not compatible with the buildscript for python-ogre

Recieve pyplusplus:
python python-ogre/BuildModule.py -r pyplusplus

Build pyplusplus
python python-ogre/BuildModule.py -b pyplusplus --usesystem

Recieve pygccxml
python python-ogre/BuildModule.py -r pygccxml

Build pygccxml
python python-ogre/BuildModule.py -b pygccxml

OIS:

Recieve and configure OIS:
python python-ogre/BuildModule.py -r ois
cd OIS; ./bootstrap
./configure --prefix=/usr --includedir=/usr/include


Fix error in OIS Makefile (ois/demos/Makefile):
#Change LIBS line to:
LIBS = $(SUBLIBS) -L/usr/lib/x86_64-linux-gnu -lX11


Add missing headers to OIS (ois/src/linux/LinuxJoyStickEvents.cpp):
#include <linux/input.h>
#include <unistd.h>


Make and install OIS:
make; sudo make install

Ogre:
Recieve Ogrefiles:
python python-ogre/BuildModule.py -r ogre

Compile Ogre without the buildscript:
cd downloads
tar jxf /home/anderen2/devo2/downloads/ogre_src_v1-7-2.tar.bz2 --overwrite
mv ogre_src_v1-7-2 ogre
export CXX=g++-4.6
cd ogre; cmake . -DOGRE_INSTALL_PLUGINS_HEADERS=TRUE -DCMAKE_INSTALL_PREFIX:PATH=/usr
make; sudo make install


Python-Ogre Bindings
Generate the wrapper code for Ogre
python python-ogre/BuildModule.py -g ogre --usesystem

Compile (NB: Takes a long time! Check for hangs/activity with ex. top)
python python-ogre/BuildModule.py -c ogre --usesystem

Generate wrapper code for OIS
python python-ogre/BuildModule.py -g ois --usesystem

Compile OIS
python python-ogre/BuildModule.py -c ois --usesystem

Install the python-ogre wrapper
python python-ogre/BuildModule.py -b install --usesystem

I successfully built this with Ubuntu Server 13.04 (raring) [with xorg] on VirtualBox

dermont

04-09-2013 16:56:49

Surely someone else has built python-ogre on a 64 bit machine?

How much memory do you have? How may cores? What is your default version of gcc (why are you not using that)? You can switch between version of gcc with sudo update-alternatives --config gcc.

Let's start with the Ogre installation, what does the following show when run from a terminal.

>> pkg-config --cflags --libs --modversion OGRE
>> ldd /usr/lib/*OgreMain.so


Try updating the SConsruct file, reduce -j 6 to -j 3 and rerun scons as per your 2nd attempt (manual run).

# Stores signatures in a separate .sconsign file
# in each directory as the single one was getting huge
_env.SConsignFile(os.path.join( cls.generated_dir, "sconsign") )
----> _env['CXX'] ="g++ -O3 -Wno-deprecated -DBOOST_PYTHON_MAX_ARITY=19 -DBOOST_PYTHON_NO_PY_SIGNATURES "

anderen2

04-09-2013 19:22:51

Surely someone else has built python-ogre on a 64 bit machine?

How much memory do you have? How may cores? What is your default version of gcc (why are you not using that)? You can switch between version of gcc with sudo update-alternatives --config gcc.

Let's start with the Ogre installation, what does the following show when run from a terminal.

>> pkg-config --cflags --libs --modversion OGRE
>> ldd /usr/lib/*OgreMain.so


Try updating the SConsruct file, reduce -j 6 to -j 3 and rerun scons as per your 2nd attempt (manual run).

# Stores signatures in a separate .sconsign file
# in each directory as the single one was getting huge
_env.SConsignFile(os.path.join( cls.generated_dir, "sconsign") )
----> _env['CXX'] ="g++ -O3 -Wno-deprecated -DBOOST_PYTHON_MAX_ARITY=19 -DBOOST_PYTHON_NO_PY_SIGNATURES "


I got it compiling eventually, and posted an update to this thread yesterday, its just waiting for approval by an admin for it to be posted...

dermont

05-09-2013 02:38:34

Ok, glad you resolved your issues.

dabhand

11-12-2013 22:17:21

hi

I'm cross posting with the Google group but maybe someone here can help.

It seems there is a linker problem but I'm not sure how to fix it not really being familiar with CMake.
I should mention this is 13.10

The problem:
When I try to run:

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

or

sudo python python-ogre/BuildModule.py -b ogre --usesystem

The build fails when it tries to build the Sample Browser (log below)

I assume I need to modify a Makefile to do the linking but I don't know enough about CMake to fix it. Does anyone have any ideas?



log.out:


  1. 12-11 18:13 PythonOgre.BuildModule INFO Build Command tar jxf /home/david/development/downloads/ogre_src_v1-7-2.tar.bz2 --overwrite
    12-11 18:13 PythonOgre.BuildModule DEBUG Spawning 'tar jxf /home/david/development/downloads/ogre_src_v1-7-2.tar.bz2 --overwrite' in '/home/david/development'
    12-11 18:13 PythonOgre.BuildModule INFO Build Command mv ogre_src_v1-7-2 ogre
    12-11 18:13 PythonOgre.BuildModule DEBUG Spawning 'mv ogre_src_v1-7-2 ogre' in '/home/david/development'
    12-11 18:13 PythonOgre.BuildModule WARNING Task Failed
    12-11 18:13 PythonOgre.BuildModule DEBUG
    12-11 18:13 PythonOgre.BuildModule DEBUG mv: cannot move ‘ogre_src_v1-7-2’ to ‘ogre/ogre_src_v1-7-2’: Directory not empty

    12-11 18:13 PythonOgre.BuildModule INFO Build Command cmake . -DOGRE_INSTALL_PLUGINS_HEADERS=TRUE -DCMAKE_INSTALL_PREFIX:PATH=/usr
    12-11 18:13 PythonOgre.BuildModule DEBUG Spawning 'cmake . -DOGRE_INSTALL_PLUGINS_HEADERS=TRUE -DCMAKE_INSTALL_PREFIX:PATH=/usr' in 'ogre'
    12-11 18:13 PythonOgre.BuildModule INFO Build Command make
    12-11 18:13 PythonOgre.BuildModule DEBUG Spawning 'make' in 'ogre'
    12-11 18:13 PythonOgre.BuildModule WARNING Task Failed
    12-11 18:13 PythonOgre.BuildModule DEBUG [ 43%] Built target OgreMain
    [ 57%] Built target RenderSystem_GL
    [ 60%] Built target Plugin_OctreeSceneManager
    [ 62%] Built target Plugin_BSPSceneManager
    [ 63%] Built target Plugin_CgProgramManager
    [ 68%] Built target Plugin_ParticleFX
    [ 71%] Built target Plugin_PCZSceneManager
    [ 74%] Built target Plugin_OctreeZone
    [ 76%] Built target OgrePaging
    [ 76%] Built target OgreProperty
    [ 78%] Built target OgreTerrain
    [ 85%] Built target OgreRTShaderSystem
    [ 85%] Built target Sample_BezierPatch
    [ 85%] Built target Sample_CameraTrack
    [ 86%] Built target Sample_Character
    [ 86%] Built target Sample_Compositor
    [ 86%] Built target Sample_FacialAnimation
    [ 86%] Built target Sample_Grass
    [ 86%] Built target Sample_Instancing
    [ 86%] Built target Sample_Lighting
    [ 87%] Built target Sample_Ocean
    [ 87%] Built target Sample_ParticleFX
    [ 87%] Built target Sample_ShaderSystem
    [ 87%] Built target Sample_Shadows
    [ 87%] Built target Sample_SkeletalAnimation
    [ 88%] Built target Sample_SkyBox
    [ 88%] Built target Sample_SkyDome
    [ 88%] Built target Sample_SkyPlane
    [ 88%] Built target Sample_Smoke
    [ 89%] Built target Sample_SphereMapping
    [ 89%] Built target Sample_Terrain
    [ 89%] Built target Sample_TextureFX
    [ 89%] Built target Sample_Transparency
    [ 90%] Built target Sample_VolumeTex
    [ 91%] Built target Sample_Water
    [ 92%] Built target Sample_BSP
    [ 92%] Built target Sample_CelShading
    [ 95%] Built target Sample_DeferredShading
    [ 95%] Built target Sample_CubeMapping
    [ 95%] Built target Sample_Dot3Bump
    [ 96%] Built target Sample_DynTex
    [ 96%] Built target Sample_Fresnel
    [ 97%] Built target Sample_Isosurf
    [ 98%] Built target Sample_ParticleGS
    Linking CXX executable ../../bin/SampleBrowser

    12-11 18:13 PythonOgre.BuildModule DEBUG CMakeFiles/SampleBrowser.dir/src/SampleBrowser.cpp.o: In function `thread_exception':
    /usr/include/boost/thread/exceptions.hpp:51: undefined reference to `boost::system::system_category()'
    CMakeFiles/SampleBrowser.dir/src/SampleBrowser.cpp.o: In function `__static_initialization_and_destruction_0':
    /usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
    /usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
    /usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
    CMakeFiles/SampleBrowser.dir/src/FileSystemLayerImpl_Unix.cpp.o: In function `__static_initialization_and_destruction_0':
    /usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
    /usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
    /usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::this_thread::interruption_point()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::thread::native_handle()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::detail::get_tss_data(void const*)'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::this_thread::disable_interruption::~disable_interruption()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `typeinfo for boost::detail::thread_data_base'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::detail::get_current_thread_data()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::thread::detach()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::thread::hardware_concurrency()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::thread::join_noexcept()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::thread::start_thread_noexcept()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `vtable for boost::detail::thread_data_base'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::this_thread::disable_interruption::disable_interruption()'
    collect2: ld returned 1 exit status
    make[2]: *** [bin/SampleBrowser] Error 1
    make[1]: *** [Samples/Browser/CMakeFiles/SampleBrowser.dir/all] Error 2
    make: *** [all] Error 2

    12-11 18:13 PythonOgre.BuildModule INFO Build Command sudo make install
    12-11 18:13 PythonOgre.BuildModule DEBUG Spawning 'sudo make install' in 'ogre'
    12-11 18:13 PythonOgre.BuildModule WARNING Task Failed
    12-11 18:13 PythonOgre.BuildModule DEBUG [ 43%] Built target OgreMain
    [ 57%] Built target RenderSystem_GL
    [ 60%] Built target Plugin_OctreeSceneManager
    [ 62%] Built target Plugin_BSPSceneManager
    [ 63%] Built target Plugin_CgProgramManager
    [ 68%] Built target Plugin_ParticleFX
    [ 71%] Built target Plugin_PCZSceneManager
    [ 74%] Built target Plugin_OctreeZone
    [ 76%] Built target OgrePaging
    [ 76%] Built target OgreProperty
    [ 78%] Built target OgreTerrain
    [ 85%] Built target OgreRTShaderSystem
    [ 85%] Built target Sample_BezierPatch
    [ 85%] Built target Sample_CameraTrack
    [ 86%] Built target Sample_Character
    [ 86%] Built target Sample_Compositor
    [ 86%] Built target Sample_FacialAnimation
    [ 86%] Built target Sample_Grass
    [ 86%] Built target Sample_Instancing
    [ 86%] Built target Sample_Lighting
    [ 87%] Built target Sample_Ocean
    [ 87%] Built target Sample_ParticleFX
    [ 87%] Built target Sample_ShaderSystem
    [ 87%] Built target Sample_Shadows
    [ 87%] Built target Sample_SkeletalAnimation
    [ 88%] Built target Sample_SkyBox
    [ 88%] Built target Sample_SkyDome
    [ 88%] Built target Sample_SkyPlane
    [ 88%] Built target Sample_Smoke
    [ 89%] Built target Sample_SphereMapping
    [ 89%] Built target Sample_Terrain
    [ 89%] Built target Sample_TextureFX
    [ 89%] Built target Sample_Transparency
    [ 90%] Built target Sample_VolumeTex
    [ 91%] Built target Sample_Water
    [ 92%] Built target Sample_BSP
    [ 92%] Built target Sample_CelShading
    [ 95%] Built target Sample_DeferredShading
    [ 95%] Built target Sample_CubeMapping
    [ 95%] Built target Sample_Dot3Bump
    [ 96%] Built target Sample_DynTex
    [ 96%] Built target Sample_Fresnel
    [ 97%] Built target Sample_Isosurf
    [ 98%] Built target Sample_ParticleGS
    Linking CXX executable ../../bin/SampleBrowser

    12-11 18:13 PythonOgre.BuildModule DEBUG CMakeFiles/SampleBrowser.dir/src/SampleBrowser.cpp.o: In function `thread_exception':
    /usr/include/boost/thread/exceptions.hpp:51: undefined reference to `boost::system::system_category()'
    CMakeFiles/SampleBrowser.dir/src/SampleBrowser.cpp.o: In function `__static_initialization_and_destruction_0':
    /usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
    /usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
    /usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
    CMakeFiles/SampleBrowser.dir/src/FileSystemLayerImpl_Unix.cpp.o: In function `__static_initialization_and_destruction_0':
    /usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
    /usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
    /usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::this_thread::interruption_point()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::thread::native_handle()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::detail::get_tss_data(void const*)'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::this_thread::disable_interruption::~disable_interruption()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `typeinfo for boost::detail::thread_data_base'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::detail::get_current_thread_data()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::thread::detach()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::thread::hardware_concurrency()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::thread::join_noexcept()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::thread::start_thread_noexcept()'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `vtable for boost::detail::thread_data_base'
    ../../lib/libOgreMain.so.1.7.2: undefined reference to `boost::this_thread::disable_interruption::disable_interruption()'
    collect2: ld returned 1 exit status
    make[2]: *** [bin/SampleBrowser] Error 1
    make[1]: *** [Samples/Browser/CMakeFiles/SampleBrowser.dir/all] Error 2
    make: *** [all] Error 2
    [/list:u]

dabhand

12-12-2013 10:40:41

After some discussion on the Google group the trick was to go into CMakeCache.txt in the ogre root directory which is where the compiler is set and change it from c++ to gcc.