[ros-users] Python node design.

Blaise Gassend blaise at willowgarage.com
Fri Nov 5 16:19:36 UTC 2010

Hi Renato,

> I am putting into src/ an encapsulated version we made of pyopencv which
> does not require to be installed in any /usr path. Whenever I try to "import
> pyopencv" without LD_LIBRARY_PATH pointing it drops me this error:
> ImportError: libpyopencv_extras.so.2.1.0.wr1.2.0: cannot open shared object
> file: No such file or directory

I think I am better understanding what you are doing now (maybe). From
the sound of it, you have some .py python modules, some .so python
modules (module.py), and some .so that are needed by the .so python
modules (library.so).

Things that need to be found from python need to be found directly by
python (.py and .so modules) should be in the src/pyopencv directory
as I said before.

Now I am going to talk about things I am not sure of. The library.so
files need to be found by by the module.so files. If you don't want to
set LD_LIBRARY_PATH, then module.so needs to have its rpath set to
contain the path where library.so is to be found. I think that you do
that with the -Wl,-rpath option when you are creating module.so. (You
should also be able to change the rpath after the library is created,
if you prefer that.)

I think that if you want practical advice on how to do this that would
be particularly useful for you, you should look at the opencv2 module.
Its makefile contains some source to set the rpath in opencv's .pc
file. You can probably use a similar strategy when building your
module.so files.

Best of luck,

More information about the ros-users mailing list