Search code examples
pythonc++opencvextend

undefined symbol: _ZN2cv3Mat10deallocateEv


I've been trying to extend my python script with a C++ code. I was able to do that with the simple libraries of C++ (print "hello world"). I followed the tutorial available in the link below:

http://www.tutorialspoint.com/python/python_further_extensions.htm

When I tried to add to my C++ code opencv libraries I encountered the following problem: ImportError: /usr/local/lib/python2.7/dist-packages/kalman.so: undefined symbol: _ZN2cv3Mat10deallocateEv

I searched for many solutions on the internet, and I found one common answer that didn't workout for me: "I was able to solve this by going to /usr/lib64/pkgconfig and modified opencv.pc to explicitly have all libraries. I also had to move the plugins from /usr/lib/gstreamer-0.10 to /usr/lib64/gstreamer-0.10"

Please note that I am using ubuntu 14.04 LTS 64-bit and I am planning to run my code later on on a raspberry pi model B running Raspbian OS.

Thank you.

NJ


Solution

  • Check your shared library kalman.so with ldd like so:

     $ ldd kalman.so
    

    And you will see that you are missing some libraries. That means that you have to provide some correct path to one of the libraries you use in your code at the linkage stage. something like

     $ ...the way you do linking ... -L path_to_the_missing_library
    

    For more information, please, consult this link.