在ubuntu下搭建arm版本的opencv遇到的常见错误及解决方法

错误1.

运行cmake-gui会出现

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named numpy.distutils
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named sphinx
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named numpy.distutils

解决方法

Issue 1. when using cmake, the result always gives:

 "CUDA_TOOLKIT_ROOT_DIR not found or specified", CUDA is a parallel computing platform and programming model that enables dramatic increases in computing performance by harnessing the power of the graphics processing unit (GPU). It is only developed for NVdia GPU. However, it seems that not all PC will be equipped with that kind of GPU, theoretically, it is not necessary to install it and we make the option WITH_CUDA OFF. Also the opencv only support CUDA 4.0 now from the post bellow.

http://tech.groups.yahoo.com/group/OpenCV/message/85791

 From below link, you can install CUDA 4.0 successfully

http://blog.ryant.org/2011/12/installing-cuda-toolkit-on-ubuntu-1110.html

Issue 2. ImportError: No module named sphinx:

Just copy the following line, then this problem disappear.

sudo apt-get install python-sphinx

 

Issue 3. ImportError: No module named numpy.distutils

sudo apt-get install python-numpy

 

Issue 4.  JASPER (JASPER LIBRARY, JASPER_INCLUDE_ADDR)

sudo apt-get install libjasper-dev


在终端界面中,进入目录/usr/local/opencv-arm,运行make编译opencv

编译时发现如下错误:
Linking CXX executable http://www.cnblogs.com/bin/opencv_createsamples
http://www.cnblogs.com/lib/libcxcore.so: undefined reference to `clock_gettime'
http://www.cnblogs.com/lib/libcxcore.so: undefined reference to `pthread_key_create'
http://www.cnblogs.com/lib/libcxcore.so: undefined reference to `pthread_getspecific'
http://www.cnblogs.com/lib/libcxcore.so: undefined reference to `pthread_setspecific'

原因是cmake不认识我定义的arm-linux系统标记,没有加上库pthread和rt的链接选项

5、修改CMakeCache.txt,CMAKE_EXE_LINKER_FLAGS原来为空,加上-lpthread -lrt,重新编译,错误消除

如果还提示下面的错误:

opencv/OpenCV-2.3.1/modules/flann/include/opencv2/flann/dist.h: In function 'T cvflann::abs(T) [with T = long double]':

OpenCV-2.3.1/modules/flann/include/opencv2/flann/dist.h:63: error: 'fabsl' was not declared in this scope

make[2]: * [modules/flann/CMakeFiles/opencv_flann.dir/src/precomp.obj] Error 1

make[1]: * [modules/flann/CMakeFiles/opencv_flann.dir/all] Error 2

则修改


Replace fabsl() with fabs() in /OpenCV-2.3.1/modules/flann/include/opencv2/flann/dist.h 63行

,在/usr/local/opencv-arm目录下$sudo make
(1),80%报错:
。。。。/home/xin/tiaozhansai/OpenCV-2.2.0/modules/ml/src/gbt.cpp:474: error: 'expl' was not declared in this scope

    修改gbt.cpp中14行,16行:注释掉

                    //#if ANDROID

                    #define expl(x) exp(x)
                    //#endif
        错误消除。

,83%报错:
Linking CXX executable ../../bin/opencv_createsamples
../../lib/libopencv_highgui.so: undefined reference to `_TIFFerrorHandler'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFrealloc'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFmalloc'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFmemcpy'
../../lib/libopencv_highgui.so: undefined reference to `TIFFOpen'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFfree'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFwarningHandler'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFmemcmp'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFmemset'
    解决方法:修改CMakeCache.txt,WITH_TIFF:BOOL=ON,改成OFF(不再对TIFF图像格式支持。这里我前面已经装过libtiff4-dev,但是编译报错,我不明白是为什么),重新编译,错误消除。

(4),96%报错:
CMakeFiles/opencv_test.dir/src/highguitest.obj: In function `CV_HighGuiTest::run(int)':
highguitest.cpp:(.text._ZN14CV_HighGuiTest3runEi+0x18): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
../../lib/libopencv_features2d.so: undefined reference to `cv::SIFT::SIFT(double, bool, bool, int, int, int, int)'
    解决方法:在OpenCV2.2.0/modules/features2d/src/sift.cpp下
            #ifdef __arm__
            #define ARM_NO_SIFT
            #endif   
        注释掉#define ARM_NO_SIFT.错误消除,
成功!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值