Friday, June 1, 2012

Ogre 3d linux gcc4.7

I have some issue with ogre 3d on my archlinux with gcc4.7.

I filed a bug report in arch, but I think it is an upstream bug and arch won't do anything about it. I still post my work around there. It works for me.

Details

Description:
Skeletal animation makes ogre crash.

Additional info:
* package version(s)
1.8.0
* config and/or log files etc.
ABS config

Steps to reproduce:
1. Runs /opt/OGRE/samples/SampleBrowser
2. Choose any sample using skeletal animation, such as Character, Dynamic Texturing, New Instancing or Skeletal Animation.
3. See the crash immediately.

Or, make you own ogre code using skeletal animation like official tutorial on ogre wiki. It will also crash.

It seems a historical bug back to 1.7 or more. It effects linux at least arch. It works fine on my win7.

It is a upstream bug not arch. But I have found a way to make work here. It is all about OgreOptimisedUtilSSE.cpp which can not be optimized more than -O1 with gcc 4.7. So I hardcoded with following steps:

cd ogre_src_v1-8-0
cd OgreMain/src/
g++ -c -O1 -march=native -msse -fPIC OgreOptimisedUtilSSE.cpp -I ../include/ -I ../../build/include/
cp OgreOptimisedUtilSSE.o ../../build/OgreMain/CMakeFiles/OgreMain.dir/src/OgreOptimisedUtilSSE.cpp.o
cd ../../build
make

Then, there is no crash any more.

I can put those into PKGBUILD to make it work. And there should be other better way than hardcoding. I found "set_source_files_properties" of cmake can set CFLAGS individually for source files. It might be better to patch CMakeLists.txt.

No comments:

Post a Comment