Optimization?

Ethon

21-12-2011 18:28:04

Hey,
I just built python-ogre on my Ubuntu box.
The resulting binary "_ogre_.so" is over 260 MBytes huge!

How can I turn optimizations on?

Thanks!
Regards,
Ethon

dermont

22-12-2011 03:56:21

There is an issue with optimization flags in the SConstruct file and the order of the build command with later versions of gcc (4.5/4.6).

I'll fix it next time I do a build, I think the solution is to move "pkg-config" to the end of the CCFLAGS part of the build command :

elif environment.isLinux():
CCFLAGS += ' -I'
CCFLAGS += ' -O3 -I./ '
CCFLAGS += ' -DBOOST_PYTHON_MAX_ARITY=19 -DBOOST_PYTHON_NO_PY_SIGNATURES '
....
## moved to eliminate problems with gcc 4.6
CCFLAGS = ' `pkg-config --cflags OGRE` ' ## needs to change I think :)



If the above doesn't work as a ugly hack see the first post in the following link, you should be able to force the order by setting a custom compiler:

viewtopic.php?f=3&t=14906

## Use custom compilier if wanted (things like ccache)
if environment.isLinux():
_env['CXX'] ='g++ -O3 -DBOOST_PYTHON_MAX_ARITY=19 -DBOOST_PYTHON_NO_PY_SIGNATURES -Wno-deprecated -I./ -I./'


The above should reduce your ogre .so file to around 80MB. Try this first on one of the smaller modules such as OIS. If you run into difficulties let us know.