[SOLVED] OIS Python bindings are not working

Vax456

01-11-2011 20:33:54

I'm running Gentoo with Ogre 1.7.3, CEGUI 0.7.5, and OIS 1.2.

So far, importing ogre.renderer.OGRE and ogre.gui.CEGUI works (after some editing), but ogre.io.OIS doesn't.

The first time I tried to import ogre.io.OIS, the error message it gave me is:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/ogre/io/OIS/__init__.py", line 4, in <module>
from _ois_ import *
ImportError: No module named _ois_


So I tried creating a symlink from libOIS.*whateverversion* to /usr/lib/python2.7/site-packages/ogre/io/OIS/_ois_.so

Then importing ogre.io.OIS reported:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/ogre/io/OIS/__init__.py", line 4, in <module>
from _ois_ import *
ImportError: dynamic module does not define init function (init_ois_)


I have no idea what to do. I've tried OIS 1.3, 1.2, and 1.0 and all of them did the same thing.

Does anyone know how to solve this problem?

dermont

02-11-2011 00:57:32

It looks as if the ois module has not been built, remember the ois module has to be generated after the ogre module. From the wiki:

Again if there are problems the errors will be in log.out and you can try to build the modules individually and/or do seperate retrieve(-r) and build(-b) steps.
..
Generate the wrapper code(-g), compile(-c) and install it - Ensure ogre is generated before any other module !


Try repeating the (-g)/(-c) steps for ois and report any errors from log.out.

Don't symlink from libOIS.*whateverversion* to /usr/lib/python2.7/site-packages/ogre/io/OIS/_ois_.so.

Vax456

07-11-2011 06:17:18

I tried what you said. And it had the same results.

I tried the default packages from Gentoo's repository, the walkthrough from the wiki, and tried extracting this pre-generated package http://sourceforge.net/projects/openrtss/files/Python-Ogre-SDK/ to the root directory on an Ubuntu 11.10 installation, and they all had the same problem.

I've been working on this for a while and have no idea what the problem is or what I'm doing wrong.

dermont

07-11-2011 10:56:03

Ok assuming you are building with "--usesystem" and have already installed OIS on your system.

1) What does pkg-config report for OIS:
pkg-config --cflags --libs OIS --modversion

2) In the source python-ogre directory:
Does _ois_.so exist in packages_2.7/ogre/io/OIS?, if so:
- cd to the above dir and try importing the lib
- run ldd packages_2.7/ogre/io/OIS/_ois_.so to see the libraries you have linked against

3) Does /usr/lib/python2.7/site-packages/ogre/io/OIS/_ois_.so exist?
If not, did you run the install command after compiling the ois module?

4) More importantly did log.out report any any errors during the generate/compile stage.

Otherwise if OIS is installed (from step 1), start the ois module build again:
- remove code_generators/cache/ois_*_cache.xml
- remove generated/ois_* dirs
- remove build_dir_2.7/ois_* dirs

- python python-ogre/BuildModule.py -g ois --usesystem
- check log.out for any errors
- python python-ogre/BuildModule.py -c ois --usesystem
- check log.out for any errors
- python python-ogre/BuildModule.py -c ois --usesystem
- run your install command.
Report any errors found in log.out or any other issues.

Vax456

08-11-2011 05:46:09

Turns out the culprit was GCC 4.5. Needed to downgrade to 4.4 in order to generate the wrappers.

dermont

08-11-2011 06:36:59

Turns out the culprit was GCC 4.5. Needed to downgrade to 4.4 in order to generate the wrappers.

The modules should build with gcc 4.5/4.6. There are some issues with scons but the wrappers should generate OK assuming that you have built gccxml with gcc 4.5/4.6. Do you have a log.out or a list of the errors you encountered. It may help others in the future.

viewtopic.php?f=3&t=14906