Skip to content

Cannot build on Apple M1 clip 2021 #16639

Closed

Description

@tisonkun

Describe the bug

[ERROR] Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile (default) on project managed-ledger: An error occurred while invoking protoc: Error while executing process.: Cannot run program "/Users/chenzili/Workspace/pulsar/managed-ledger/target/protoc-plugins/protoc-3.19.2-osx-aarch_64.exe": error=86, Bad CPU type in executable -> [Help 1]

To Reproduce

On a macOS machine with properties:

  • MacBook Pro (16-inch, 2021)
  • Chip Apple M1 Pro

Clone pulsar code and execute mvn clean install -DskipTests

Expected behavior

Successfully compiled.

Additional context

protoc 3.19.2 dists osx-aarch_64 binary as an alias to the osx-x86_64 one.

Bumping the version to 3.21.2 resolves the issue.

I'll prepare a PR for this issue.

Activity

  1. added
    type/bug
    on Jul 18, 2022
  2. tisonkun commented on Jul 18, 2022

    @tisonkun
    MemberAuthor

    It seems barely bump the protoc version doesn't fix the issue entirely. Meet:

    [ERROR] PROTOC FAILED: /Users/chenzili/Workspace/pulsar/pulsar-functions/proto/target/protoc-plugins/protoc-gen-grpc-java-1.45.1-osx-aarch_64.exe: program not found or is not executable
    Please specify a program using absolute path or make sure the program is available in your PATH system variable
    --grpc-java_out: protoc-gen-grpc-java: Plugin failed with status code 1.
    
    [ERROR] /Users/chenzili/Workspace/pulsar/pulsar-functions/proto/src/main/proto/Request.proto [0:0]: /Users/chenzili/Workspace/pulsar/pulsar-functions/proto/target/protoc-plugins/protoc-gen-grpc-java-1.45.1-osx-aarch_64.exe: program not found or is not executable
    Please specify a program using absolute path or make sure the program is available in your PATH system variable
    --grpc-java_out: protoc-gen-grpc-java: Plugin failed with status code 1.
    
    [ERROR] /Users/chenzili/Workspace/pulsar/pulsar-functions/proto/src/main/proto/Function.proto [0:0]: /Users/chenzili/Workspace/pulsar/pulsar-functions/proto/target/protoc-plugins/protoc-gen-grpc-java-1.45.1-osx-aarch_64.exe: program not found or is not executable
    Please specify a program using absolute path or make sure the program is available in your PATH system variable
    --grpc-java_out: protoc-gen-grpc-java: Plugin failed with status code 1.
    
    [ERROR] /Users/chenzili/Workspace/pulsar/pulsar-functions/proto/src/main/proto/InstanceCommunication.proto [0:0]: /Users/chenzili/Workspace/pulsar/pulsar-functions/proto/target/protoc-plugins/protoc-gen-grpc-java-1.45.1-osx-aarch_64.exe: program not found or is not executable
    Please specify a program using absolute path or make sure the program is available in your PATH system variable
    --grpc-java_out: protoc-gen-grpc-java: Plugin failed with status code 1.
    
  3. tisonkun commented on Jul 18, 2022

    @tisonkun
    MemberAuthor

    Install Rosetta (see google/protobuf-gradle-plugin#543 (comment)) workaround the issue. However, we may bump version of protoc and grpc-java to get native osx-aarch_64 binary. protoc provides one at the moment while grpc-java plugin doesn't.

  4. tisonkun commented on Jul 18, 2022

    @tisonkun
    MemberAuthor

    I'd like to keep it open since we need some workaround instead of a native solution. This issue may remind me to see whether upstream provides a real osx-aarch_64 protoc-gen-grpc-java binary.

    Upstream issue: grpc/grpc-java#7690

  5. leizhiyuan commented on Aug 8, 2022

    @leizhiyuan
    Contributor

    now ,master branch can build in m1 (works for me)

  6. tisonkun commented on Aug 8, 2022

    @tisonkun
    MemberAuthor

    @leizhiyuan do you install Rosetta 2.0?

  7. leizhiyuan commented on Aug 8, 2022

    @leizhiyuan
    Contributor

    @leizhiyuan do you install Rosetta 2.0?

    yes..

  8. tisonkun commented on Aug 8, 2022

    @tisonkun
    MemberAuthor

    After consideration, I tend to close the issue as I cannot uninstall or disable Rosetta and reproduce the issue anymore.

    When grpc/grpc-java#7690 gets resolved we may directly try to upgrade the dep version. Or someone who has an M1 without Rosetta environment can verify then.

  9. chenrui333 commented on Apr 10, 2024

    @chenrui333

    Looks like apache-pulsar still does not support native arm build, can we maybe reopen this issue (or should I create a new one)?

    Also, github has arm build support now with macos-14 runner. https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions