Repository navigation
Conversation
Signed-off-by: Adir Atias <30810249+atiasadir@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The documentation still needs to clarify that this path requires separate single-platform builds and that emulation guidance applies only to Linux package targets, since Windows cross-builds run on Ubuntu.
2 open issues
What changed in this PR
Documents Dalec’s existing build-source approach to native cross-compilation, complementing the broader requests in #842 and #843 without changing build behavior.
Changes:
- Adds a Go example using
FROM --platform=$BUILDPLATFORMto cross-compile for the target platform. - Documents the four
BUILD*spec arguments and distinguishes them fromTARGET*.
| File | Description |
|---|---|
website/content/spec.md |
Lists BUILD* arguments and explains their relationship to --platform. |
website/content/sources.md |
Adds Dockerfile and YAML examples for cross-compiling in a build source. |
Review effort: Balanced
…m builds Signed-off-by: Adir Atias <30810249+atiasadir@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What this PR does / why we need it:
When the target platform isn't native, the spec's build steps run under emulation, which is slow for compilers. A build source already avoids that: Dalec builds its Dockerfile for the target platform, so a stage with
FROM --platform=$BUILDPLATFORMruns natively and can cross-compile forTARGETOSandTARGETARCH. The docs don't mention this, and theBUILDOS,BUILDARCH,BUILDPLATFORMandBUILDVARIANTspec args only appear inload.goandtest/var_passthrough_test.go.This adds:
sources.md: a "Cross-compiling in a build source" section under Build, with a Go example.spec.md: theBUILD*args in the built-in args list, with a line on how they differ from theTARGET*args.Which issue(s) this PR fixes (optional, using
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when the PR gets merged):Related to #843 and #842, which ask for native cross-compilation in Dalec itself. This documents what already works.
Special notes for your reviewer:
Checked with frontend 0.22.4 on an arm64 machine:
azlinux3/rpmandazlinux3/containerfor--platform linux/amd64, and the container printshello from linux/amd64.uname -mis aarch64 for both--platform linux/amd64andlinux/arm64,TARGETPLATFORMfollows--platform, and the binary's ELF machine matches the target.debug/resolvewith--platform linux/amd64givesBUILDARCH=arm64andTARGETARCH=amd64.hugo --source website --gc --minifywith the pinned Hugo image builds without errors.It doesn't depend on #1301.
AI use: I used GitHub Copilot to help prepare this change and verify the example.