Skip to content

Cross-build target for macos compilation#1115

Open
TheRayquaza wants to merge 1 commit into
containerd:mainfrom
DataDog:mateo.lelong/fix-cross-platform
Open

Cross-build target for macos compilation#1115
TheRayquaza wants to merge 1 commit into
containerd:mainfrom
DataDog:mateo.lelong/fix-cross-platform

Conversation

@TheRayquaza
Copy link
Copy Markdown
Contributor

Hey runwasi folks 👋

I have this tiny PR for enabling compilation on macos using cross

Usage

# Build all runtimes for x86_64-unknown-linux-musl
make cross-build

# Build a single shim with release mode
OPT_PROFILE="release" make cross-build-wasmtime

# Override target arch
make cross-build-wasmtime CROSS_BUILD_TARGET=aarch64-unknown-linux-musl

Test plan

  • make cross-build builds all runtimes in RUNTIMES
  • make build unaffected (no regression)

Signed-off-by: Mateo Lelong <mateo.lelong@datadoghq.com>
@github-actions github-actions Bot added the T-CI label May 4, 2026
@jprendes
Copy link
Copy Markdown
Collaborator

Hi!

I dont see how this change enables aarch64 support. Also aarch64 should already be supported.

Is there a missing commit in the PR maybe?

@TheRayquaza
Copy link
Copy Markdown
Contributor Author

Hey @jprendes, you're right that this isn't exactly about adding aarch64 target support. Let me rephrase:

Problem: make build fails entirely on macOS because procfs v0.17.0 only supports Linux/Android. There's no workaround, it uses linux syscalls.

Solution: cross wraps cargo in docker, so the actual compilation happens on linux. The DOCKER_DEFAULT_PLATFORM solves the macos default pulling arm64 images. We need amd64 image because the cross-rs toolchain images are amd64 (without the override, the arm64 image is selected and the build fails).

The new cross-build / cross-build-* targets are just a replacement for running cross instead of cargo, which work for macos (should also work for other platforms I think 🤔)

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants