1. 程式人生 > 實用技巧 >xavier NX編譯caffe錯誤記錄(二)

xavier NX編譯caffe錯誤記錄(二)

由於某種原因對xavier NX重新刷機了,然後重新編譯caffe,再次重新記錄下編譯caffe過程中遇到的錯誤,解決錯誤的過程中很多都是用到了apt-get安裝一些依賴庫,因此最好先更改xavier NX的源頭,更該方法如下:

https://blog.csdn.net/u013171226/article/details/107680339

一:./include/caffe/common.hpp:4:10: fatal error: boost/shared_ptr.hpp: No such file or directory

sudo apt-get install libboost-all-dev  #報錯 libboost-all-dev : Depends: libboost-mpi-dev but it is not going to be installed    Depends: libboost-mpi-python-dev but it is not going to be installed
sudo apt-get install libboost-mpi-dev  #報錯libboost-mpi-dev : Depends: libboost-mpi1.58-dev but it is not going to be installed
apt-get install libboost-mpi1.58-dev  #報錯libboost-mpi1.58-dev : Depends: mpi-default-dev but it is not going to be installed
apt-get install mpi-default-dev  #報錯mpi-default-dev : Depends: libopenmpi-dev but it is not going to be installed
apt-get install libopenmpi-dev  #報錯libopenmpi-dev : Depends: libibverbs-dev (>= 1.1.7) but it is not going to be installed  Depends: libhwloc-dev but it is not going to be installed
apt-get install libibverbs-dev  #報錯libibverbs-dev : Depends: libibverbs1 (= 1.1.8-1.1ubuntu2) but 17.1-1ubuntu0.2
is to be installed

於是先解除安裝掉,然後重灌,重灌之後就是1.1.8版本了,命令如下

apt-get remove --purge libibverbs1
apt-get install libibverbs1

然後倒序把依賴全部安裝上,終端輸入history命令可以看到之前的命令,然後依次倒序安裝即可。

   37  sudo apt-get install libboost-all-dev
   38  apt-get install libboost-mpi-dev
   39  apt-get install libboost-mpi1.58-dev
   40  apt-get install mpi-default-dev
   41  apt-get install libopenmpi-dev
   42  apt-get install libibverbs-dev
   43  apt-get remove --purge libibverbs1
   44  apt-get install libibverbs1
   45  history

在依次逆序安裝的時候還是會提示某個庫依賴另一個的庫的情況,就按照上面的方法進行安裝就好了,遇到需要的版本不一致的就先解除安裝再重灌,不再重複了。

二:./include/caffe/common.hpp:5:10: fatal error: gflags/gflags.h: No such file or directory

sudo apt-get install libgflags-dev

三:./include/caffe/common.hpp:6:10: fatal error: glog/logging.h: No such file or directory

sudo apt-get install libgoogle-glog-dev

四:./include/caffe/proto/caffe.pb.h:9:10: fatal error: google/protobuf/stubs/common.h: No such file or directory

sudo apt-get install libprotobuf-dev protobuf-compiler

五:./include/caffe/util/mkl_alternate.hpp:14:10: fatal error: cblas.h: No such file or directory

sudo apt-get install libatlas-base-dev  #報錯libatlas-base-dev : Depends: libatlas3-base (= 3.10.2-9) but it is not going to be installed   Depends: libatlas-dev but it is not going to be installed
sudo apt-get install libatlas3-base

然後發現了一個問題,安裝到這裡之後發現刷機自帶的oppencv4不見了,最開始還是能搜到刷機自帶的opencv4的,大約是第四第五步的之後才消失的。

六:./include/caffe/util/bbox_util.hpp:2:10: fatal error: opencv2/core/core.hpp: No such file or directory

apt-get install libopencv-dev  #libopencv-dev : Depends: libopencv (= 4.1.1-2-gd5a58aa75) but it is not going to be installed
apt-get install libopencv  #libopencv : Depends: libavcodec57 (>= 7:3.4.6) but it is not installable or  libavcodec-extra57 (>= 7:3.4.6) but it is not installable  Depends: libavformat57 (>= 7:3.4.6) but it is not installable
apt-get install libavcodec57  #E: Package 'libavcodec57' has no installation candidate

於是去https://pkgs.org/網站下載libavcodec57_3.4.8-0ubuntu0.2_arm64.deb,然後

於是在該網站繼續下載這三個安裝包,然後

   31  sudo dpkg -i libavutil55_3.4.8-0ubuntu0.2_arm64.deb 
   32  sudo dpkg -i libswresample2_3.4.8-0ubuntu0.2_arm64.deb 
   33  sudo dpkg -i libx265-146_2.6-3_arm64.deb 
   34  sudo dpkg -i libavcodec57_3.4.8-0ubuntu0.2_arm64.deb 

同樣去網站下載下面的兩個安裝包進行安裝

   39  sudo dpkg -i libchromaprint1_1.4.3-1_arm64.deb 
   40  sudo dpkg -i libavformat57_3.4.8-0ubuntu0.2_arm64.deb 

然後安裝opencv

  122  apt-get install libopencv
  123  apt-get install libopencv-dev

七:./include/caffe/proto/caffe.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is

感覺這個環境越來越奇怪了。

這個問題在https://blog.csdn.net/u013171226/article/details/107680343裡面有了,

八:error: ‘

CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT’ was not declared in this scope

自己從下載最新的caffe原始碼編譯了一下,發現還是報錯,於是放棄刷機自帶的cudnn8,從xavier板子上拷貝cuda10和cudnn7,需要拷貝的檔案為:

cuda

從xavier上把/usr/local/cuda-10.0拷貝到NX的/usr/local/cuda-10.0

cudnn:

/usr/lib/aarch64-linux-gnu/libcudnn.so.7.5.0---->/usr/lib/aarch64-linux-gnu/libcudnn.so.7----->/etc/alternatives/libcudnn_so*----->/usr/lib/aarch64-linux-gnu/libcudnn.so:直接把/usr/lib/aarch64-linux-gnu/libcudnn.so.7.5.0拷貝過來然後重新命名為/usr/lib/aarch64-linux-gnu/libcudnn.so

/usr/include/cudnn.h---->/etc/alternatives/libcudnn---->/usr/include/aarch64-linux-gnu/cudnn_v8.h:直接把 /usr/include/cudnn.h刪掉,然後吧xavier的/usr/include/aarch64-linux-gnu/cudnn_v7.h拷貝過來,然後重新命名位cudnn.7