从一开始装ubuntu到调通这个代码,一共花了7天时间,反正期间遇见各种各样的问题,对linux下编程,cmake什么的也是一窍不通,终于终于在今天,目标检测部分的代码成功运行了,真的要哭了
把期间遇到的问题都记录下来了,希望能帮到同样烦恼的你~~
感谢博主http://blog.csdn.net/tingyue_/article/category/5604219的分享,真的帮到好多
还有啊,大家遇到问题记得google
下面就开始吧~~
根据代码提示文档安装需要的各种库之后
step1:
1、更改common_settings.cmake文档中的第342行:把the_name_of_your_machine 改成你的计算机名,如何知道自己的计算机名嘞?
cd /bin
./hostname
2、在代码目录下运行generate_protocol_buffer_files.sh,检查protocol buffer版本的合理性
./generate_protocol_buffer_files.sh
step 2:编译`doppia/src/applications/ground_estimation`部分代码
step 3:同样的方式编译stixel_world部分代码
(step2 &3 根据代码的readme编译就可以了,如果库什么的安装成功的话应该没有问题,这两部分只是c++代码,没有用到cuda)
step 4:编译object_detection部分代码,这部分代码有用到cuda,然后出问题了。。。。
1、
cuda设置环境变量:这个只对当前程序有用,若重新开终端,又要重新设置
<span style="font-family:KaiTi_GB2312;font-size:14px;"><code class="hljs ruby has-numbering">export <span class="hljs-constant">PATH</span>=<span class="hljs-regexp">/usr/local</span><span class="hljs-regexp">/cuda-7.0/bin</span><span class="hljs-symbol">:</span><span class="hljs-variable">$PATH</span> export <span class="hljs-constant">LD_LIBRARY_PATH</span>=<span class="hljs-regexp">/usr/local</span><span class="hljs-regexp">/cuda-7.0/lib</span>64<span class="hljs-symbol">:</span><span class="hljs-variable">$LD_LIBRARY_PATH</span> </code></span>
cuda库路径和包含路径设置(common_settings.cmake文档中加入自己电脑的设置):
<span style="font-family:KaiTi_GB2312;font-size:12px;">elseif(${HOSTNAME} STREQUAL "xiaowenzi-HP-ProDesk-680-G1-TWR")
# change the_name_of_your_machine to what /bin/hostname returns
message(STATUS "Using the_name_of_your_machine compilation options")
# start with an empty section, and see what fails as you go through the readme.text instructions
option(USE_GPU "Should the GPU be used ?" TRUE)
set(CUDA_BUILD_CUBIN OFF)
set(local_CUDA_LIB_DIR "/usr/local/cuda-7.0/lib64")
set(CUDA_INCLUDE_DIRS "/usr/local/cuda-7.0/include")
set(cuda_LIBS "")</span><span style="font-size:14px;">
</span>
2、
boost_1.58.0的问题
/usr/local/include/boost/variant/get.hpp:178:5: error: invalid application of ‘sizeof’ to incomplete type ‘boost::STATIC_ASSERTION_FAILURE<false>’
解决办法:
https://bitbucket.org/rodrigob/doppia/issues/84/the-problem-while-compiling
3、
<span style="font-family:KaiTi_GB2312;font-size:12px;"><code class="hljs avrasm has-numbering">src/objects_detection/SoftCascadeOverIntegralChannelsFastFractionalStage<span class="hljs-preprocessor">.cpp</span>:<span class="hljs-number">24</span>:<span class="hljs-number">9</span>: error: ‘<span class="hljs-keyword">swap</span>’ is not a member of ‘<span class="hljs-keyword">std</span>’ <span class="hljs-keyword">std</span>::<span class="hljs-keyword">swap</span>(weak_classifier<span class="hljs-preprocessor">.level</span>2_true_node, weak_classifier<span class="hljs-preprocessor">.level</span>2_false_node)<span class="hljs-comment">;</span></code></span>
解决办法:在出错文件中加入#include<iostream>
4、
问题:
<span style="font-size:18px;">gpuveryfastintegralchannelfeatrue........without gpu compile.......</span>
解决办法:在makelist.txt文件开头加入
<span style="font-size:18px;">option(USE_GPU "Should the GPU be used ?" TRUE)</span>
删掉原来的编译生成的文件,重新编译
5、
问题 :
<span style="font-size:18px;">opencv-2.4.11/modules/gpu/include/opencv2/gpu/device/detail/transform_detail.hpp:320: error: (-217) invalid device function in function call</span>
解决办法:网上解释说编译opencv时设置CUDA的运行能力要和CUDA的实际运行能力一致,所以,又重新编译了一次opencv,在cmake的时候加上cuda计算能力的参数:
<span style="font-size:18px;">cmake -D CUDA_ARCH_BIN=5.0 -D CUDA_ARCH_PTX=5.0 </span>
注意此处的5.0根据安装的版本而定(进入usr/local/cuda-7.0/samples//bin/x86_64/linux/release目录,终端运行
./deviceQuery
就可以得到)
把原来编译object_detection生成的文件都删掉,重新编译,运行就成功了!!!