Skip to content

Build notes for arm64 / Apple Silicon #1516

@a-staebler

Description

@a-staebler

Hello,

I managed to get a build working with bazel on Apple Silicon. I'm not very familiar with bazel. Here are the tweaks and shortcuts I took:

  • JDK installed with brew install openjdk@11.
  • Instruct bazel to use local jdk.
  • Work around linker issues and build errors.

This led to the following changes in .bazelrc after build --copt -DGRPC_BAZEL_BUILD:

build --copt=-DBUILD_TESTING=OFF
build --copt=-DABSL_FORCE_THREAD_IDENTITY_MODE=0
build --define=ABSOLUTE_JAVABASE=/opt/homebrew/opt/java11
build --host_javabase=@bazel_tools//tools/jdk:absolute_javabase
build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla
build:macos --features=-supports_dynamic_linker

My goal was to disable test builds but I did not succeed with the first copt line for http client. As a workaround i excluded it based on the test tag. I also had to work around an openssl build error in thrift, so I excluded jaeger.

This lead to the following successful build command:

bazel query '//... except attr(tags, "test|jaeger", //...)' | xargs bazel build

Thanks to @seemk for helping me with the tricky bazel configuration parts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions