概述
- codeblocks 安装
sudo apt-get
update
sudo apt-get install codeblocks codeblock-contrib
- Makefile编译
GPU=1
CUDNN=1
DEBUG= 1
make -j8
不详述
- debug 参考
https://blog.csdn.net/u012927281/article/details/86064511
1)新建项目。
2)添加源代码,这一次我更加直接,将darknet中的代码全部拷贝到了项目目录下。然后回到图形界面中右击“add file
recursively”,选择好源文件所在根目录后,直接选择“open”即可,codeblocks会自动地添加好所有文件,注意此处不会添加*.cu文件。3)在工程上右键,选择“Project setttings”,单击选择“This is a custom
Makefile”,单击右下角“ok”保存4)还是在工程上右键,选择“Project build options”,选择“Make
commands”,将其中“$targets”均删除。至此就可以开始编译了,单击“Build”按钮开始编译,如果在编译过程中出现“nvcc not
found”,首先明确cuda9.0已经安装,同时正确配置在.bashrc文件中。若上述步骤没有问题,可以尝试从命令行中启动codeblocks。推测产生上述问题的原因可能是codeblocks在启动时不加载.bashrc中的路径。通过以上步骤,darknet就已经完成编译了。
接下来是执行,右键工程,同样选择“properties”,选择“Build targets”,将output
filename改成darknet。单击“Debug”就可以开始调试了。通过上述流程就可以比较轻松的使用IDE进行调试。如果在启动过程中出现can’t find
libcuda等类似错误,还是由于在当前codeblocks中缺少LD_LIBRARY_PATH路径造成的,因此在codeblocks中添加环境变量。在codeblocks中添加环境变量的方法如此:1)点击“Setting”
2)选择“Environment settings”
3)选择“Environment variables”
4)添加LD_LIBRARY_PATH环境变量。
- DEBUG 追加
example:
./darknet detector train cfg/xxx.data cfg/yolov3.cfg xxx.weights
在Project ---> Set programs' arguments... ---> Debug--- > Program arguments:
添加 detector train cfg/xxx.data cfg/yolov3.cfg xxx.weights
点击 debug按钮即可
- 可能问题
ImportError: libcuda.so.1: cannot open shared object file: No such file or directory
添加 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/nvidia/lib64
做处理后试试
最后
以上就是耍酷中心为你收集整理的codeblocks使用Makefile编译和debug的全部内容,希望文章能够帮你解决codeblocks使用Makefile编译和debug所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复