构建libtensorflow_inference.so

时间:2018-05-22 10:22:29

标签: android python tensorflow

我在这些steps之后从源代码安装了tensorflow 在MacOS环境中。配置和使用bazel的构建是成功的,但是当我尝试生成 libtensorflow_inference.so 以在此link之后添加对我的Android应用程序的本机支持  在提供的链接中执行bazel build命令时出错。这是错误:

ERROR: /private/var/tmp/_bazel_aboussaada/60096eee641a597e34b524b059acf8b3/external/protobuf_archive/BUILD:265:1: Executing genrule @protobuf_archive//:generate_js_well_known_types_embed failed (Exit 126): bash failed: error executing command 
  (cd /private/var/tmp/_bazel_aboussaada/60096eee641a597e34b524b059acf8b3/execroot/org_tensorflow && \
  exec env - \
    PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/munki \
    PYTHON_BIN_PATH=/usr/local/opt/python@2/bin/python2.7 \
    PYTHON_LIB_PATH=/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages \
    TF_DOWNLOAD_CLANG=0 \
    TF_NEED_CUDA=0 \
    TF_NEED_OPENCL_SYCL=0 \
  /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/armeabi-v7a-opt/bin/external/protobuf_archive/js_embed external/protobuf_archive/src/google/protobuf/compiler/js/well_known_types/any.js external/protobuf_archive/src/google/protobuf/compiler/js/well_known_types/struct.js external/protobuf_archive/src/google/protobuf/compiler/js/well_known_types/timestamp.js > bazel-out/armeabi-v7a-opt/genfiles/external/protobuf_archive/src/google/protobuf/compiler/js/well_known_types_embed.cc')
/bin/bash: bazel-out/armeabi-v7a-opt/bin/external/protobuf_archive/js_embed: cannot execute binary file
Target //tensorflow/contrib/android:libtensorflow_inference.so failed to build
INFO: Elapsed time: 0,361s, Critical Path: 0,08s
INFO: 0 processes.
FAILED: Build did NOT complete successfully

我将NDK版本更改为r12b,因为我在thread之后使用了r14b并重建了tensorflow,但没有任何效果。 我正在使用python 2.7和最新版本的tensorflow。 任何帮助将不胜感激。

编辑:

我这次使用--recurse-submodules克隆了项目,以防止提到here的protobuf编译错误,我收到了一个新错误:

ERROR: /private/var/tmp/_bazel_aboussaada/60096eee641a597e34b524b059acf8b3/external/protobuf_archive/BUILD:265:1: Executing genrule @protobuf_archive//:generate_js_well_known_types_embed failed (Exit 126): bash failed: error executing command 
  (cd /private/var/tmp/_bazel_aboussaada/60096eee641a597e34b524b059acf8b3/execroot/org_tensorflow && \
  exec env - \
    PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/munki \
  /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/armeabi-v7a-opt/bin/external/protobuf_archive/js_embed external/protobuf_archive/src/google/protobuf/compiler/js/well_known_types/any.js external/protobuf_archive/src/google/protobuf/compiler/js/well_known_types/struct.js external/protobuf_archive/src/google/protobuf/compiler/js/well_known_types/timestamp.js > bazel-out/armeabi-v7a-opt/genfiles/external/protobuf_archive/src/google/protobuf/compiler/js/well_known_types_embed.cc')
/bin/bash: bazel-out/armeabi-v7a-opt/bin/external/protobuf_archive/js_embed: cannot execute binary file
Target //tensorflow/contrib/android:libtensorflow_inference.so failed to build
INFO: Elapsed time: 0,517s, Critical Path: 0,12s
INFO: 0 processes.
FAILED: Build did NOT complete successfully

0 个答案:

没有答案