繁体   English   中英

在 iOS 上为 Tensorflow Lite 构建 static 框架

[英]Build static framework fro Tensorflow Lite on iOS

我正在尝试为 iOS 交叉编译 Tensorflow Lite(2.5,夜间构建)。 我想构建一个 static 框架。 这是我使用的构建命令:

bazel build --config=ios_arm64 -c opt //tensorflow/lite/ios:TensorFlowLiteC_framework

TensorFlowLiteC_framework 目标在 tensorflow/tensorflow/lite/ios/BUILD.apple 中定义为

tflite_ios_static_framework(
    name = "TensorFlowLiteC_framework",
    hdrs = [
        ":c_api.h",
        ":common.h",
        ":xnnpack_delegate.h",
        "//tensorflow/lite/c:c_api_types.h",
    ],
    allowlist_symbols_file = ":allowlist_TensorFlowLiteC.txt",
    bundle_name = "TensorFlowLiteC",
    minimum_os_version = TFL_MINIMUM_OS_VERSION,
    deps = [
        ":tensorflow_lite_c",
    ],
)

我曾期望生成的框架是 static 框架,但它似乎是一个动态框架。 TensorFlowLiteC.framework文件夹中,有一个二进制文件TensorFlowLiteC 如果我做file TensorFlowLiteC ,我得到:

TensorFlowLiteC: Mach-O universal binary with 1 architecture: [arm64:Mach-O 64-bit object arm64]
TensorFlowLiteC (for architecture arm64):   Mach-O 64-bit object arm64

这对我来说似乎是一个动态库文件。 据我所知,如果这是 static 档案,我应该得到: current ar archive

有没有办法将 Tensorflow Lite 构建到 iOS 的实际 static 框架中?

如果要使用 static 框架,可以使用以下命令构建 TensorFlowLiteC static 框架:

bazel build --config=ios_fat -c opt //tensorflow/lite/ios:TensorFlowLiteC_static_framework

object中的 object 表示该文件是 object 文件。 它不是 object 文件的存档,而是单个 object 文件。

谷歌作为“动态”分发的框架实际上是一个 static 框架,并且应该生成 static 框架的命令在 2022 年不起作用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM