一、环境
1.Ubuntu16.04.2
2.openCV3.2
3.交叉编译器:arm-linux-gcc4.4.3 (经过测试,最好采用此版本交叉编译,报错的机会会少点)
二、交叉编译器问题
1.成功安装交叉编译4.4.3后,至于怎么安装交叉编译器,请百度很多这方面的教程,执行编译命令会报错,libstdc++.so.6: cannot open shared object file
解决方法:
在13.10 版本中,ia32_libs被废弃了导致没有32位的lib库
sudoapt-get install lib32stdc++6
sudoapt-get install lib32z1
三、编译问题
1./home/wzh/tools/arm/opencv-3.2.0/modules/imgproc/src/drawing.cpp:1026:error: call of overloaded 'abs(long long int&)' is ambiguous
解决方法:
修改上面对应路径的drawing.cpp,在1026行,把那一行里的所有abs换成fabs
2. ./../lib/libopencv_core.so: undefinedreference to `pthread_mutexattr_destroy'
../../lib/libopencv_imgcodecs.so: undefinedreference to `pthread_create'
../../lib/libopencv_core.so: undefinedreference to `dlopen'
../../lib/libopencv_core.so: undefinedreference to `pthread_mutex_trylock'
../../lib/libopencv_core.so: undefinedreference to `clock_gettime'
../../lib/libopencv_core.so: undefinedreference to `dlsym'
../../lib/libopencv_core.so: undefinedreference to `pthread_mutexattr_settype'
../../lib/libopencv_imgcodecs.so: undefinedreference to `pthread_join'
../../lib/libopencv_core.so: undefinedreference to `pthread_mutexattr_init'
解决方法:
修改/opt/opencv3-build目录下的CMakeCache.txt
CMAKE_EXE_LINKER_FLAGS原来为空,加上-lpthread –lrt
四、s5pv210上运行
1.把openCV编译好的lib库下的所有*so 拷贝进板子里根目录下的lib目录下
2.运行程序,报错:
OpenCVError: Unspecified error (The function is not implemented. Rebuild the librarywith Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian,install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) incvNamedWindow, file/home/wzh/tools/arm/opencv-3.2.0/modules/highgui/src/window.cpp, line 565
terminatecalled after throwing an instance of 'cv::Exception'
what(): /home/wzh/tools/arm/opencv-3.2.0/modules/highgui/src/window.cpp:565:error: (-2) The function is not implemented. Rebuild the library with Windows,GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, installlibgtk2.0-dev and pkg-config, then re-run cmake or configure script in functioncvNamedWindow
解决方法:
需要进行gtk2.0交叉编译,这里没有这样做,采用QT UI 来进行显示。如需要进行gtk2.0交叉编译,参考这个博客的方法:http://blog.youkuaiyun.com/water_cow/article/details/8727990