I built opencv statically cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/Libs/opencv/static .. \ -DBUILD_SHARED_LIBS=OFF \ -DBUILD_LIST="highgui,imgproc,imgcodecs"
After linking with a test example, I get the following errors
opencl_core.cpp:-1: error : undefined reference to `dlopen'
opencl_core.cpp:-1: error : undefined reference to `dlsym'
opencv/static/lib/libopencv_core.a(persistence.cpp.o):-1: In function `cv::FileStorage::Impl::release(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)':
file not found persistence.cpp:-1: erreur : undefined reference to `gzclose':
And many other similar undefined references, I do not use opencl at all, my example code is the following
#include <opencv4/opencv2/core.hpp>
#include <opencv4/opencv2/highgui.hpp>
#include <opencv4/opencv2/imgcodecs.hpp>
#include <opencv4/opencv2/imgproc.hpp>
int main(int argc, char **argv) {
if (argc != 2) {
std::cout << "usage: DisplayImage.out <Image_Path>\n" << std::endl;
return -1;
}
cv::Mat image = cv::imread(std::string{argv[1]});
if (!image.data) {
printf("No image data \n");
return -1;
}
cv::rectangle(image, cv::Point(0, 0), cv::Point(112, 112),
cv::Scalar(0, 255, 0), 10, cv::LINE_4);
cv::putText(image, "Opencv", cv::Point(0, 112),
cv::FONT_HERSHEY_COMPLEX_SMALL, 0.8, cv::Scalar(255, 0, 225));
cv::imshow("Opencv 4", image);
cv::waitKey(0);
return 0;
}