Google

Archlinux Python-Ogre Information

A discussion on Python-Ogre, the library which allows you to drive OGRE directly from Python

Moderators: OGRE Team, Python-Ogre Moderators

Archlinux Python-Ogre Information

Postby kkb110 » Sat Jul 02, 2011 5:12 am

Finally I got python-ogre working in archlinux in a clean way.

Note that you have to change "python" to "python2" for example, "sudo ln -s /usr/bin/python2 /usr/local/bin/python"

The first line assumes you're using yaourt for AUR frontend. Otherwise, just install ogre-1.7.2 pygccxml-svn py++-svn from AUR.



Code: Select all
yaourt -S ogre-1.7.2 pygccxml-svn py++-svn #--noconfirm

svn co https://python-ogre.svn.sourceforge.net/svnroot/python-ogre/trunk/python-ogre python-ogre

wget http://downloads.sourceforge.net/ogre/ogre_src_v1-7-2.tar.bz2
tar -jxvf ogre_src_v1-7-2.tar.bz2
mv ogre_src_v1-7-2 ogre

mkdir -p ./root/usr/include
ln -sf /usr/include/OGRE ./root/usr/include/
ln -sf /usr/include/OIS ./root/usr/include/
ln -sf /usr/include/boost ./root/usr/include/

python python-ogre/BuildModule.py -g -c ogre
python python-ogre/BuildModule.py -g -c ois
python python-ogre/BuildModule.py -b install
kkb110
Gnoblar
 
Posts: 7
Kudos: 0
Joined: 11 Apr 2011

Re: Archlinux Python-Ogre Information

Postby ProfMobius » Sun May 20, 2012 9:13 pm

Hello kkb110.
Sorry for ressurecting an old thread, but I'm out of idea.

I'm trying to get python-ogre to work on ArchLinux.
Following your instructions, I managed to get it to compile properly along with OIS, but when I try to import Ogre, I get the following error:

Code: Select all
In [1]: import ogre.renderer.OGRE as ogre
ImportError: /usr/lib/python2.7/site-packages/ogre/renderer/OGRE/_ogre_.so: undefined symbol: _ZN4Ogre9SingletonINS_17ControllerManagerEE12ms_SingletonE


Code: Select all
$> nm -D _ogre_.so | grep _ZN4Ogre9SingletonINS_17ControllerManagerEE12ms_SingletonE
U _ZN4Ogre9SingletonINS_17ControllerManagerEE12ms_SingletonE


I did check using nm and indeed Ogre::Singleton<Ogre::ControllerManager>::ms_Singleton is not defined (and so are other singletons, but I didn't reach the point where it could be a problem).
This specific symbol is not defined in any object generated by pyplusplus as far as I can tell.

Can you post the revisions of pygccxml & py++ you used as I have the feeling the prb is coming from the original code generation and not from the compilation. Or maybe you found a workaround for the current state of archlinux available tools.

Many thanks !
User avatar
ProfMobius
Gnoblar
 
Posts: 9
Kudos: 0
Joined: 04 Aug 2007

Re: Archlinux Python-Ogre Information

Postby dermont » Tue May 22, 2012 7:22 am

What version of gcc does Archlinux use?

What does nm libOgreMain.so | grep 'ms_Singleton' report?

As a guess I would suspect this is related to visibility settings:
http://gcc.gnu.org/gcc-4.7/porting_to.html

You could try disabling the visibility settings for Ogre in the main CMakeLists.txt
at the end of the test for visibility section i.e set(OGRE_GCC_VISIBILITY_FLAGS "").

First let us know the version of gcc and gccxml you are using since the above will probably require rebuilding the Ogre / _ogre_.so module.
dermont
Bugbear
 
Posts: 895
Kudos: 37
Joined: 27 Sep 2005

Re: Archlinux Python-Ogre Information

Postby ProfMobius » Tue May 22, 2012 1:42 pm

What version of gcc does Archlinux use?

It is a bit of a moving target since Arch is a rolling update distrib. But in my case, the compilation has been done with GCC 4.7.0.
As for gccxml, I'm using the latest CSV as of 2012-05-20.

What does nm libOgreMain.so | grep 'ms_Singleton' report?

Good point, it doesn't report anything for ms_Singleton or for the missing symbol.

As a guess I would suspect this is related to visibility settings:
http://gcc.gnu.org/gcc-4.7/porting_to.html

You could try disabling the visibility settings for Ogre in the main CMakeLists.txt
at the end of the test for visibility section i.e set(OGRE_GCC_VISIBILITY_FLAGS "").

I already tried to activate the visibility flags in python-ogre SConstruct with no luck. Maybe the problem starts at the original Ogre 1.7.2 compilation. I'm going to try desactivate visibility options during the initial Ogre compilation and will tell you if it works.

EDIT : Removing the visibility flags did do the trick for Ogre. I now have the proper symbols exported. I still have to recompile the bindings, but I think I'm on the right track :)
Thx Dermont. I think you solved it :D

For those having the same prb, just run this line in your ogre src folder:

Code: Select all
sed -i 's/set(OGRE_GCC_VISIBILITY_FLAGS/#set(OGRE_GCC_VISIBILITY_FLAGS/g' CMakeLists.txt
User avatar
ProfMobius
Gnoblar
 
Posts: 9
Kudos: 0
Joined: 04 Aug 2007

Re: Archlinux Python-Ogre Information

Postby dermont » Tue May 22, 2012 6:25 pm

The symbols should already be exported, the only difference being disabling visibility exports global symbols.

1) Original:
Code: Select all
00517dc0 b _ZN4Ogre9SingletonINS_17ControllerManagerEE11msSingletonE


2) Disabling visibility:
Code: Select all
00591ce0 B _ZN4Ogre9SingletonINS_17ControllerManagerEE11msSingletonE


<edit> your symbols will be 'ms_Singleton' , 'msSingleton' is for ogre1.8.x <\edit>

(2) resolved this problem previously. There is a problem with the order of the SConstruct build command so enabling the SConstruct settings for visibility may not have been applied (not sure).
viewtopic.php?f=3&t=14906

I'm not sure what the instructions the OP posted do or how you have set it up so _ogre_.so picks up the correct OgreMain lib since the instructions don't appear to build with --usesystem, I'm assuming LD_LIBRARY_PATH as per the build instructions.

http://wiki.python-ogre.org/index.php/LinuxBuildV4

Anyway I'll try building with gcc 4.70 tomorrow.
dermont
Bugbear
 
Posts: 895
Kudos: 37
Joined: 27 Sep 2005

Re: Archlinux Python-Ogre Information

Postby ProfMobius » Tue May 22, 2012 11:55 pm

Everything is working and I managed to run the samples without problem. The simple mention of visibility options for Ogre was the key. Many thanks :)

In my case, the symbol was not exported at all when compiling with visibility options. Removing them really did the trick.

About python-ogre visibility options & problem with not applied flags, it may explain why I ended up with variable size lib (from 70MB up to ~300MB). I will try moving the -O3 & visibility flags around as per the link indications and see what works best.

As for the OP instructions, it does not indeed provide an explicit LD_LIBRARY_PATH but the ogre-1.7.2 package on Archlinux is set to replace the official ogre-1.8.0RC1 package. I guess that's why I didn't really thought about it. OP explanations produce an environment with only one Ogre installed.

I'm in the process of making a proper package for Archlinux so we can finally easly enjoy python-ogre on this distrib :)
User avatar
ProfMobius
Gnoblar
 
Posts: 9
Kudos: 0
Joined: 04 Aug 2007

Re: Archlinux Python-Ogre Information

Postby dermont » Wed May 23, 2012 10:47 pm

Glad you got it sorted.

I tried a build with gcc4.7 here on Ubuntu but run into the same problem as you. Strangely enough disabling the visibility settings in Ogre and enabling in the SConstruct file the module imported and is 50% the size at 40MB.

As per the last link I directed you to
Code: Select all
        _env['CXX'] ='g++ -O3 -Wno-deprecated -DBOOST_PYTHON_MAX_ARITY=19 -DBOOST_PYTHON_NO_PY_SIGNATURES -fvisibility=hidden -fvisibility-inlines-hidden -DOGRE_GCC_VISIBILITY '


I think the reason the visibility settings were commented out in the SConstruct file were due to different problems with various versions of gcc. There may have been other reasons.

I didn't try building Ogre in Release mode -DCMAKE_BUILD_TYPE=Release (default is RelWithDebInfo -O2) so I don't know if that will make a difference.
dermont
Bugbear
 
Posts: 895
Kudos: 37
Joined: 27 Sep 2005


Return to Python-Ogre

Who is online

Users browsing this forum: No registered users and 1 guest