tensorflow error:C++ compilation of rule '//tensorflow/core/kernels:broadcast_to_op' failed(Exit 4)

最近在编译TensorFlow源码,用于 生成.so文件,在用命令编译pip_pakage时,出现错误:

bazel build -c opt //tensorflow/tools/pip_package:build_pip_package

C++ compilation of rule ‘//tensorflow/core/kernels:broadcast_to_op’ failed(Exit 4)

后来查询得知是编译过程中swap空间不足引起的,采用以下方法可以正常编译:

bazel build -c opt //tensorflow/tools/pip_package:build_pip_package --local_resources 2048,.5,1.0

增加 --local_resources 2048,.5,1.0 使得bazel同一时刻产生不超过一个编译器进程。

参考:

  1. Tensorflow on Android:https://www.oreilly.com/learning/tensorflow-on-android
  2. Tensorflow官方Android demo部署到手机:https://blog.csdn.net/weixin_39653948/article/details/82660026
  3. 错误链接参考:https://www.cnblogs.com/dakewei/p/10276312.html

你可能感兴趣的:(深度学习)