简体   繁体   English

带有 ARM 的 Mac M1 pro 机器中的 Mediapipe,在为 hello_world 构建 bazel 时面临 AUTORELEASEPOOL 问题

[英]Mediapipe in Mac M1 pro machine with ARM, facing issue with AUTORELEASEPOOL while bazel build for hello_world

I am using the latest Mac M1 pro (ARM) machine and was trying to install mediapipe as per this tutorial - https://google.github.io/mediapipe/getting_started/install.html#installing-on-macos .我正在使用最新的 Mac M1 pro (ARM) 机器并尝试按照本教程安装 mediapipe - https://google.github.io/mediapipe/getting_started/install.html#installing-on-macos

I was consistently getting the following error during this command:在此命令期间,我一直收到以下错误:

$ bazel run --define MEDIAPIPE_DISABLE_GPU=1 \
    mediapipe/examples/desktop/hello_world:hello_world

Error :错误

mediapipe/framework/scheduler_queue.cc:212:3: error: expected expression
  AUTORELEASEPOOL {
  ^
mediapipe/framework/scheduler_queue.cc:29:25: note: expanded from macro 'AUTORELEASEPOOL'

While looking into the error carefully and tracing back to the mediapipe framework file scheduler_queue.cc I found there is some issue in AUTORELEASEPOOL define.在仔细查看错误并回溯到 mediapipe 框架文件scheduler_queue.cc时,我发现 AUTORELEASEPOOL 定义中存在一些问题。

I've updated this line ''' #define AUTORELEASEPOOL @autoreleasepool ''' to ''' #define AUTORELEASEPOOL '''我已将此行 ''' #define AUTORELEASEPOOL @autoreleasepool ''' 更新为 ''' #define AUTORELEASEPOOL '''

and it works for me, as I'm able to build mediapipe hello_world as expected.它对我有用,因为我能够按预期构建 mediapipe hello_world。

Seems like, scheduler_queue.cc has not been written carefully considering this type of issues or maybe needs to be tested more.考虑到此类问题,scheduler_queue.cc 似乎没有仔细编写,或者可能需要进行更多测试。

Hopefully, this will help you all.希望这会对大家有所帮助。

Thanks谢谢

It looks like M1 Mac is not detected properly by Bazel as an apple build and a change in mediapipe/framework/BUILD needs to be done看起来 M1 Mac 没有被 Bazel 正确检测为苹果版本,需要更改mediapipe/framework/BUILD

cc_library(
    name = "scheduler_queue",
    srcs = ["scheduler_queue.cc"],
    hdrs = [
        "scheduler_queue.h",
        "scheduler_shared.h",
    ],
    copts = select({
    -        "//conditions:default": [],
    +        "//conditions:default": ["-ObjC++"],
        "//mediapipe:apple": [
            "-ObjC++",
        ],
    }),

This will allow Objective C++ directive @autoreleasepool to be available which is used here for memory management.这将允许 Objective C++ 指令@autoreleasepool可用,此处用于 memory 管理。 It is not a good idea to get rid of it in code (as in the answer from hemant kshirsagar).在代码中摆脱它不是一个好主意(如 hemant kshirsagar 的回答)。

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

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