ORB_SLAM2-PythonBindings icon indicating copy to clipboard operation
ORB_SLAM2-PythonBindings copied to clipboard

ImportError:

Open mertmzk opened this issue 7 years ago • 3 comments

Hi @jskinn Firstly, thanks for publishing your work!

I have compiled it successfully but when I import orbslam2 the python I get errors. My python version is 2.7. I tried to compile it with boost 1.62 and and got this error when try to import orbslam

File "", line 1, in ImportError: ./orbslam2.so: undefined symbol: _ZN5boost6python6detail11init_moduleER11PyModuleDefPFvvE

I changed the boost version to 1.45 and got this error

File "", line 1, in ImportError: dynamic module does not define init function (initorbslam2)

That would be great if you suggest me a solution for that.

thanks

mertmzk avatar Jun 23 '17 11:06 mertmzk

Thanks @mertmzk I think the problem is that I've hard-coded the location of the boost directory in CMakeLists.txt on line 38. Try updating CMakeLists to point to your boost install directory, and the correct python version (you can see I'm using python 3.4). You may also want to change the boost version being looked for on line 43.

The first error seems like orbslam2.so can't find the boost python shared library, check the paths with ldd orbslam2.so

I've never seen the second error, a quick google search suggests that the name of the boost module defined at the top of ORBSlamPython.cpp doesn't match the name of the shared object you're building. see https://stackoverflow.com/questions/8400244/boost-python-import-error-module-does-not-define-init-function

Oh, you might also have more success with the 'base-version' branch, which doesn't depend on any of my changes to ORB_SLAM2, so you can use the up-to-date version from their repository. see https://github.com/jskinn/ORB_SLAM2-PythonBindings/tree/base-version

jskinn avatar Jun 28 '17 01:06 jskinn

Hi @jskinn,

Thanks for your response. I have fixed the problems it is working now. For the second problem module name needs to be same as shared library name. So I changed module name in ORBSlamPython.cpp (line 7) as ORBSlamPython (it was orbslam2 before).

As far as I can see your ORBSLAM does not support save & load map yet which I will be integrating next.

Thanks.

mertmzk avatar Jun 28 '17 11:06 mertmzk

Hi @jskinn,

Thanks for your response. I have fixed the problems it is working now. For the second problem module name needs to be same as shared library name. So I changed module name in ORBSlamPython.cpp (line 7) as ORBSlamPython (it was orbslam2 before).

As far as I can see your ORBSLAM does not support save & load map yet which I will be integrating next.

Thanks.

Hi @mertmzk, have you been able to integrate the save and load map functions?

anushl9o5 avatar Jan 02 '20 09:01 anushl9o5