Undefined symbol during runtime

Hello,

I’ve added a little bit of opencv code to my gstreamer plugin, installed libopencv-dev (3.2.0 via ubuntu apt arm64 nvidia tegra), added -I to the location of
#include <opencv2/opencv.hpp>
added -L to the location and linked to -lopencv_core
(i use a simple makefile, no cmake)

it compiles and links without a complaint but during runtime ( gst-instpect libgstmtdataplugins.so ) i receive a

root@jetson:/# gst-inspect-1.0 usr/local/lib/gstreamer-1.0/libgstmtdataplugins.so

(gst-inspect-1.0:390): GStreamer-WARNING **: 03:03:04.583: Failed to load plugin 'usr/local/lib/gstreamer-1.0/libgstmtdataplugins.so': usr/local/lib/gstreamer-1.0/libgstmtdataplugins.so: undefined symbol: _ZN2cv13projectPointsERKNS_11_InputArrayES2_S2_S2_S2_RKNS_12_OutputArrayES5_d
Could not load plugin file: Opening module failed: usr/local/lib/gstreamer-1.0/libgstmtdataplugins.so: undefined symbol: _ZN2cv13projectPointsERKNS_11_InputArrayES2_S2_S2_S2_RKNS_12_OutputArrayES5_d

is this because i’m not linking to the correct library ? This reference is probably caused by

            cv::projectPoints(nose_end_point3D,
                              rotation_vector,
                              translation_vector,
                              camera_matrix,
                              dist_coeffs,
                              nose_end_point2D);

Is there a way to find out what other libraries are used for this particular call ? I looked at the documentation but it doesn’t have a link back to which library this is located in.

How can i find what is wrong here ?

tl;dr: you also need to link opencv_calib3d

docs are sorted by modules, so the group__calib3d.h in the url should have given it away, there’s also the #include <opencv2/calib3d.hpp> header mentioned there

1 Like

Excellent, that was just what i needed. Got it working now (a few other packages were missing from my development machine, but this got me over the line)

@berak Thank you for being patient with me. This is the first time I see this project and I am trying to get a grip of what is where in the documentation.

not sure how to mark your answer as the accepted answer, or how to close it yet… i’ll keep looking