compile error with undefined reference to experimental_dnn_v3

asked 2018-07-08 12:45:11 -0500

jordan314 gravatar image

Hello, I am trying to compile some samples in the aruco module on a raspberry pi 3. They compiled with previous versions. I recently upgraded opencv and opencv_contrib to 3.4.1, and get this error:

/usr/local/lib/libopencv_text.so: undefined reference to `cv::dnn::experimental_dnn_v3::Net::empty() const'
/usr/local/lib/libopencv_tracking.so: undefined reference to `cv::dnn::experimental_dnn_v3::Net::forward(cv::String const&)'
/usr/local/lib/libopencv_text.so: undefined reference to `cv::dnn::experimental_dnn_v3::Net::getLayerId(cv::String const&)'
/usr/local/lib/libopencv_tracking.so: undefined reference to `cv::dnn::experimental_dnn_v3::Net::Net()'
/usr/local/lib/libopencv_tracking.so: undefined reference to `cv::dnn::experimental_dnn_v3::readNetFromCaffe(cv::String const&, cv::String const&)'
/usr/local/lib/libopencv_tracking.so: undefined reference to `cv::dnn::experimental_dnn_v3::blobFromImage(cv::_InputArray const&, double, cv::Size_<int> const&, cv::Scalar_<double> const&, bool, bool)'
/usr/local/lib/libopencv_text.so: undefined reference to `cv::dnn::experimental_dnn_v3::Net::getLayerShapes(std::vector<int, std::allocator<int> > const&, int, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&) const'
/usr/local/lib/libopencv_tracking.so: undefined reference to `cv::dnn::experimental_dnn_v3::Net::~Net()'
/usr/local/lib/libopencv_tracking.so: undefined reference to `cv::dnn::experimental_dnn_v3::Net::setInput(cv::_InputArray const&, cv::String const&)'
collect2: error: ld returned 1 exit status

This is with the command:

g++ -o detect_markers detect_markers.cpp `pkg-config opencv --cflags --libs`

I am not using dnn or tracking, only aruco. I also tried opencv_contrib 3.4.0 and opencv 3.4.0 but have the same issue. Does anyone know what's causing this?

edit retag flag offensive close merge delete

Comments

what is the outcome of:

 pkg-config opencv --libs

if you run it on a console ? (it's probably dragging in All opencv libs)

berak gravatar imageberak ( 2018-07-08 20:55:51 -0500 )edit

It's not letting me post here or post an answer yet, but that was it!! It was loading too many libraries. Thank you!!

jordan314 gravatar imagejordan314 ( 2018-07-08 22:44:12 -0500 )edit

May you please let me know how did you fix it?

Vivek Maran gravatar imageVivek Maran ( 2018-08-25 15:37:53 -0500 )edit