OpenPose安装
新版CMake命令
cmake -DOpenCV_CONFIG_FILE=/mnt/sdb/yangbin/opencv-2.4.9/build/OpenCVConfig.cmake -DCaffe_INCLUDE_DIRS="/mnt/sdb/yangbin/caffe/include;/mnt/sdb/yangbin/caffe/build/include" -DCaffe_LIBS=/mnt/sdb/yangbin/caffe/build/lib/libcaffe.so -DBUILD_CAFFE=OFF -DPROFILER_ENABLED=ON -DBUILD_PYTHON=ON ..
1 安装protobuf依赖库
1.1 support依赖库
-
创建support文件夹(存放以下4个依赖库)
-
解压到support
m4-1.4.13.tar.gz autoconf-2.65.tar.gz automake-1.11.tar.gz libtool-2.2.6b.tar.gz
-
执行
(1) ./configure --prefix=/mnt/sdb/yangbin/local (2) make install
安装完m4需要设置一下$PATH,否则安装其他会报错。
此外,m4安装在yangbin/local/bin下,因此路径添加应为
export $PATH=/mnt/sdb/yangbin/local/bin:$PATH
1.2 protobuf安装
-
安装support里的所有库成功之后,进入protobuf文件夹,执行./autogen.sh,然后会生成一个configure文件,再执行
(1) ./autogen.sh (2) ./configure --prefix=/mnt/sdb/yangbin/local
-
完成后执行
(1) make -j4 (2) make install (3) protoc --version //查看版本号

https://blog.csdn.net/l297969586/article/details/80527317
2 snappy
下载地址:git clone https://github.com/google/snappy.git
- 然后在snappy文件夹下
(1) mkdir build
(2) cd build
(3) cmake -D CMAKE_INSTALL_PREFIX=/mnt/sdb/yangbin/local ..
(4) make
(5) make install

3 leveldb-1.19
-
3rdparty/下解压
make cp out-shared/libleveldb.so* /mnt/sdb/yangbin/local/lib & cp -R include/* /mnt/sdb/yangbin/local/include

4 boost-1.58
-
3rdparty/下解压
./bootstrap.sh --prefix=/mnt/sdb/yangbin/local ./b2 //尽量不要使用j8 ./b2 install //安装可能会出现权限不够

5 LMDB-0.9.17
-
3rdparty/下解压
cd lmdb-LMDB_0.9.17/libraries/liblmdb make mkdir /mnt/sdb/yangbin/local/man/man1 make prefix=/mnt/sdb/yangbin/local install

6 glog
-
参考文章
https://www.cnblogs.com/burningTheStar/p/6986048.html
-
Git
git clone https://github.com/google/glog
-
执行
(1) ./autogen.sh (2) ./configure --prefix=/mnt/sdb/yangbin/local (3) make -j4 (4) make install

-
如果出现找不到GFLAGS_NAMESPACE的情况,则首先编译gflags,并在cmake -D时加入
-DGFLAGS_NAMESPACE=google
7 gflags
-
Git
git clone https://github.com/gflags/gflags
-
执行
(1) mkdir build && cd build (2) cmake -D CMAKE_INSTALL_PREFIX=/mnt/sdb/yangbin/local -D BUILD_SHARED_LIBS=ON .. (3) make -j4 (4) make install

8 hdf5-1.8.20
-
3rdparty/下解压
-
执行
(1) ./configure --prefix=/mnt/sdb/yangbin/local (2) make -j4 (3) make check //耗时较长 慎用 (4) make install (5) make check-install

9 OpenCV-2.4.9
mkdir build && cd build
//下面cmake参数很重要
cmake -D CMAKE_BUILD_TYPE=RELEASE -D WITH_TBB=ON -D WITH_V4L=ON -D CMAKE_INSTALL_PREFIX=/mnt/sdb/yangbin/local -D BUILD_opencv_gpu=OFF -D CUDA_GENERATION=Kepler -D BUILD_JPEG=ON -D BUILD_TIFF=ON -D BUILD_PNG=ON ..

make -j4
make install

10 Caffe
- 编译caffe出现问题
找不到OpenCV

-
解决方案
在caffe的CMakeList中加入set(OpenCV_DIR "/mnt/sdb/yangbin/opencv-2.4.9/build")

在opencv-2.4.9/build/OpenCVConfig.cmake中加入
set(OpenCV_FOUND 1)

-
成功
caffe config.png
make all -j8

对‘cv::applyColorMap(cv::_InputArray const&, cv::_OutputArray const&, int)’未定义的引用
-
缺少contrib
caffeBug1.png
-
修改 caffe/cmake/Dependencies.cmake,添加 contrib
caffeBug1解决方法.png
-
成功
caffeBug1成功.png
因为在服务器下CUDA多版本冲突,无法找到自己的cuDNN
- 对caffe进行cmake时加上-D参数(cuDNN的头文件和库文件分别放在local文件夹的include和lib下)
cmake -DCUDNN_INCLUDE="/mnt/sdb/yangbin/local/include" -DCUDNN_LIBRARY="/mnt/sdb/yangbin/lib" ..
对‘__cxa_throw_bad_array_new_length@CXXABI_1.3.8’未定义的引用
- 对caffe进行cmake时加上
-DCMAKE_EXE_LINKER_FLAGS='-static-libstdc++'
参数
cmake -D CMAKE_EXE_LINKER_FLAGS='-static-libstdc++' ..
网友评论