Skip to content

Declare windows_utils.h as a header of cpuinfo on ARM64#467

Open
fmeum wants to merge 1 commit into
google:mainfrom
fmeum:cpuinfo-aarch64-windows-utils-hdr
Open

Declare windows_utils.h as a header of cpuinfo on ARM64#467
fmeum wants to merge 1 commit into
google:mainfrom
fmeum:cpuinfo-aarch64-windows-utils-hdr

Conversation

@fmeum

@fmeum fmeum commented Jul 2, 2026

Copy link
Copy Markdown

src/impl_aarch64_windows.c includes "internal/windows_utils.h", but the header is only listed in the hdrs of :cpuinfo (and :cpuinfo_for_testing) in the x86 branch of the select. As a result, Bazel builds of :cpuinfo for windows-arm64 fail with:

src/impl_aarch64_windows.c:24:10: fatal error: 'internal/windows_utils.h' file not found

This adds the header to the ARM64 branch of both targets.

src/impl_aarch64_windows.c includes "internal/windows_utils.h", but the
header is only listed in the hdrs of cpuinfo and cpuinfo_for_testing for
x86. As a result, Bazel builds of :cpuinfo for windows-arm64 (e.g. when
cross-compiling with clang -target aarch64-w64-windows-gnu) fail with:

  src/impl_aarch64_windows.c:24:10: fatal error: 'internal/windows_utils.h' file not found
@fmeum fmeum marked this pull request as ready for review July 2, 2026 12:13
@Mizux

Mizux commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

#include "internal/windows_utils.h"

fmeum added a commit to bazel-contrib/platforms_contrib that referenced this pull request Jul 3, 2026
Building with --platforms=@platforms_contrib//host uses a platform that
has @platforms//host as its parent and adds the constraint values from
this module that match the host machine:

* the glibc or musl version available on Linux, detected in Starlark
  via getconf/ldd or the musl loader, and
* the available x86-64 CPU features (and thus microarchitecture
  levels), detected by running a prebuilt binary built on the
  cpu_features library.

Detection runs lazily in a repository rule, so projects that don't
reference //host don't pay for it. On hosts without a prebuilt detector
binary, the platform degrades to the libc constraints with a warning;
PLATFORMS_CONTRIB_HOST_DETECTION=off skips CPU feature detection
entirely.

The prebuilt detectors are cross-compiled for all six supported host
platforms ({linux,macos,windows} x {x86-64,arm64}) with the hermetic
llvm toolchain, following the approach used by
https://github.com/hermeticbuild/codesign.bzl: a prebuilts.yaml
workflow builds //prebuilt:for_all_platforms on prebuilts-v* tags and
publishes the binaries as GitHub release artifacts referenced from
host/private/prebuilts.bzl. Building //prebuilt:detect_cpu for
windows-arm64 requires a patch for cpu_features that has been submitted
upstream as google/cpu_features#467.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
fmeum added a commit to bazel-contrib/platforms_contrib that referenced this pull request Jul 3, 2026
Building with --platforms=@platforms_contrib//host uses a platform that
has @platforms//host as its parent and adds the constraint values from
this module that match the host machine:

* the glibc or musl version available on Linux, detected in Starlark
  via getconf/ldd or the musl loader, and
* the available x86-64 CPU features (and thus microarchitecture
  levels), detected by running a prebuilt binary built on the
  cpu_features library.

Detection runs lazily in a repository rule, so projects that don't
reference //host don't pay for it. On hosts without a prebuilt detector
binary, the platform degrades to the libc constraints with a warning;
PLATFORMS_CONTRIB_HOST_DETECTION=off skips CPU feature detection
entirely.

The prebuilt detectors are cross-compiled for all six supported host
platforms ({linux,macos,windows} x {x86-64,arm64}) with the hermetic
llvm toolchain, following the approach used by
https://github.com/hermeticbuild/codesign.bzl: a prebuilts.yaml
workflow builds //prebuilt:for_all_platforms on prebuilts-v* tags and
publishes the binaries as GitHub release artifacts referenced from
host/private/prebuilts.bzl. Building //prebuilt:detect_cpu for
windows-arm64 requires a patch for cpu_features that has been submitted
upstream as google/cpu_features#467.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants