在ubuntu上为ARM交叉编译openCV

时间:2017-02-16 08:29:05

标签: c++ linux opencv

我一直在尝试在我的ubunto机器上编译openCV for arm。 当我编译到arm我得到以下链接错误: uiEscoreDrv.o:在函数main': uiEscoreDrv.cpp:(.text+0x2a8): undefined reference to cv :: namedWindow(std :: string const&amp;,int)'中 uiEscoreDrv.cpp :(。text + 0x33c):未定义引用cv::_InputArray::_InputArray(cv::Mat const&)' uiEscoreDrv.cpp:(.text+0x34c): undefined reference to cv :: _ OutputArray :: _ OutputArray(cv :: Mat&amp;)' uiEscoreDrv.cpp :(。text + 0x390):未定义引用cv::_InputArray::_InputArray(cv::Mat const&)' uiEscoreDrv.cpp:(.text+0x3a0): undefined reference to cv :: imshow(std :: string const&amp;,cv :: _ InputArray const&amp;)' uiEscoreDrv.cpp :(。text + 0x4de):对cv::destroyWindow(std::string const&)' uiEscoreDrv.o: In function displayCoreOutput(escore_output&amp;)'的未定义引用: uiEscoreDrv.cpp :(。text + 0x1304):未定义引用cv::putText(cv::Mat&, std::string const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)' uiEscoreDrv.cpp:(.text+0x1358): undefined reference to cv :: putText(cv :: Mat&amp;,std :: string const&amp;,cv :: Point_,int,double,cv :: Scalar_ ,int,int,bool)' uiEscoreDrv.cpp :(。text + 0x13ac):未定义引用cv::putText(cv::Mat&, std::string const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)' uiEscoreDrv.cpp:(.text+0x1452): undefined reference to cv :: putText(cv :: Mat&amp;,std :: string const&amp;,cv :: Point_,int,double,cv :: Scalar_ ,int,int,bool)' uiEscoreDrv.cpp :(。text + 0x1482):未定义引用cv::_InputArray::_InputArray(cv::Mat const&)' uiEscoreDrv.cpp:(.text+0x1492): undefined reference to cv :: imshow(std :: string const&amp;,cv :: InputArray const&amp;)' uiEscoreDrv.o:在函数displayAnalytics(escore_output&)': uiEscoreDrv.cpp:(.text+0x1b44): undefined reference to cv :: rectangle(cv :: Mat&amp;,cv :: Point ,cv :: Point_,cv :: Scalar_ const&amp;,int,int,int)' uiEscoreDrv.cpp :(。text + 0x1be0):对cv::putText(cv::Mat&, std::string const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)' uiEscoreDrv.cpp:(.text+0x1cb6): undefined reference to cv :: rectangle的未定义引用(cv :: Mat&amp;,cv :: Point_,cv :: Point_,cv :: Scalar_ const&amp;,int,int ,int)' uiEscoreDrv.cpp :(。text + 0x1e58):未定义引用cv::rectangle(cv::Mat&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' uiEscoreDrv.cpp:(.text+0x1e88): undefined reference to cv :: _ InputArray :: _ InputArray(cv :: Mat const&amp;)' uiEscoreDrv.cpp :(。text + 0x1e98):未定义的引用`cv :: imshow(std :: string const&amp;,cv :: _ InputArray const&amp;)' collect2:错误:ld返回1退出状态

当我编译到常规linux时,我不会遇到这个问题。

我已完成以下所有步骤: http://docs.opencv.org/2.4/doc/tutorials/introduction/crosscompilation/arm_crosscompile_with_cmake.html

我已将以下内容添加到我的Makefile中: LDFLAGS + = -L./ -L / usr / local / lib -lutils pkg-config --cflags --libs --static opencv

编译完成后,我完成了以下步骤: cd / usr / local / lib sudo cp -rf /home/user/eyeSight_projects/opencv-3.2.0/platforms/linux/build_hardfp/install/lib/*。

但我仍然得到这个错误...

任何想法可能出错?

谢谢, 奥伦

1 个答案:

答案 0 :(得分:0)

这是一个汇编问题:-) 我没有将-I添加到编译行:

LOCAL_INCLUDE_FLAGS = -I / usr / local / include -I ../../api/ -I ../../  $(CROSS_COMPILE)g ++ -std = c ++ 11 -lsdtc ++ -fPIC -c -o uiEscoreDrv.o -fPIC $(CFLAGS)$(LOCAL_INCLUDE_FLAGS)uiEscoreDrv.cpp