Build notes for python-ogre on Xubuntu Hardy with amd64

TackyParker

13-08-2008 19:49:55

Hi folks, I'm new here. I am a moderately experienced coder with some Linux experience - my python expertise is low, but I'm finding it pretty easy to learn so far compared with, oh, everything else out there. I've worked on various game projects for years, looking to try out Python-Ogre to add to my toolbox.

I'll be recording my experience with the build here, as a way to ask for help when needed, and to share solutions when I am able to come up with them.

Here's some system info to start off:
[b]laptop:~$ gcc -v[/b]
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)
[b]laptop:~$ uname -r[/b]
2.6.24-19-generic


I am, of course, following version 2 of the Linux build instructions at the wiki.

Step 1 was successful

Step 2 BuildModule.py did not even execute until I made a change to line 907 of python-ogre/environment.py, going from:
[0, untar + os.path.join(downloadPath,"ode-0.10.1.tar.gz"), ''],
to
[0, "untar" + os.path.join(downloadPath,"ode-0.10.1.tar.gz"), ''],

After that, all of the steps worked except for Boost, which failed because http://downloads.sourceforge.net/boost/ ... _35.tar.gz is a dead link. I changed line 458 of python-ogre/environment.py from:
base = 'boost_1_35'
to
base = 'boost_1_35_0'
After that I reran python python-ogre/BuildModule.py -r boost and i seemed to work.

To be continued...

Harleaquin

13-08-2008 20:25:03

ahh.. thanx a lot..
exactly my problem...

TackyParker

13-08-2008 20:44:01

Step 3 I had trouble with Step 3 last night, so I'm running the steps one at a time.

python python-ogre/BuildModule.py -b cmake ran with no errors.
python python-ogre/BuildModule.py -b gccxml ran with no errors (took a lot longer).
python python-ogre/BuildModule.py -b boost failed pretty quickly with the following error:
PythonOgre.BuildModule: INFO Build Command cp -f bjam /home/sshorter/development/root/usr/bin
Traceback (most recent call last):
File "python-ogre/BuildModule.py", line 292, in <module>
buildModule ( classList[ moduleName ] )
File "python-ogre/BuildModule.py", line 143, in buildModule
ret = spawnTask ( cmd, path )
File "python-ogre/BuildModule.py", line 93, in spawnTask
process = subprocess.Popen (task, shell=True,stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd = cwdin, env=env)
File "/usr/lib/python2.5/subprocess.py", line 594, in __init__
errread, errwrite)
File "/usr/lib/python2.5/subprocess.py", line 1147, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory: '/home/sshorter/development/boost-jam-3.1.16/bin.linuxx86'


I changed line 467 of python-code/environment.py from
bjambuilddir = 'bin.linuxx86'
to
bjambuilddir = 'bin.linuxx86_64'
And that seemed to fix that error.

Now boost is building - I'm going to post this one and continue once that's complete.

TackyParker

13-08-2008 21:51:25

python python-ogre/BuildModule.py -b boost_python_index also fails:
PythonOgre.BuildModule: INFO Build Command make all
Traceback (most recent call last):
File "python-ogre/BuildModule.py", line 292, in <module>
buildModule ( classList[ moduleName ] )
File "python-ogre/BuildModule.py", line 143, in buildModule
ret = spawnTask ( cmd, path )
File "python-ogre/BuildModule.py", line 93, in spawnTask
process = subprocess.Popen (task, shell=True,stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd = cwdin, env=env)
File "/usr/lib/python2.5/subprocess.py", line 594, in __init__
errread, errwrite)
File "/usr/lib/python2.5/subprocess.py", line 1147, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory: '/home/sshorter/development/libboost-python1.35.0-index'


I solved this problem last night while too tired, but I don't recall how I did that. Posting this for now in case someone can suggest a solution, while I continue to investigate.

TackyParker

13-08-2008 22:48:16

After digging in the BuildModule.py code for a while, I decided that running python python-ogre/BuildModule.py -r boost_python_index would help. It seemed to get things a bit further, though the build still fails. The stdout error is:
sshorter@sshorter-laptop:~/development$ python python-ogre/BuildModule.py -b boost_python_index
PythonOgre.BuildModule: INFO Build Command make all
PythonOgre.BuildModule: WARNING Task Failed
PythonOgre.BuildModule: INFO Build Command PREFIX=/home/sshorter/development/root/usr make install
PythonOgre.BuildModule: WARNING Task Failed

The log.out contains the following:
08-13 16:59 PythonOgre.BuildModule WARNING Task Failed
08-13 16:59 PythonOgre.BuildModule DEBUG g++ libs/python/src/indexing/indexing_slice.cpp libs/python/src/indexing/python_iterator.cpp \
-I . \
-I /usr/include/python`python -V 2>&1 | sed -e's/Python \(2\.[45]\).*/\1/'` \
-shared -Wl,-soname,libboost_python_index-gcc`gcc --version | head -1 | sed -e's/.*) \([0-9]\)\.\([0-9]\).*/\1\2/'`-1_34_1.so -o libboost_python_index-gcc`gcc --version | head -1 | sed -e's/.*) \([0-9]\)\.\([0-9]\).*/\1\2/'`-1_34_1.so -fPIC \
-lboost_python \
-lpython`python -V 2>&1 | sed -e's/Python \(2\.[45]\).*/\1/'`

08-13 16:59 PythonOgre.BuildModule DEBUG In file included from libs/python/src/indexing/indexing_slice.cpp:16:
./boost/python/suite/indexing/slice.hpp:19:35: error: boost/python/object.hpp: No such file or directory
./boost/python/suite/indexing/slice.hpp:20:35: error: boost/python/errors.hpp: No such file or directory
[b]snipping many downstream errors[/b]


I searched libboost-python1.35.0-index/boost/python and didn't see any .hpp files, so I deleted the directory and recreated it with cp -r boost_1_35_0 libboost-python1.35.0-index (since that appears to be all that's done to "retrieve" the source). I checked that the .hpp files are there and ran the build command again, and it completed without errors.

python python-ogre/BuildModule.py -b pygccxml ran successfully.

python python-ogre/BuildModule.py -b cg ran successfully.

python python-ogre/BuildModule.py -b scons ran successfully.

python python-ogre/BuildModule.py -b freeimage failed with the following errors from log.out:
Source/FreeImage/PluginBMP.cpp: In function ‘BOOL LoadPixelDataRLE4(FreeImageIO*, void*, int, int, FIBITMAP*)’:
Source/FreeImage/PluginBMP.cpp:227: error: no matching function for call to ‘MIN(int&, long int)’


This is a amd64 issue, I resolved it by adding a cast, changing:
status_byte = MIN(status_byte, end - q);
to
status_byte = MIN(status_byte, (int)(end - q));
(note that this same line appears in two places in the source file)

Since the code unzips every time it builds, I commented out line 377 of python-ogre/environment.py. The build proceeds quite a bit further, then fails with the following error in log.out:
Source/Metadata/Exif.cpp: In function ‘BOOL jpeg_read_exif_dir(FIBITMAP*, const BYTE*, unsigned int, unsigned int, BOOL)’:
Source/Metadata/Exif.cpp:498: error: cast from ‘BYTE*’ to ‘DWORD’ loses precision

Looks a lot like another amd64 issue and here is where I am stuck (for the moment). I'm going to investigate installing the libfreeimage package for my platform via synaptic and copying the libraries, rather than resolving all the amd64 issues by hand.

TackyParker

13-08-2008 22:57:21

Okay I installed those packages and examined what files it installed, and I find that I now have:
/usr/lib/libfreeimage-3.9.3.so
/usr/lib/libfreeimage.a
/usr/lib/libfreeimage.so
/usr/lib/libfreeimage.so.3

I compared that to a root.tar.gz that someone distributed (I forget who posted the link to that file, but thanks!) and see that libfreeimage-3.10.0.so is missing. Crossing my fingers that the different version number is not a critical problem, I copied the libraries from /usr/lib:
laptop:~/development$ cp /usr/lib/libfreeimage* root/usr/lib
laptop:~/development$ sudo chown sshorter:sshorter root/usr/lib/libfreeimage*


Okay, moving on.

python python-ogre/BuildModule.py -b zziplib succeeded.

python python-ogre/BuildModule.py -b pyplusplus also succeeded.

Step 3 complete! (assuming my freeimage hack worked)

TackyParker

13-08-2008 23:48:16

python python-ogre/BuildModule.py -r cegui ois ogre worked.
python python-ogre/BuildModule.py -b cegui worked.
python python-ogre/BuildModule.py -b ois ogre did not work.

log.out said (among other things):
****************************************************************
* You do not have the nVidia Cg libraries installed. *
* Go to http://developer.nvidia.com/object/cg_toolkit.html *
* (Click on Cg_Linux.tar.gz). *
* You can disable the building of Cg support by providing *
* --disable-cg to this configure script but this is highly *
* discouraged as this breaks many of the examples. *
****************************************************************


I downloaded Cg-2.0_May2008_x86_64.tgz, unzipped the usr directory within into ~/development/root and reran the build command. That didn't help, so I scrolled up in log.out and saw a *large* number of permission denied errors like:
08-13 18:12 PythonOgre.BuildModule DEBUG Spawning 'tar jxf /home/sshorter/development/downloads/ogre-v1-4-9.tar.bz2 --overwrite' in '/home/sshorter/development'
08-13 18:12 PythonOgre.BuildModule WARNING Task Failed
08-13 18:12 PythonOgre.BuildModule DEBUG
08-13 18:12 PythonOgre.BuildModule DEBUG tar: ogre/Docs/api/html/doxygen.png: Cannot open: Permission denied
tar: ogre/Docs/api/html/doxygen.css: Cannot open: Permission denied
tar: ogre/Docs/api/html/index.html: Cannot open: Permission denied
tar: ogre/Docs/api/html/files.html: Cannot open: Permission denied
tar: ogre/Docs/api/html/Ogre_8h-source.html: Cannot open: Permission denied
tar: ogre/Docs/api/html/OgreAlignedAllocator_8h-source.html: Cannot open: Permission denied
tar: ogre/Docs/api/html/OgreAnimable_8h-source.html: Cannot open: Permission denied

Checking the file permissions, I see:
laptop:~/development$ ls -la ogre/Docs/api/html/doxygen.png
-r--r--r-- 1 sshorter sshorter 1281 2008-06-16 07:48 ogre/Docs/api/html/doxygen.png


I did a chmod a+w on that file and reran the build command, now the permision denied error no longer appears in log.out.

Time to go eat dinner, I'll post more later.

TackyParker

14-08-2008 02:11:01

Well I did a chmod a+w on the whole directory and that prevented the permission errors, but I am still seeing the errors about nVidia:
08-13 20:40 PythonOgre.BuildModule DEBUG configure: error:
****************************************************************
* You do not have the nVidia Cg libraries installed. *
* Go to http://developer.nvidia.com/object/cg_toolkit.html *
* (Click on Cg_Linux.tar.gz). *
* You can disable the building of Cg support by providing *
* --disable-cg to this configure script but this is highly *
* discouraged as this breaks many of the examples. *
****************************************************************
08-13 20:40 PythonOgre.BuildModule INFO Build Command make
08-13 20:40 PythonOgre.BuildModule DEBUG Spawning 'make' in '/home/sshorter/development/ogre'
08-13 20:40 PythonOgre.BuildModule WARNING Task Failed
08-13 20:40 PythonOgre.BuildModule DEBUG
08-13 20:40 PythonOgre.BuildModule DEBUG make: *** No targets specified and no makefile found. Stop.

08-13 20:40 PythonOgre.BuildModule INFO Build Command make install
08-13 20:40 PythonOgre.BuildModule DEBUG Spawning 'make install' in '/home/sshorter/development/ogre'
08-13 20:40 PythonOgre.BuildModule WARNING Task Failed
08-13 20:40 PythonOgre.BuildModule DEBUG
08-13 20:40 PythonOgre.BuildModule DEBUG make: *** No rule to make target `install'. Stop.

Since it was a configure script that failed, I assume that the makefile didn't get written and that's the reason for the subsequent errors. I need to figure out more about the information in the box above - as mentioned, I did download the 64 bit binaries at the link above, and I put them in ~/development/root/usr/..., but the instructions didn't say what to actually do with the Cg libraries. For a test, I tried setting LD_LIBRARY_PATH to ~/development/root/usr/lib but that didn't improve things.

Next attempt was to install the nvidia-cg-toolkit package, followed by running sudo update-nvidia-cg-toolkit --install. That seemed to work - the configure step finished without error.

Now Ogre is building. Stay tuned.

TackyParker

14-08-2008 02:45:24

Disregard the prior "that worked" post since I just noticed that all I did was finish step 4. Silly me.

Step 5 fails building the ois wrapper code, here's what I'm getting in log.out:
08-13 21:50 PythonOgre.BuildModule INFO Compiling Source code for ois
08-13 21:50 PythonOgre.BuildModule DEBUG Spawning 'scons PROJECTS=ois' in '/home/sshorter/development/python-ogre'
08-13 21:51 PythonOgre.BuildModule WARNING Task Failed
08-13 21:51 PythonOgre.BuildModule DEBUG scons: Reading SConscript files ...
Building ois
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build_dir_2.5/ois_1.2/Axis.pypp.os -c `pkg-config --cflags OGRE` -I -O3 -I./ -fPIC -I/home/sshorter/development/root/usr/include/boost-1_35 -I/home/sshorter/development/root/usr/include/OIS -I/usr/include/python2.5 -I/home/sshorter/development/root/usr/include/boost-1_35 generated/ois_1.2/Axis.pypp.cpp
g++ -o build_dir_2.5/ois_1.2/AxisVector.pypp.os -c `pkg-config --cflags OGRE` -I -O3 -I./ -fPIC -I/home/sshorter/development/root/usr/include/boost-1_35 -I/home/sshorter/development/root/usr/include/OIS -I/usr/include/python2.5 -I/home/sshorter/development/root/usr/include/boost-1_35 generated/ois_1.2/AxisVector.pypp.cpp
scons: building terminated because of errors.

08-13 21:51 PythonOgre.BuildModule DEBUG generated/ois_1.2/AxisVector.pypp.cpp:6:59: error: boost/python/suite/indexing/container_suite.hpp: No such file or directory
generated/ois_1.2/AxisVector.pypp.cpp:7:50: error: boost/python/suite/indexing/vector.hpp: No such file or directory
In file included from generated/ois_1.2/AxisVector.pypp.cpp:8:
generated/ois_1.2/_Axis__value_traits.pypp.hpp:9: error: ‘value_traits’ is not a template
generated/ois_1.2/_Axis__value_traits.pypp.hpp:9: error: explicit specialization of non-template ‘boost::python::indexing::value_traits’
generated/ois_1.2/AxisVector.pypp.cpp: In function ‘void register_AxisVector_class()’:
generated/ois_1.2/AxisVector.pypp.cpp:19: error: ‘vector_suite’ is not a member of ‘boost::python::indexing’
generated/ois_1.2/AxisVector.pypp.cpp:19: error: expected primary-expression before ‘>’ token
generated/ois_1.2/AxisVector.pypp.cpp:19: error: expected primary-expression before ‘)’ token
scons: *** [build_dir_2.5/ois_1.2/AxisVector.pypp.os] Error 1

It complains about vector.hpp, but note that the file does exist:
laptop:~/development$ ls python-ogre/boost/boost/python/suite/indexing/vector.hpp
python-ogre/boost/boost/python/suite/indexing/vector.hpp

So the include path is not pointing there correctly. The boost/boost looks odd to me, and I see that python-ogre/boost contains (in addition to boost directory) another directories such as debian that was also found in the python-ogre directory, and a libs directory that looks like it should go in python-ogre parallel to such directories as include.

So I'm going out on a limb and guessing that my prior messing around with getting the boost_python_index working may have screwed this up. I copies the contents of python-code/boost up one level. Now that vector.hpp looks like it should match the include path that was being searched on before.

... compile compile compile....

Okay so that worked, but now it didn't link:
08-13 22:11 PythonOgre.BuildModule DEBUG /usr/bin/ld: cannot find -lboost_python_index-gcc42-1_35_0
Hm, I guess my boost_python_index hack didn't do the trick, since I see that the library that we're looking for just doesn't exist:
laptop:~/development$ find . -name libboost_python*
./libboost-python1.35.0-index/bin.v2/libs/python/build/gcc-4.2.3/release/threading-multi/libboost_python-gcc42-mt-1_35.so.1.35.0
./root/usr/lib/libboost_python-gcc42-mt-1_35.so
./root/usr/lib/libboost_python-gcc42-mt-1_35.so.1.35.0
./root/usr/lib/libboost_python-gcc42-mt.so
./boost_1_35_0/bin.v2/libs/python/build/gcc-4.2.3/release/threading-multi/libboost_python-gcc42-mt-1_35.so.1.35.0


Hm, back to square one, or at least step 3. Anyone have any suggestions at this point?

TackyParker

14-08-2008 04:39:57

Ha, okay. I went back to step three, and it worked. Wonder if some of the moving stuff around that I did helped any.

So now I'm back to step 5. Things seem to be working, though I had to move some libraries around to get the linking to work. Building the ogre wrapper code takes quite a while, eh? It's been going for 40 minutes now. Gonna call it a day, will update tomorrow.

TackyParker

14-08-2008 12:38:08

Wow, that's a long compile - 6 hours or so. And it didn't work - something went wrong with the python_boost_index target after all, since I now get undefined symbols when I try to run the demos:
laptop:~/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
File "/home/sshorter/development/root/usr/lib/python2.5/site-packages/ogre/renderer/OGRE/__init__.py", line 10, in <module>
from _ogre_ import *
ImportError: /home/sshorter/development/root/usr/lib/python2.5/site-packages/ogre/renderer/OGRE/_ogre_.so: undefined symbol: _ZN5boost6python8indexing15python_iteratorC1ENS0_3api6objectE

Perhaps I just need to work on a different platform until the Linux problems get hammered out.

TackyParker

15-08-2008 14:27:16

So Tim suggested the following (on the google group):
As a quick suggestion to try the following,

Step 1 - Remove everything you have
Step 2 - Create a fresh checkout

cd ~
mkdir development
cd development
svn co https://python-ogre.svn.sourceforge.net ... runk/pyt... python-ogre

Step 3 - Create an empty file in the "python-ogre" directory called
"STABLE"

cd python-ogre
touch STABLE

Step 4 - Continue from Step 2 on the wiki.

I have AMD64 debian/ubuntu packages but they just segfault when running
anything and I've yet to figure out why. It occurs somewhere in Boost
and I have yet to convince boost to build with debug symbols.


So far, some of the problems, but not all, are gone.

1. Still had to change untar -> "untar"
2. Still had to change bin.linuxx86 -> bin.linuxx86_64
3. Building boost_python_index causes a different version of the same problem:
laptop:~/development$ python python-ogre/BuildModule.py -b boost_python_index
PythonOgre.BuildModule: INFO Build Command make all
Traceback (most recent call last):
File "python-ogre/BuildModule.py", line 292, in <module>
buildModule ( classList[ moduleName ] )
File "python-ogre/BuildModule.py", line 143, in buildModule
ret = spawnTask ( cmd, path )
File "python-ogre/BuildModule.py", line 93, in spawnTask
process = subprocess.Popen (task, shell=True,stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd = cwdin, env=env)
File "/usr/lib/python2.5/subprocess.py", line 594, in __init__
errread, errwrite)
File "/usr/lib/python2.5/subprocess.py", line 1147, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory: '/home/sshorter/development/libboost-python1.34.1-index'

Will post more when I learn more.

TackyParker

15-08-2008 16:44:14

Okay got some good info from Tim via email, namely that it is necessary to call python python-ogre/BuildModule.py -r boost_python_index before attempting to build boost_python_index, which makes sense to me.

The build command failed with various includes missing, so after examining directory contents I changed the retrieval command to a manual cp -rvf boost_1_34_1/ libboost-python1.34.1-index. The build worked after that.

TackyParker

15-08-2008 16:49:50

I forgot to mention another tidbit from Tim, which is that questions should be posed to the mailing list rather than the forums, as the main developers don't read the forums. Not sure if he means the google group or the sourceforge mailing list - I would think the latter except that the latter looks like a place for commit notifications only. Anyway, thought I should pass it along. :)

TackyParker

15-08-2008 19:26:13

If you have trouble generating the wrapper code for ois (python python-ogre/BuildModule.py -g ois) while building in STABLE mode, change line 20 of python-ogre/PythonOgreConfig_posix.py from PATH_Boost = os.path.join(LOCAL_INCLUDE, 'boost-1_35') to PATH_Boost = os.path.join(LOCAL_INCLUDE, 'boost-1_34_1')

TackyParker

15-08-2008 22:58:11

Useful patch for building boost_python_index is provided here, by the way.

mithro

26-08-2008 03:30:01

Most of this information should be obsolete now. All (proper versions) of these fixes should be in subversion.

Please report any more problems to the mailing list.

TackyParker

26-08-2008 12:23:50

Most of this information should be obsolete now. All (proper versions) of these fixes should be in subversion.

Please report any more problems to the mailing list.

Thanks Mithro I will give it another shot soon.