tx2编译OpenCV3.4.0

参考这篇文章安装opencv3.3.0教程http://blog.csdn.net/Function_K/article/details/77899546

opencv官方文档:https://docs.opencv.org/3.2.0/d6/d15/tutorial_building_tegra_cuda.html

遇到的错误:

(1)在make时,出现错误:cmake Error:camle_symlink_library: System Error: Operation not permitted

上网查了一下,出错的原因是我将opencv安装在了内存卡上,而不是/home文件夹下。解决办法有两个:

1)将opencv移到/home目录下,不过这个方法我没有试过,因为我的tx2内存不够了,说来也真是伤心。。。。

2)将内存卡格式化为ext3/ext4格式。

      我没有用命令来格式化,是直接右击内存卡,选择Format Volume,然后在type那栏选择第3个选项(Ext4)。

之后在原路径下,重新make就不再报错了。

 

----------------------------------------我是萌萌哒的分割线--------------------------------------------------------------

之前装opencv3.4的时候选上python3,现在要用时就GG了,于是又要重新编译一遍,万能的坑啊,真是无处不在

cmake时,执行以下命令

cmake -D BUILD_opencv_python3=YES -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local  -D PYTHON3_LIBRARIES=/usr/lib/aarch-linux-gnu/libpython3.5m.so -D PYTHON3_NUMPY_INCLUDE_DIRS=/usr/lib/python3.5/site-packages/numpy/core/include/ ..

我用的是cmake-gui编译的

cmake-gui安装方法:

终端输入

sudo apt-get install cmake-qt-gui 

使用时在终端输入

$ cmake-gui

选择源码位置,即OpenCV文件夹,

编译的位置:~/opencv3.4/build

1. configure

2. 勾选选项

3. configure

4. generate

Error:

CMakeFiles/example_gpu_driver_api_multi.dir/driver_api_multi.cpp.o: Infunction `destroyContexts()':

driver_api_multi.cpp:(.text._Z15destroyContextsv+0xc): undefined referenceto `cuCtxDestroy_v2'

driver_api_multi.cpp:(.text._Z15destroyContextsv+0x1c): undefinedreference to `cuCtxDestroy_v2'

CMakeFiles/example_gpu_driver_api_multi.dir/driver_api_multi.cpp.o: Infunction `Worker::operator()(int) const':

driver_api_multi.cpp:(.text._ZNK6WorkerclEi+0x19): undefined reference to`cuCtxPushCurrent_v2'

driver_api_multi.cpp:(.text._ZNK6WorkerclEi+0x6bf): undefined reference to`cuCtxPopCurrent_v2'

 

解决方法:

Only two example will affect by this bug,"example_gpu_driver_api_multi" and"example_gpu_driver_api_stereo_multi" 

Modify line 50:

target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS}${OPENCV_GPU_SAMPLES_REQUIRED_DEPS})

to

target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS}${OPENCV_GPU_SAMPLES_REQUIRED_DEPS} cuda)

in "opencv-3.4.1/samples/gpu/CMakeLists.txt" can easily fixthis problem

 上述方法会出现新的错误:/usr/bin/ld:cannot find -lopencv_cudaobjdetectcuda

因此改用下面的方法修改Cmakelist.txt文件:

foreach(sample_filename ${all_samples})
   ocv_define_sample(tgt ${sample_filename} gpu)
   ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS})
  if(HAVE_CUDA AND NOT ANDROID)
    ocv_target_link_libraries(${tgt} ${CUDA_CUDA_LIBRARY})
  endif()

   if(HAVE_opencv_xfeatures2d)
     ocv_target_link_libraries(${tgt} opencv_xfeatures2d)
   endif()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值