When rebuilding tensorflow for android I'm getting a fatal error: 'stdlib.h' file not found

When rebuilding tensorflow for android I'm getting a fatal error: 'stdlib.h' file not found

在 Ubuntu 16.04 中,当 运行 使用我的 protobuf 文件执行 Android Tensorflow TFDetect 实现时,我收到一条错误消息 "No OpKernel was registered to support Op 'ceil'"。我必须修改移动版本以包含正确的 .cc 文件,然后我继续运行以下命令在重建 Tensorflow 后构建 jar:

bazel build -c opt //tensorflow/contrib/android:libtensorflow_inference.so
--crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a

然后我收到错误消息,指出由于缺少 stdlib.h,构建未完成:

In file included from external/androidndk/ndk/sources/cxx-stl/gnu-libstdc++/4.9/include/algorithm:62: In file included from external/androidndk/ndk/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/stl_algo.h:59: external/androidndk/ndk/sources/cxx-stl/gnu-libstdc++/4.9/include/cstdlib:72:10: fatal error: 'stdlib.h' file not found

我看到很多其他人被告知要使用预构建的二进制文件,但这对我不起作用,因为我需要一些额外的内核,这些内核是为移动设备而剥离的。

有人对我如何构建必要的 android jar 有任何想法吗?

嗯,我发现了问题。在下面的 link 中,它指出 NDK 版本 16 不支持 bazel。我最初安装了 14b,但有一次当我在 Android Studio 中打开我的项目时,它要求更新 NDK我升级了。当我碰巧解决这个问题时,我注意到它是版本 16,然后最终删除它并安装版本 14。重建所有源代码然后执行上述对 bazel 的调用后,一切都顺利进行。我犯了一个愚蠢的错误。

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/android/README.md