Repository navigation
Description
Summary
with build --target <triple> is specified, but the current driver does not expose --target in usage, one-liner option parsing, or build command handling. Cross-target selections must be represented and either built correctly or rejected loudly; they must not silently produce native output.
Spec
docs/with-specification.md:9612-9634 lists with build [--release] [--target <triple>] and states that cross-compilation is a normal mode. docs/with-specification.md:9692-9705 says BuildTarget can represent non-native targets and unsupported non-native selections must fail loudly instead of falling back to native output.
Current state
src/main.w:601-639 parses and dispatches with build, but the global flag scan does not include a target triple. src/main.w:2535-2564 prints build usage without --target, and the one-liner known-option list in src/main.w:361-368 does not reserve --target either.
The absence is especially risky because the spec forbids a silent native fallback for unsupported non-native selections.
Implementation plan
- Add
--target <triple>and--target=<triple>parsing to the build command option parser. - Thread the parsed target through the build graph/project configuration as a semantic
BuildTarget, not as an opaque late linker string. - For the first implementation step, accept the native triple and make any non-native triple fail loudly with a diagnostic that says cross-target codegen/linking is not implemented yet.
- Once backend/link support exists, use the target to select target data layout, object format, platform runtime object, linker mode, C ABI details, and any sysroot/SDK inputs.
- Update help text and one-liner option scanning so
--targetis consistently recognized where build-like options are accepted.
Test plan
- Add CLI tests for
with build --target <native-triple>andwith build --target=<native-triple>. - Add a negative CLI test for a supported-looking non-native triple that currently fails loudly instead of producing a native binary.
- Add a help-text test or inventory-gate coverage through Add the spec inventory gate (keywords/attributes/CLI/modules vs spec tables) #410 to ensure
--targetremains listed. - Add build graph tests proving target values survive through
std.build.BuildTarget.
Acceptance criteria
with build --target <triple>is parsed and represented.- Unsupported non-native targets fail loudly and never produce native artifacts.
- Usage/help text matches the spec.
with build,with build :fixpoint,with build :test, andwith build :test-greenpass before this issue is closed.
Dependencies
Related to #410 for keeping CLI inventories synchronized with the spec.
Traceability
From the requirements campaign (docs/requirements.md, spec v7.1). Affected requirement IDs: 18.5.1.2.
Activity
ehartford commentedon Jun 11, 2026
Implemented in 5bccf1e.
with buildnow parses--target <triple>and--target=<triple>into the build target kind, recognizes--targetin one-liner/build option scanning, lists it in help, accepts native/host triples, and fails loudly for unsupported non-native or unknown triples without producing a native artifact. Verification passed with the project seed (WITH=$PWD/out/bin/with ./out/bin/with): build, fixpoint, full test suite, and test-green.@[target(\"arch\")] architecture guards (#479)
Cross-compilation: --target x86_64-linux-gnu (#425 step 4) — darwin-a…