ncnn之二:Linux环境下ncnn安装+protobuf+opencv

1 安装g++

$ sudo apt-get install build-essential

2 安装cmake

# 下载地址: https://cmake.org/
$ tar -xvf cmake-3.16.0-rc1.tar.gz
$ chmod -R 777 cmake-3.16.0-rc1
# 检测gcc和g++是否安装 
$ sudo apt-get install build-essential
$ cd cmake-3.16.0-rc1
$ sudo ./bootstrap 
$ sudo make 
$ sudo make install 

参考: https://blog.csdn.net/libo2017/article/details/90084742

3 安装 protobuf

online:

$ sudo apt-get install autoconf automake libtool curl make g++ unzip
$ git clone https://github.com/google/protobuf.git
$ cd protobuf
$ git submodule update --init --recursive
$ ./autogen.sh
$ ./configure
$ make
$ make check
$ sudo make install
$ sudo ldconfig  #refresh shared library cache.

参考: https://blog.csdn.net/halazi100/article/details/85846858

offline:

# 下载地址:https://github.com/google/protobuf/releases
$ tar -xvf protobuf-cpp-3.10.0.tar.gz
$ cd protobuf-3.10.0 
$ ./configure --prefix=/usr/local/protobuf 
$ make 
$ make check 
$ sudo make install
$ protoc –version

4 安装opencv

# https://opencv.org/releases.html
$ unzip opencv-3.4.0.zip 
$ cd opencv-3.4.0/
$ mkdir build
$ cd build/
$ cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
$ sudo make instal
# 查看opencv版本
$ pkg-config --modversion opencv

5 安装ncnn

$ git clone https://github.com/Tencent/ncnn
$ cd <ncnn-root-dir>
$ mkdir -p build
$ cd build
$ cmake ..
$ make -j4
Logo

更多推荐