C++ 在raspberry pi上构建libtensorflow.so时出错
问题陈述:我想使用Golang TensorFlow在Raspberry PI 3中运行我的模型。要使用TySoFraseGo,我需要有<强> LbTunSoFr.S.< /Sturial>和<强> LbTySoFr.Fr.Frase.Suth/Stult+C++共享库。 我试图使用bazel v0.20.0从源代码构建,但最终遇到了一个问题并出错 目标:为tensorflow r1.11.0或r1.12.0构建libtensorflow.so 感谢您的帮助C++ 在raspberry pi上构建libtensorflow.so时出错,c++,tensorflow,go,bazel,C++,Tensorflow,Go,Bazel,问题陈述:我想使用Golang TensorFlow在Raspberry PI 3中运行我的模型。要使用TySoFraseGo,我需要有 LbTunSoFr.S.< /Sturial>和 LbTySoFr.Fr.Frase.Suth/Stult+C++共享库。 我试图使用bazel v0.20.0从源代码构建,但最终遇到了一个问题并出错 目标:为tensorflow r1.11.0或r1.12.0构建libtensorflow.so 感谢您的帮助 我找到了解决方案: I found soluti
我找到了解决方案:
I found solution:
Couple of things to take care.
***For Tensorflow < v1.5***
Follow instruction here: https://blog.meinside.pe.kr/TensorFlow-and-Go-on-Raspberry-Pi/
***For Tensorflow v1.11.0 - v1.12.0***
Install bazel:
1. Download bazel from link: https://github.com/bazelbuild/bazel/releases
for specific architecture.
2. Install bazel
chmod +x bazel-<version>-installer-linux-<arch>.sh
./bazel-<version>-installer-linux-<arch>.sh --user
Install protobuf:
1. Build/Install protobuf from source.
https://github.com/protocolbuffers/protobuf/blob/master/src/README.md
Build Tensorflow:
1. Git clone
git clone https://github.com/tensorflow/tensorflow.git
2. Check and remove build from specific tensorflow version
go to: tensorflow/tensorflow/tools/ci_build/install/*_toolchain.sh [specific to your linux type and arch]
remove the bazel build and installation like as follows
look for the line: **rm -rf /usr/local/bin/bazel** and remove
and remove **bazel** from line **apt-get install -y ...**
then run
CI_DOCKER_EXTRA_PARAMS="-e CI_BUILD_PYTHON=python3 -e CROSSTOOL_PYTHON_INCLUDE_PATH=/usr/include/python3.6" tensorflow/tools/ci_build/ci_build.sh PI tensorflow/tools/ci_build/pi/build_raspberry_pi.sh
or
tensorflow/tools/ci_build/ci_build.sh PI tensorflow/tools/ci_build/pi/build_raspberry_pi.sh
or
tensorflow/tools/ci_build/ci_build.sh PI tensorflow/tools/ci_build/pi/build_raspberry_pi.sh PI_ONE
Output:
Output can be found here:
output-artifacts
output-artifacts/tensorflow-1.12.0-cp27-none-linux_armv7l.whl
output-artifacts/libtensorflow_framework.so
output-artifacts/benchmark_model
output-artifacts/libtensorflow.so
Dependency Versions:
Tensorflow Bazel protoc
<1.5 0.5.0 3.0 <any>
1.11.0-1.12.0 0.15.2 3.x <any>
>1.12.0 new vers <any>
有几件事需要注意。
***对于小于v1.5的Tensorflow***
请按照此处的说明操作:https://blog.meinside.pe.kr/TensorFlow-and-Go-on-Raspberry-Pi/
***对于Tensorflow v1.11.0-v1.12.0***
安装bazel:
1.从以下链接下载bazel:https://github.com/bazelbuild/bazel/releases
对于特定的体系结构。
2.安装bazel
chmod+xbazel——安装程序linux-.sh
./bazel——安装程序linux-.sh——用户
安装protobuf:
1.从源代码构建/安装protobuf。
https://github.com/protocolbuffers/protobuf/blob/master/src/README.md
构建Tensorflow:
1.Git克隆
git克隆https://github.com/tensorflow/tensorflow.git
2.检查并从特定tensorflow版本中删除生成
转到:tensorflow/tensorflow/tools/ci_build/install/*_toolchain.sh[特定于您的linux类型和arch]
移除bazel构建和安装,如下所示
寻找线路:*rm-rf/usr/local/bin/bazel**并移除
并将**bazel**从**行中删除,以便安装-y**
然后跑
CI_DOCKER_EXTRA_PARAMS=“-e CI_BUILD_PYTHON=python3-e CROSSTOOL_PYTHON_INCLUDE_PATH=/usr/INCLUDE/python3.6”tensorflow/tools/CI_BUILD.sh PI tensorflow/tools/CI_BUILD/PI/BUILD\u raspberry\u PI.sh
或
tensorflow/tools/ci_build/ci_build.sh PI tensorflow/tools/ci_build/PI/build_raspberry_PI.sh
或
tensorflow/tools/ci_build/ci_build.sh PI tensorflow/tools/ci_build/PI/build_raspberry_PI.sh PI_ONE
输出:
可在此处找到输出:
输出伪影
输出工件/tensorflow-1.12.0-cp27-none-linux_armv7l.whl
输出工件/libtensorflow_framework.so
输出工件/基准测试模型
输出工件/libtensorflow.so
依赖项版本:
Tensorflow Bazel协议
1.12.0新版本
您好,欢迎来到SO。请环顾四周,看看如何制作最小、完整和可验证的示例。这个社区愿意帮助你。因此,考虑更新你的问题分享更多的见解。你应该至少显示错误。