Skip to content

Binary that depends on cloudflare/circl can't be built cross-platform #4154

@aaomidi

Description

@aaomidi

What version of rules_go are you using?

0.50.1

What version of gazelle are you using?

0.39.1

What version of Bazel are you using?

7.4.0

Does this issue reproduce with the latest releases of all the above?

Yes

What operating system and processor architecture are you using?

Darwin ARM64

Any other potentially useful information about your toolchain?

This is related to the infamous circl dependency.

What did you do?

I have a go_binary that through a long list of dependencies ends up depending on circl. I do get circl from the BCR:

bazel_dep(
    name = "circl",
    version = "1.3.8",
)

My binary rule is defined as such:

go_binary(
    name = "api",
    embed = [":api_lib"],
    gotags = ["purego"],
    pure = "on",
)

I try to build it like:

bazel build //control-plane/api --platforms=@rules_go//go/toolchain:linux_arm64

My error:

ERROR: /private/var/tmp/_bazel_amir/3dbd0b78d662a8a6e641b2d6e1f7442e/external/bazel_tools/tools/cpp/BUILD:58:19: in cc_toolchain_alias rule @@bazel_tools//tools/cpp:current_cc_toolchain: 
Traceback (most recent call last):
        File "/virtual_builtins_bzl/common/cc/cc_toolchain_alias.bzl", line 26, column 48, in _impl
        File "/virtual_builtins_bzl/common/cc/cc_helper.bzl", line 225, column 17, in _find_cpp_toolchain
Error in fail: Unable to find a CC toolchain using toolchain resolution. Target: @@bazel_tools//tools/cpp:current_cc_toolchain, Platform: @@rules_go~//go/toolchain:linux_arm64, Exec platform: @@bazel_tools//tools:host_platform
ERROR: /private/var/tmp/_bazel_amir/3dbd0b78d662a8a6e641b2d6e1f7442e/external/bazel_tools/tools/cpp/BUILD:58:19: Analysis of target '@@bazel_tools//tools/cpp:current_cc_toolchain' failed

What did you expect to see?

I expected this build to not need the C++ toolchain.

What did you see instead?

An error for C++ toolchain.

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