compile error with undefined reference to experimental_dnn_v3
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?
what is the outcome of:
if you run it on a console ? (it's probably dragging in All opencv libs)
It's not letting me post here or post an answer yet, but that was it!! It was loading too many libraries. Thank you!!
May you please let me know how did you fix it?