MNN编译环境配置—Linux

(按照步骤2安装:
gcc:7.5.0
g++:7.5.0
protoc:3.12.0
cmake:3.10

Protocol Buffers配置

1、Python版本

Step1:安装protobuf
  1. # version = 3.12.0,需要与系统版本一致
  2. pip install -i https://douban.pypi.com/simple/ protobuf

Step2: 下载二进制bin文件,安装Protocol Compiler v3.0.0
  1. # 使用以下命令会默认安装Protobuf 3+版本,对于TensorFlowkennel导致问题
  2. sudo apt-get install protobuf-compiler

2、All版本,源码安装

Step1: On Ubuntu/Debian, you can install them with:
  1. sudo apt-get install autoconf automake libtool curl make g++ unzip

Step2: To get the source, download one of the release .tar.gz or .zip packages in the release page:
  1. # if you need C++ and multiple other languages, download protobuf-all-[VERSION].tar.gz.
  2. https://github.com/protocolbuffers/protobuf/releases/latest

Step3: You can also get the source by “git clone” our git repository. Make sure you have also cloned the submodules and generated the configure script (skip this if you are using a release .tar.gz or .zip package):
  1. git clone https://github.com/protocolbuffers/protobuf.git
  2. cd protobuf
  3. git submodule update --init --recursive
  4. ./autogen.sh

Step4: To build and install the C++ Protocol Buffer runtime and the Protocol Buffer compiler (protoc) execute the following:
  1. ./configure
  2. make
  3. make check
  4. sudo make install # !!!
  5. sudo ldconfig # refresh shared library cache.

Step5: If “make check” fails, you can still install, but it is likely that some features of this library will not work correctly on your system. Proceed at your own risk.

Hint on install location

By default, the package will be installed to /usr/local. However, on many platforms, /usr/local/lib is not part of LD_LIBRARY_PATH. You can add it, but it may be easier to just install to /usr instead. To do this, invoke configure as follows:

  1. ./configure --prefix=/usr

Step6: 检查版本
  1. # libprotoc 3.12.3
  2. protoc --version

Cmake安装-Linux

1、sudo apt-get install cmake

此方式安装方便,缺点是如果想要自己编译Android平台的opencv会提示版本太低,因为ubuntu16.04源里的cmake版本只有3.5.1,而Android交叉编译工具链android.toolchain.cmake要求cmake最低版本是3.6.0。

2、源码安装

Step1: 下载cmake-3.18.0-rc2版本源码

Step2: 安装
  1. ./bootstrap
  2. make -j8
  3. sudo make install
  4. # 验证版本
  5. cmake --version

MNN编译环境配置-Windows(Fail)

环境要求

  • Microsoft Visual Studio (2017或者以上)
  • cmake(建议使用3.10或以上版本)
  • powershell
  • Ninja(构建工具,比nmake更快)

环境配置

cmake安装

Ninja安装

Win10+vs2019编译例程