[SOLVED] Linux: alternative build way - having issues

Bat2k

13-03-2010 12:28:07

Hi,

I'm trying to build python ogre not using BuildModule.py - I've successfully built all dependencies and stuck with py packages.
I have my own source tree (I mean I have built deps not under python-ogre folder) so I had to alter environment.py and PythonOgreConfig_XXX.py in order to get everything working.
But I still have some issues and questions and would appreciate any help.

1) During code generation phase (especially for ogre) I have a bunch of warnings of different sorts. As I'm new to py++ and gccxml I didn't dived into those. But I'm really worried because of it. How can I be sure that everything tied (C++->Py I mean) correctly. I guess those warnings are just warnings but anyway.
2) As I'm new to python/C/C++ binding i just don't know - what if I will encounter a bug (or if I will think it's a bug) in generated module and will trace it down to underlying c++ code, how can I debug it ? I mean in c++ I can just trace into ogre while having source. What can I do with python in that case?
3) I found:

if isWindows():
_USE_THREADS = True
BOOST_STATIC = False
else:
_USE_THREADS = False
BOOST_STATIC = False

in environment.py and as I am on Linux I changed this to:

if isWindows():
_USE_THREADS = True
BOOST_STATIC = False
else:
_USE_THREADS = True
BOOST_STATIC = False

but now I have an issue generating code for cegui - #error "Sorry, no boost threads are available for this platform.":

../common_utils/__init__.py:7: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
INFO Creating xml file "/home/bat/devel/sandbox/dep/src/python-ogre/code_generators/cache/cegui_0.7.1_cache.xml" from source file "/home/bat/devel/sandbox/dep/src/python-ogre/code_generators/cegui/python_CEGUI.h" ...
INFO gccxml cmd: /home/bat/devel/sandbox/dep/bin/gccxml -I"/home/bat/devel/sandbox/dep/src/python-ogre" -I"/home/bat/devel/sandbox/dep/include/" -I"/home/bat/devel/sandbox/dep/include/CEGUI" -I"/home/bat/devel/sandbox/dep/include/CEGUI/RendererModules/Ogre" -I"/home/bat/devel/sandbox/dep/include/OGRE" -I"/home/bat/devel/sandbox/dep/include/OGRE" -D"OGRE_NONCLIENT_BUILD" -D"CEGUI_NONCLIENT_BUILD" -D"OGRE_GCC_VISIBILITY" -D"__PYTHONOGRE_BUILD_CODE" -D"OGRE_GUIRENDERER_EXPORTS" -D"VERSION_0_7_1" -D"BOOST_HAS_THREADS" -D"BOOST_HAS_WINTHREADS" "/home/bat/devel/sandbox/dep/src/python-ogre/code_generators/cegui/python_CEGUI.h" -fxml="/home/bat/devel/sandbox/dep/src/python-ogre/code_generators/cache/cegui_0.7.1_cache.xml"
Traceback (most recent call last):
File "./generate_code.py", line 381, in <module>
generate_code()
File "./generate_code.py", line 312, in generate_code
, cflags=environment.ogre.cflags
File "/home/bat/devel/sandbox/dep/lib/python2.6/site-packages/pyplusplus/module_builder/boost_python_builder.py", line 95, in __init__
, indexing_suite_version)
File "/home/bat/devel/sandbox/dep/lib/python2.6/site-packages/pyplusplus/module_builder/boost_python_builder.py", line 138, in __parse_declarations
decls = reader.read_files( files, compilation_mode )
File "/home/bat/devel/sandbox/dep/lib/python2.6/site-packages/pygccxml/parser/project_reader.py", line 217, in read_files
return self.__parse_file_by_file(files)
File "/home/bat/devel/sandbox/dep/lib/python2.6/site-packages/pygccxml/parser/project_reader.py", line 254, in __parse_file_by_file
reader.create_xml_file( header, prj_file.cached_source_file )
File "/home/bat/devel/sandbox/dep/lib/python2.6/site-packages/pygccxml/parser/source_reader.py", line 179, in create_xml_file
raise error
pygccxml.parser.source_reader.gccxml_runtime_error_t: Error occured while running GCC-XML: In file included from /home/bat/devel/sandbox/dep/build/scripts/../../include/boost/thread/detail/config.hpp:20,
from /home/bat/devel/sandbox/dep/build/scripts/../../include/boost/thread/tss.hpp:8,
from /home/bat/devel/sandbox/dep/include/OGRE/Threading/OgreThreadHeadersBoost.h:29,
from /home/bat/devel/sandbox/dep/include/OGRE/Threading/OgreThreadHeaders.h:30,
from /home/bat/devel/sandbox/dep/include/OGRE/OgreStdHeaders.h:110,
from /home/bat/devel/sandbox/dep/include/OGRE/OgrePrerequisites.h:315,
from /home/bat/devel/sandbox/dep/include/OGRE/OgreBlendMode.h:31,
from /home/bat/devel/sandbox/dep/include/CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h:35,
from /home/bat/devel/sandbox/dep/src/python-ogre/code_generators/cegui/python_CEGUI.h:24:
/home/bat/devel/sandbox/dep/build/scripts/../../include/boost/thread/detail/platform.hpp:67:9: error: #error "Sorry, no boost threads are available for this platform."

and I think this is because:

if environment._USE_THREADS:
defined_symbols.append('BOOST_HAS_THREADS')
defined_symbols.append('BOOST_HAS_WINTHREADS')


in cegui/generate_code.py.
So I guess I need to add something here like BOOST_HAS_PTHREADS and remove WINTHREADS????

SOLVED:
Changed

if environment._USE_THREADS:
defined_symbols.append('BOOST_HAS_THREADS')
defined_symbols.append('BOOST_HAS_WINTHREADS')

to

if environment._USE_THREADS:
if environment.isWindows():
defined_symbols.append('BOOST_HAS_THREADS')
defined_symbols.append('BOOST_HAS_WINTHREADS')
else:
defined_symbols.append('BOOST_HAS_THREADS')
defined_symbols.append('BOOST_HAS_PTHREADS')

in cegui/generate_code.py.

As I know one shouldn't define those macros explicitly (boost will determine that itself), so may be removing just defined_symbols.append('BOOST_HAS_WINTHREADS') will help.
By the way, I'm still looking for answers for 1) and 2)