Question

I have my own program with plugins (dynamic shared libraries) on a linux (ubuntu) system. My libraries (plugins) use OpenCV (maybe not so important).

My plugins are in /usr/local/lib/mysoft/.

I have compiled my program successfully even with libraries, successfully installed so everything seems to be OK up to this point.

When I run my program, it loads a bunch of these libraries based on some configuration file. I have several libraries which are loaded successfully but I cannot load one library. It gives me error when loading (used dlopen() to open the library):

/usr/local/lib/mysoft/libMyPlugin2.so: undefined symbol: _ZN2cv6resizeERKNS_11_InputArrayERKNS_12_OutputArrayENS_5Size_IiEEddi
Segmentation fault (core dumped)
Tue Nov 20 19:11:29 CET 2012

It obviously has some problems to find cv::resize which is part of OpenCV but I don't understand why.

I checked following things:

  • OpenCV is probably correctly installed since other libraries use it as well and are loaded without problems
  • no dependencies of my program, libMyPlugin2.so or OpenCV are missing (checked with ldd)
  • Architecture of all libraries and binaries seems to be the same (I checked it with objdump -f)

Does anybody have an idea what am I doing wrong?

This post seems to be so relevant but still didn't help: Linux shared library that uses a shared library undefined symbol

Was it helpful?

Solution

Well I found the problem, hopefully it can help others...

The problem - I was missing one OpenCV library when compiling. So I replaced "opencv_core opencv_highgui" by "opencv_core opencv_imgproc opencv_highgui" and everything works.

So although I was able to compile it one of the dependencies was missing - I guess something has changed in OpenCV cause these sources worked perfectly (even with build) with older versions of the OpenCV.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top