ubuntu14 编译tensorflow C++ 接口
tensorflow1.11
bazel 0.15.2
protobuf 3.6.0
eigen 3.3.5
wget -t 0 -c https://github.com/eigenteam/eigen-git-mirror/archive/3.3.5.zip unzip 3.3.5.zip cd eigen-git-mirror-3.3.5/ mkdir build cd build cmake .. make sudo make install
编译tensorflow
./configure
我需要的是CPU环境调用 所以一路都是NO
有显卡的执行 sudo bazel build --config=opt --config=cuda //tensorflow:libtensorflow_cc.so
没有显卡的执行 sudo bazel build --config=opt //tensorflow:libtensorflow_cc.so
编译成功以后复制一些头文件
mkdir /usr/local/include/tf
cp -r bazel-genfiles/ /usr/local/include/tf/
cp -r tensorflow /usr/local/include/tf/
cp -r third_party /usr/local/include/tf/
cp bazel-bin/tensorflow/libtensorflow_cc.so /usr/local/lib/
cp bazel-bin/tensorflow/libtensorflow_framework.so /usr/local/lib
参考链接
http://www.liuxiao.org/2018/08/ubuntu-tensorflow-c-%E4%BB%8E%E8%AE%AD%E7%BB%83%E5%88%B0%E9%A2%84%E6%B5%8B1%EF%BC%9A%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/