安装protobuf
下载protobuf源代码
sudo apt-get install autoconf automake libtool curl
git clone https://github.com/google/protobuf
cd protobuf
注意的是gmock由于网络的原因无法下载,需要我们翻墙联网。
编译与安装protobuf
./autogen.sh
./configure
make
make check
sudo make install
sudo ldconfig
默认的安装路径是/usr/local/lib。
安装ncnn
git clone https://github.com/Tencent/ncnn
下载完成后,需要对源码进行编译
cd ncnn
mkdir build && cd build
cmake …
-- CMAKE_INSTALL_PREFIX = /home/tclxa/ncnn/build/install
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tclxa/ncnn/build
make -j8
[ 1%] Running C++ protocol buffer compiler on onnx.proto
[ 2%] Running C++ protocol buffer compiler on caffe.proto
[ 4%] Built target mxnet2ncnn
[ 90%] Built target ncnn
Scanning dependencies of target onnx2ncnn
[ 92%] Built target ncnn2mem
[ 95%] Building CXX object tools/onnx/CMakeFiles/onnx2ncnn.dir/onnx.pb.cc.o
[ 95%] Building CXX object tools/onnx/CMakeFiles/onnx2ncnn.dir/onnx2ncnn.cpp.o
Scanning dependencies of target caffe2ncnn
[ 96%] Building CXX object tools/caffe/CMakeFiles/caffe2ncnn.dir/caffe2ncnn.cpp.o
[ 97%] Building CXX object tools/caffe/CMakeFiles/caffe2ncnn.dir/caffe.pb.cc.o
/home/tclxa/ncnn/tools/onnx/onnx2ncnn.cpp: In function ‘int main(int, char**)’:
/home/tclxa/ncnn/tools/onnx/onnx2ncnn.cpp:463:32: warning: unused variable ‘output_name’ [-Wunused-variable]
const std::string& output_name = node.output(j);
^~~~~~~~~~~
/home/tclxa/ncnn/tools/onnx/onnx2ncnn.cpp:1397:81: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘google::protobuf::int64 {aka long int}’ [-Wformat=]
fprintf(stderr, " # %s=%d\n", attr.name().c_str(), attr.i());