Python Ogre on OSX 10.5.6

jmtan

28-02-2009 04:23:48

Hi guys, I've been playing around with building Python Ogre on the Mac on and off for the past couple of months. I've finally gotten it to run on the latest build after some missteps, so I'm posting my experience here in case someone else needs it.

System version: OSX 10.5.6
Python version: 2.5.1

Initial checkout
cd ~
mkdir development
cd development
svn co https://python-ogre.svn.sourceforge.net/svnroot/python-ogre/trunk/python-ogre python-ogre


Initial checkout from svn worked fine, latest at the time was:
r887 | kspes | 2009-02-10 07:33:07 +0800 (Tue, 10 Feb 2009)

Retrieval of support libraries
python python-ogre/BuildModule.py -r cmake gccxml boost pygccxml cg scons pyplusplus

pygccxml and pyplusplus repositories have to be manually checked out due to invalid certificate error with svn. The command can be found in log.out after it reports the failure

Building of support libraries
python python-ogre/BuildModule.py -b cmake gccxml boost pygccxml cg scons pyplusplus

Had to manually extract boost_1_37_0 to the development directory.

Retrieval of base ogre libraries
python python-ogre/BuildModule.py -r ogre

No problems.

Building of base ogre libraries
python python-ogre/BuildModule.py -b ogre

No problems.

Generation of wrapper code
python python-ogre/BuildModule.py -g ois

Encountered this error:
02-27 17:37 PythonOgre.BuildModule INFO Building Source code for ois
02-27 17:37 PythonOgre.BuildModule DEBUG Spawning 'python generate_code.py' in '/Users/jmtan/development/python-ogre/code_generators/ois'
02-27 17:37 PythonOgre.BuildModule WARNING Task Failed
02-27 17:37 PythonOgre.BuildModule DEBUG
02-27 17:37 PythonOgre.BuildModule DEBUG Traceback (most recent call last):
File "generate_code.py", line 324, in <module>
generate_code()
File "generate_code.py", line 241, in generate_code
, cflags=environment.ois.cflags
File "/Users/jmtan/development/root/usr/lib/python2.5/site-packages/pyplusplus/module_builder/boost_python_builder.py", line 88, in __init__
, indexing_suite_version)
File "/Users/jmtan/development/root/usr/lib/python2.5/site-packages/pyplusplus/module_builder/boost_python_builder.py", line 130, in __parse_declarations
decls = reader.read_files( files, compilation_mode )
File "/Users/jmtan/development/root/usr/lib/python2.5/site-packages/pygccxml/parser/project_reader.py", line 225, in read_files
return self.__parse_file_by_file(files)
File "/Users/jmtan/development/root/usr/lib/python2.5/site-packages/pygccxml/parser/project_reader.py", line 246, in __parse_file_by_file
, self.__decl_factory )
File "/Users/jmtan/development/root/usr/lib/python2.5/site-packages/pygccxml/parser/source_reader.py", line 87, in __init__
self.__config.raise_on_wrong_settings()
File "/Users/jmtan/development/root/usr/lib/python2.5/site-packages/pygccxml/parser/config.py", line 172, in raise_on_wrong_settings
super( gccxml_configuration_t, self ).raise_on_wrong_settings()
File "/Users/jmtan/development/root/usr/lib/python2.5/site-packages/pygccxml/parser/config.py", line 112, in raise_on_wrong_settings
, self.include_paths )
File "/Users/jmtan/development/root/usr/lib/python2.5/site-packages/pygccxml/parser/config.py", line 111, in <lambda>
map( lambda idir: self.__ensure_dir_exists( idir, 'include directory' )
File "/Users/jmtan/development/root/usr/lib/python2.5/site-packages/pygccxml/parser/config.py", line 103, in __ensure_dir_exists
raise RuntimeError( '%s("%s") does not exist!' % ( meaning, dir_path ) )
RuntimeError: include directory("/Users/jmtan/development/ois/includes") does not exist!


Action taken: Copy contents of ~/development/ogre/Dependencies/OIS to ~/development/ois/includes
Rerunning produced this error:
02-27 17:51 PythonOgre.BuildModule INFO Building Source code for ois
02-27 17:51 PythonOgre.BuildModule DEBUG Spawning 'python generate_code.py' in '/Users/jmtan/development/python-ogre/code_generators/ois'
02-27 17:51 PythonOgre.BuildModule WARNING Task Failed
02-27 17:51 PythonOgre.BuildModule DEBUG
02-27 17:51 PythonOgre.BuildModule DEBUG INFO Creating xml file "/Users/jmtan/development/python-ogre/code_generators/cache/ois_1.0_cache.xml" from source file "/Users/jmtan/development/python-ogre/code_generators/ois/python_ois.h" ...
INFO gccxml cmd: /Users/jmtan/development/root/usr/bin/gccxml -D__APPLE_CC__ -DCF_OPEN_SOURCE -I. -F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks -DBOOST_PYTHON_NO_PY_SIGNATURES -DBOOST_PYTHON_MAX_ARITY=19 -I/Users/jmtan/development/python-ogre/code_generators/ogre -F/Users/jmtan/development/ogre/Mac/build/Release -F/Users/jmtan/Library/Frameworks -I"/Users/jmtan/development/python-ogre" -I"/Users/jmtan/development/root/usr/include/boost-1_37" -I"/Users/jmtan/development/ois/includes" -D"OIS_NONCLIENT_BUILD" -D"VERSION_1.0" "/Users/jmtan/development/python-ogre/code_generators/ois/python_ois.h" -fxml="/Users/jmtan/development/python-ogre/code_generators/cache/ois_1.0_cache.xml"
INFO Parsing xml file "/Users/jmtan/development/python-ogre/code_generators/cache/ois_1.0_cache.xml" ...
INFO GCCXML version - 0.9( 1.127 )
/Users/jmtan/development/root/usr/lib/python2.5/site-packages/pygccxml/parser/scanner.py:343: UserWarning: unable to find out array size from expression ""
warnings.warn( msg )
Traceback (most recent call last):
File "generate_code.py", line 324, in <module>
generate_code()
File "generate_code.py", line 245, in generate_code
mb.register_module_dependency ( environment.ogre.generated_dir )
File "/Users/jmtan/development/root/usr/lib/python2.5/site-packages/pyplusplus/module_builder/boost_python_builder.py", line 118, in register_module_dependency
db.load( other_module_generated_code_dir )
File "/Users/jmtan/development/root/usr/lib/python2.5/site-packages/pyplusplus/utils/__init__.py", line 133, in load
f = file( fpath, 'r+b' )
IOError: [Errno 2] No such file or directory: '/Users/jmtan/development/python-ogre/generated/ogre_1.6.1'


Apparently, ogre has to be generated first.
python python-ogre/BuildModule.py -g ogre ois

No problems

Compilation of wrapper code
python python-ogre/BuildModule.py -c ois

Encountered this error (greatly truncated):
build_dir_2.5/ois_1.0/RampEffect.pypp.os build_dir_2.5/ois_1.0/Slider.pypp.os build_dir_2.5/ois_1.0/SupportedEffectList.pypp.os build_dir_2.5/ois_1.0/Vector3.pypp.os build_dir_2.5/ois_1.0/_ois_.main.os build_dir_2.5/ois_1.0/_ois__enumerations.pypp.os build_dir_2.5/ois_1.0/multimapOISType.pypp.os build_dir_2.5/ois_1.0/stdVectorBool.pypp.os build_dir_2.5/ois_1.0/vector_less__OIS_scope_Vector3__greater_.pypp.os -L/Users/jmtan/development/root/usr/lib -L/Users/jmtan/development/ois/Mac/XCode-2.2/build/Release -lOIS -lboost_python-xgcc42-mt
scons: building terminated because of errors.

02-27 18:03 PythonOgre.BuildModule DEBUG ld: framework not found OIS
collect2: ld returned 1 exit status
scons: *** [build_dir_2.5/ois_1.0/ois] Error 1

Not sure what this was, based on previous experience went to compile ogre wrapper first instead.
python python-ogre/BuildModule.py -c ogre
Error (even more truncated):
In file included from /Users/jmtan/development/root/usr/include/boost-1_37/boost/python/detail/wrap_python.hpp:50,
from /Users/jmtan/development/root/usr/include/boost-1_37/boost/python/detail/prefix.hpp:13,
from /Users/jmtan/development/root/usr/include/boost-1_37/boost/python/args.hpp:8,
from /Users/jmtan/development/root/usr/include/boost-1_37/boost/python.hpp:11,
from generated/ogre_1.6.1/strVectorVector4.pypp.cpp:3:
/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/pyconfig.h:485:1: warning: this is the location of the previous definition
ld: library not found for -lboost_python-xgcc42-mt
collect2: ld returned 1 exit status
scons: *** [build_dir_2.5/ogre_1.6.1/ogre] Error 1


I searched ~/development/root/usr/lib and found that the library compiled was boost_python-xgcc40-mt instead.
Action taken: Link /usr/bin/gcc with /usr/bin/gcc-4.2 and /usr/bin/g++ with /usr/bin/g++-4.2, and then recompiled boost with:
python python-ogre/BuildModule -b boost
After that the proper boost-python library appeared in the lib folder.

Compiled ogre wrapper with no further problems.

Back to compiling the OIS wrapper. I made some mistakes here, I'll post the correct steps instead:
Download OIS 1.2 source code from sourceforge: http://sourceforge.net/project/showfiles.php?group_id=149835&package_id=166954&release_id=583859

Compile the xcode project found in the Mac folder after extraction. Copy the following files/folders into ~/development/root/usr/lib:
  1. OIS.framework[/*]
  2. OIS.dylib[/*]
  3. OIS.a[/*]
    [/list:u]
    To be safe I also copied OIS.framework into ~/Library/Frameworks

    Compiled ois wrapper with no further problems.

    Installed wrapper with:
    python python-ogre/BuildModule -b install

    Make sure PYTHONPATH and LD_LIBRARY_PATH have been set in your .bash_profile. Or export them if you are just testing.

    Running the demos encounters an error due to not being able to find the bundles, so just make sure the "PluginFolder" entry in plugin config is commented out and each individual plugin entry has no file extension.

andy

28-02-2009 12:56:07

If you get a chance try again with the latest SVN as there were a number of MAC improvements since the version you documented...

Also (again if you want) go ahead and update the instructions on the wiki...

Andy

fpois

25-11-2009 04:00:42

I'm going through these instructions, and at the moment it seems like that "-r cmake" will retrive cmake-2.6.4, but "-b cmake" will try to find and build cmake-2.6-2, and thus fails.

Can I use the macports cmake instead? It's currently on version 2.8.0

Also, should there be a link from the front page of the wiki to link to http://wiki.python-ogre.org/index.php/OSXBuild10.5 article? Currently there's a link to OSXBuildV2 which is kind of out dated.

Ok, back to compiling...

andy

25-11-2009 06:45:02

I would expect that the macports for cmake would be fine -- let me know if this is the case :)

And feel free to make changes to the wiki as you see fit...

Andy