Skip to content

Cross-compiling should use the appropriate SDK's stdlib rather than rebuilding it #3305

@jfirebaugh

Description

@jfirebaugh

Currently cross-compiles via --platforms or go_cross_binary result in rebuilding the stdlib from scratch, which is slow and expensive.

Instead, cross compiles should use the prebuilt stdlib from the appropriate SDK. I'm not familiar with the details, but perhaps the functionality introduced in #3261 is helpful to support this.

What version of rules_go are you using?

v0.35.0

What version of gazelle are you using?

v0.26.0

What version of Bazel are you using?

Bazelisk version: development
Build label: 5.3.1
Build target: bazel-out/darwin_arm64-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Sep 19 17:37:11 2022 (1663609031)
Build timestamp: 1663609031
Build timestamp as int: 1663609031

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

Yes

What operating system and processor architecture are you using?

macOS. Tested on both Intel and arm64, same result.

Any other potentially useful information about your toolchain?

What did you do?

Run bazel aquery --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 'mnemonic("GoStdlib.*", deps(//tests/examples/executable_name:some_binary))' --output=summary.

What did you expect to see?

No GoStdlib mnemonics.

What did you see instead?

Mnemonics:
  GoStdlib: 1
  GoStdlibList: 1

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