我正在尝试在 macOS 上将 MediaPipe 构建为库,以便能够在带有 CMake 的桌面项目中使用它,但我遇到了问题。我正在尝试将 Hello World 示例转换为库,使用hello_world.ccMediaPipe 作为外部库。我也尝试过静态和动态库构建,但我都遇到了问题。
目前我陷入困境,任何帮助将不胜感激。
构建库的步骤和收到的错误如下:
作为静态库
mediapipe/lib/BUILD我创建了一个包含以下内容的文件apple_static_library(
name = "mediapipe",
minimum_os_version = "10.14",
platform_type = "macos",
deps = [
"//mediapipe/calculators/core:pass_through_calculator",
"//mediapipe/framework:calculator_graph",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:parse_text_proto",
"//mediapipe/framework/port:status",
],
)
Run Code Online (Sandbox Code Playgroud)
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/lib:mediapipe
Run Code Online (Sandbox Code Playgroud)
复制bazel-out/apl-darwin_x86_64-opt/bin/mediapipe/lib/mediapipe_lipo.a到我的桌面项目
项目已经构建没有错误,但是运行时出现以下错误:
Not found: ValidatedGraphConfig Initialization failed.
No registered object with name: PassThroughCalculator; Unable to find Calculator "PassThroughCalculator"
No registered object with name: PassThroughCalculator; Unable to find Calculator "PassThroughCalculator"
Run Code Online (Sandbox Code Playgroud)
我读到一些github问题,构建iOS动态库不会出现上述问题。