Cross-Compiling openCV for ARM on ubuntu
I have been trying to compile openCV for arm on my ubunto machine. When i compile to arm i am getting the below linkage errors: uiEscoreDrv.o: In function main': uiEscoreDrv.cpp:(.text+0x2a8): undefined reference tocv::namedWindow(std::string const&, int)' uiEscoreDrv.cpp:(.text+0x33c): undefined reference to cv::_InputArray::_InputArray(cv::Mat const&)' uiEscoreDrv.cpp:(.text+0x34c): undefined reference tocv::_OutputArray::_OutputArray(cv::Mat&)' uiEscoreDrv.cpp:(.text+0x390): undefined reference to cv::_InputArray::_InputArray(cv::Mat const&)' uiEscoreDrv.cpp:(.text+0x3a0): undefined reference tocv::imshow(std::string const&, cv::_InputArray const&)' uiEscoreDrv.cpp:(.text+0x4de): undefined reference to cv::destroyWindow(std::string const&)' uiEscoreDrv.o: In functiondisplayCoreOutput(escore_output&)': uiEscoreDrv.cpp:(.text+0x1304): undefined reference to cv::putText(cv::Mat&, std::string const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)' uiEscoreDrv.cpp:(.text+0x1358): undefined reference tocv::putText(cv::Mat&, std::string const&, cv::Point_, int, double, cv::Scalar_, int, int, bool)' uiEscoreDrv.cpp:(.text+0x13ac): undefined reference to cv::putText(cv::Mat&, std::string const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)' uiEscoreDrv.cpp:(.text+0x1452): undefined reference tocv::putText(cv::Mat&, std::string const&, cv::Point_, int, double, cv::Scalar_, int, int, bool)' uiEscoreDrv.cpp:(.text+0x1482): undefined reference to cv::_InputArray::_InputArray(cv::Mat const&)' uiEscoreDrv.cpp:(.text+0x1492): undefined reference tocv::imshow(std::string const&, cv::InputArray const&)' uiEscoreDrv.o: In function displayAnalytics(escore_output&)': uiEscoreDrv.cpp:(.text+0x1b44): undefined reference tocv::rectangle(cv::Mat&, cv::Point, cv::Point_, cv::Scalar_ const&, int, int, int)' uiEscoreDrv.cpp:(.text+0x1be0): undefined reference to cv::putText(cv::Mat&, std::string const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)' uiEscoreDrv.cpp:(.text+0x1cb6): undefined reference tocv::rectangle(cv::Mat&, cv::Point_, cv::Point_, cv::Scalar_ const&, int, int, int)' uiEscoreDrv.cpp:(.text+0x1e58): undefined reference to cv::rectangle(cv::Mat&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' uiEscoreDrv.cpp:(.text+0x1e88): undefined reference tocv::_InputArray::_InputArray(cv::Mat const&)' uiEscoreDrv.cpp:(.text+0x1e98): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)' collect2: error: ld returned 1 exit status
When i compile to regular linux, i dont get this the problem.
I have added the below to my Makefile: LDFLAGS += -L./ -L/usr/local/lib -lutils pkg-config --cflags --libs --static opencv
After the compilation i have done the below steps: cd /usr/local/lib sudo cp -rf /home/user/eyeSight_projects/opencv-3.2.0/platforms/linux/build_hardfp/install/lib/* .
But i am still getting this error...
Any ideas what can be wrong?
Thanks, Oren
We need more information about how did you build OpenCV for ARM, and where did you place the resulting libraries.
Also you should take in account that pkg-config searches native packages, so check the output of
pkg-config --cflags --libs --static opencv
command. You have to set PKG_CONFIG_PATH and/or some other environment variables (described in the pkg-config manual) to make it look in correct folders. There is alsoarm-linux-gnueabihf-pkg-config
tool available in Ubuntu, which should search in/usr/lib/arm*
folders.