Build ios with bazel on mac mini m1 hosted machine

Viewed 27

I rented a Mac mini G5A AS/M1/8C/8G/256G/SSD on macstadium, I installed xcode and command line tools, when I "bazel build" I get this error:

ERROR: /private/var/tmp/_bazel_administrator/817b3a428d4281fbfa50ce6dccf87632/external/local_config_cc/BUILD:48:19: in cc_toolchain_suite rule @local_config_cc//:toolchain: cc_toolchain_suite '@local_config_cc//:toolchain' does not contain a toolchain for cpu 'ios_sim_arm64'

Here is my .bazelrc file contents:

build \

  --compilation_mode=fastbuild \

  --worker_sandboxing=false \

  --strategy=SwiftCompile=local \

  --features=swift.cacheable_swiftmodules \

  --apple_platform_type=ios \

  --xcode_version=13.4 \

  --ios_minimum_os=14.5 \

  --ios_simulator_device="iPhone 13" \

  --ios_simulator_version=15.5 \

  --ios_multi_cpus=x86_64

  --progress_report_interval=1 \

  --subcommands \

  --sandbox_debug \

  --announce_rc \

  --features=swift.use_global_module_cache \

  --action_env=PATH=/usr/bin:/bin \

  --action_env=BAZEL_IGNORE_SYSTEM_HEADERS_VERSIONS=1 \

  --spawn_strategy=local \

  --verbose_failures \

Here is my WORKSPACE.bazel file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "build_bazel_rules_apple",
    sha256 = "a19cf84dd060eda50be9ba5b0eca88377e0306ffbc1cc059df6a6947e48ac61a",
    url = "https://github.com/bazelbuild/rules_apple/releases/download/1.1.1/rules_apple.1.1.1.tar.gz",
)

load(
    "@build_bazel_rules_apple//apple:repositories.bzl",
    "apple_rules_dependencies",
)

apple_rules_dependencies()

load(
    "@build_bazel_rules_swift//swift:repositories.bzl",
    "swift_rules_dependencies",
)

swift_rules_dependencies()

load(
    "@build_bazel_rules_swift//swift:extras.bzl",
    "swift_rules_extra_dependencies",
)

swift_rules_extra_dependencies()

load(
    "@build_bazel_apple_support//lib:repositories.bzl",
    "apple_support_dependencies",
)

apple_support_dependencies()

Bazel version: 5.3.0

Did anyone face a similar issue? Do you have any idea about this?

1 Answers

sudo xcode-select -s the Xcode app and then bazel clean --expunge fixed it.

Related