一、
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_cublas_device_LIBRARY (ADVANCED)
linked by target "lidar_apollo_cnn_seg_detect" in directory /home/autoware/shared_dir/ros_pp/src/lidar_apollo_cnn_seg_detect
1.改变cmake版本
2。这个cmake版本的选择跟cuda版本有关。
3。目前已经改过两个版本
cuda10 可以用cmake-3.14.3
cuda10.2 可以用cmake-3.17
4。关于ros下面使用sudo apt autoremove cmake 会连带把ros好多包都卸掉。
4.1 下载新版本并安装
./bootstrap && make && sudo make install
默认安装在/usr/local/share/
4.2 删掉cmake原来的版本文件 就直接 sudo rm -r cmake-3.10
4.3 查看cmake --version
可能会显示
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/share/cmake-3.10
cmake version 3.10
在终端输入 hash -r。应该就正确了。
二、
error:iota is not a member of std
说需要在cmakelists.txt添加
add_compile_options(-std=c++11)
不管用。
经查找发现缺乏头文件
#include <numeric>
就对了。
三、
caffe的安装
1。下载源码
2。
git clone https://github.com/BVLC/caffe
cd caffe
make all
make test
make runtest
3.先安装依赖库
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libopenblas-dev liblapack-dev libatlas-base-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler libatlas-base-dev
sudo apt-get install python-dev python-pip gfortran
4.make all 之前呢,需要根据自己需求对Makefile.config进行更改。
我的需求,gpu、cudnn、opencv。所以,进行了如下更改。
cp Makefile.config.example Makefile.config
针对makefile.config
1。如果需要使用cudnn,把注释去掉。
USE_CUDNN := 1
2。如果使用opencv且版本为3,则去掉注释。
OPENCV_VERSION := 3
3。根据cuda版本号,添加注释。比如我的是cuda10>cuda9,则删掉20,21。
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.
CUDA_ARCH :=
#-gencode arch=compute_20,code=sm_20 \
#-gencode arch=compute_20,code=sm_21 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_52,code=sm_52 \
-gencode arch=compute_60,code=sm_60 \
-gencode arch=compute_61,code=sm_61 \
-gencode arch=compute_61,code=compute_61
4。把INCLUDE_DIRS、LIBRARY_DIR用以下两行代码进行替换,其实就是添加了hdf5的路径。
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial
5。更改makefile里的地方。Attention,PLEASE!
把181行改成如下:也就是解决hdf5找不到的问题。
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
5.在caffe路径下
make distribute
6.使用,在cmakelists.txt中
set(CAFFE_PATH "$ENV{HOME}/shared_dir/caffe/distribute") #distribute路径