Skip to content

Conversation

@dwhyrock
Copy link
Contributor

@dwhyrock dwhyrock commented Sep 4, 2025

Description

In order to build Elastic Agent for Windows ARM, we need to be able to cross-compile for it using a golang-crossbuild container.

This PR adds a new container with windows-arm64 in its name. It sets up and installs a newer package of mingw that contains binaries that can compile code into Windows PE ARM64 executables.

Buildkite build: https://buildkite.com/elastic/golang-crossbuild/builds/1322

Question

  • Should this be backported to any specific branch?

Output

From the Buildkite build:

List Docker images staging
	REPOSITORY:TAG                                                                       SIZE
	docker.elastic.co/observability-ci/golang-crossbuild:1.24.7-windows-arm64-debian12   3.15GB
	docker.elastic.co/observability-ci/golang-crossbuild:1.24.7-darwin-arm64-debian12    4.73GB
	docker.elastic.co/observability-ci/golang-crossbuild:1.24.7-base-arm-debian12        983MB

From the test compilation in the build:

#13 [ 9/10] RUN cd /   && aarch64-w64-mingw32-gcc helloWorld.c -o helloWorld.arm64   && file helloWorld.arm64   && file helloWorld.arm64 | grep -c 'PE32+ executable (console) Aarch64, for MS Windows'
	#13 0.407 helloWorld.arm64: PE32+ executable (console) Aarch64, for MS Windows, 13 sections

Related Issues:

Related PR for Elastic Agent: elastic/elastic-agent#9751
^^ dependent on this PR being merged first

@mergify
Copy link

mergify bot commented Sep 4, 2025

This pull request does not have a backport label. Could you fix it @dwhyrock? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d is the label to automatically backport to the 1./d branch. /d is the digit
    NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip label Sep 4, 2025
@dwhyrock dwhyrock changed the title [DRAFT] Add windows arm64 crossbuild support Add windows arm64 crossbuild support Sep 8, 2025
@dwhyrock dwhyrock marked this pull request as ready for review September 8, 2025 20:23
@dwhyrock dwhyrock requested a review from a team as a code owner September 8, 2025 20:23
@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Sep 9, 2025
@pierrehilbert
Copy link

The change looks good to me but would be better to have someone from @elastic/elastic-agent-control-plane reviewing it.

Copy link
Contributor

@pkoutsovasilis pkoutsovasilis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My proposal is to leave this PR open until both beats and elastic-agent project can successfully be built against this new variant (through draft PRs), and only then merge it

@dwhyrock
Copy link
Contributor Author

My proposal is to leave this PR open until both beats and elastic-agent project can successfully be built against this new variant (through draft PRs), and only then merge it

Sounds good to me.

@nimarezainia
Copy link

My proposal is to leave this PR open until both beats and elastic-agent project can successfully be built against this new variant (through draft PRs), and only then merge it

what exactly are those draft PRs? (i'm just curious to know when we could support arm)

@dwhyrock
Copy link
Contributor Author

Ok, I believe this PR is good to go and has shown that it can build Windows/arm64 artifacts for both Beats and Agent.

PRs

I have the following (draft) PRs:

CI Builds

The latest CI builds for each of those (as of this comment) are here:

Both of the builds are (mostly) green. The one issue I've seen looks to be Linux/amd64/FIPS related, so it seems unrelated to the goal of this PR, which is "build Windows/arm64 Golang artifacts".

Snippets from CI

Generated packages in x-pack/agentbeat/build/distributions:
	-rw-r--r-- 1 buildkite-agent buildkite-agent  65M Sep 18 17:28 agentbeat-9.2.0-SNAPSHOT-windows-arm64.zip
	-rw-r--r-- 1 buildkite-agent buildkite-agent  172 Sep 18 17:28 agentbeat-9.2.0-SNAPSHOT-windows-arm64.zip.sha512
build/distributions/elastic-agent-9.2.0-SNAPSHOT-windows-arm64.zip            130 MB  application/zip
build/distributions/elastic-agent-9.2.0-SNAPSHOT-windows-arm64.zip.sha512     176 Bytes

Next Steps

Once this PR has been merged, I'll update the other two PRs to revert back the container namespace location.

After that, I'll be following @pkoutsovasilis 's recommended Order of Operations, as I've documented in this issue, and will copy here:

  • Merge PR of golang crossbuild
  • Update PR of beats to use the proper golang crossbuild images and when green merged
  • Update PR of elastic-agent to to use the proper golang crossbuild images and the DRA of beats. If green, gets merged
  • Update release artifacts for both beats and elastic-agent to capture the new windows arm64 artifacts

Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I see it was able to build on the beats and elastic-agent repositories.

@dwhyrock dwhyrock enabled auto-merge (squash) September 19, 2025 18:07
@dwhyrock dwhyrock merged commit a3ebc6a into main Sep 19, 2025
5 checks passed
@dwhyrock dwhyrock deleted the add-windows-arm-crossbuild branch September 19, 2025 21:26
@elasticmachine
Copy link

💚 Build Succeeded

History

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-skip Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants