On Mon, Dec 14, 2009 at 8:25 PM, Alexey Akimov <alexey.akimov85@gmail.com> wrote:
Hello to everyone,
I get confused trying to port my boost python extension module. So I've made a shared object file test.so which actually perfectly works in the original development directory. However, when I copy this file to another Linux machine (I also copy some extra libraries such as libboost_python-gcc344-1_39.so.1.39.0 and make sure that both .so files are in PATH and LD_LIBRARY_PATH) I recieve "Import Error: undefined symbol: /home/username/bin/libboost_python-gcc34-1_39.so.1.39.0: PyUnicodeUCS4_FromEncodedObject". I aslo istalled the same version (compared to one which was used for creation of the module) of Python to the Linux machine where I try to use my extension. Can anyone explain me where could the problem be.
In my opinion you compiled the module against Python version/build which is differ from the "run" environment.
Also I would clarify what is the general way to export just created modules? As I understand the order is following: 1) create .so object (look for it in /bin/compiler-name/release-or-debug/module-name.so directory) 2) copy this file as well as other necessary library to some /bin or /lib directory (for convenience) - and make sure they are in PATH and LD_LIBRARY_PATH variables.
You can use "ldd" command to find out dependencies. In the case, you have few interpreters it also can help you to see what python*.so will be actually used.
3) import the module in python interpreter.
Do I need to do something else (define some other variables or make some other changes) in order to make my module work?
In case you have few modules, sometimes you need to tweak "dlopen" flags. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/