I created a simple .so library containing definition of a C++ class which should be accessed from Python and used for this purpose boost python library. When I'm testing this library using x64 Ubuntu it is enough to set LD_LIBRARY_PATH with the path to boost libs before running python. It doesn't work, however, when I'm using x64 Suse. Altough I'm setting LD_LIBRARY_PATH it seems that Python ignores it.
Is there any specific way to set environmental variables under Suse?
You should never set LD_LIBRARY_PATH
, see here and here.
First of all I have to assume that you installed the Boost libraries in a nonstandard location, otherwise the loader would find them automatically. If you have root access to the machine, install the libraries in a standard place (e.g. with the package manager, or in /usr/local/lib
).
If you don't have root privileges, set the runpath instead. When using the gcc linker, do this by passing an -rpath
option. The gcc compiler can pass options to the linker via -Wl
. So call the compiler as follows:
g++ -Wall -Wextra -Wl,-rpath /path/to/boost -L /path/to/boost -lboost_python ...