From 66ac136dd6ef09f8ca2b2abc404cc32d46d05b7f Mon Sep 17 00:00:00 2001 From: Eric Hanson <5846501+ericphanson@users.noreply.github.com> Date: Tue, 8 Apr 2025 01:58:46 +0200 Subject: [PATCH 1/3] rustc wrapper respects `CARGO_BUILD_TARGET` --- src/Runner.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Runner.jl b/src/Runner.jl index 1de63896..90a96d2e 100644 --- a/src/Runner.jl +++ b/src/Runner.jl @@ -743,8 +743,8 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr function rustc(io::IO, p::AbstractPlatform) extra_cmds = """ if [[ " \${ARGS[@]} " == *'--target'* ]]; then - if ! [[ " \${ARGS[@]} " =~ --target(=| )$(map_rust_target(p)) ]]; then - echo "Attempting to invoke targeted 'rustc' wrapper with a different target! (Expected $(map_rust_target(p)))" >&2 + if ! [[ " \${ARGS[@]} " =~ --target(=| )\${CARGO_BUILD_TARGET} ]]; then + echo "Attempting to invoke targeted 'rustc' wrapper with a different target! (Expected \${CARGO_BUILD_TARGET}, which is `CARGO_BUILD_TARGET`)" >&2 echo "args: \${ARGS[@]}" >&2 exit 1 fi From abfb732498167f003d3493ca07469de12caaa10d Mon Sep 17 00:00:00 2001 From: Eric Hanson <5846501+ericphanson@users.noreply.github.com> Date: Tue, 8 Apr 2025 02:02:25 +0200 Subject: [PATCH 2/3] set in `--target` too --- src/Runner.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Runner.jl b/src/Runner.jl index 90a96d2e..fce7db71 100644 --- a/src/Runner.jl +++ b/src/Runner.jl @@ -749,7 +749,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr exit 1 fi else - PRE_FLAGS+=( '--target=$(map_rust_target(p))' ) + PRE_FLAGS+=( '--target=\${CARGO_BUILD_TARGET}' ) fi """ wrapper(io, "/opt/$(host_target)/bin/rustc"; flags=rust_flags!(p), allow_ccache=false, extra_cmds=extra_cmds) From 95fa38e384a269260f9d299b4146b2ee93419ea3 Mon Sep 17 00:00:00 2001 From: Eric Hanson <5846501+ericphanson@users.noreply.github.com> Date: Tue, 8 Apr 2025 02:16:55 +0200 Subject: [PATCH 3/3] use double-quotes for interpolation, avoid backticks --- src/Runner.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Runner.jl b/src/Runner.jl index fce7db71..01bc752d 100644 --- a/src/Runner.jl +++ b/src/Runner.jl @@ -744,12 +744,12 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr extra_cmds = """ if [[ " \${ARGS[@]} " == *'--target'* ]]; then if ! [[ " \${ARGS[@]} " =~ --target(=| )\${CARGO_BUILD_TARGET} ]]; then - echo "Attempting to invoke targeted 'rustc' wrapper with a different target! (Expected \${CARGO_BUILD_TARGET}, which is `CARGO_BUILD_TARGET`)" >&2 + echo "Attempting to invoke targeted 'rustc' wrapper with a different target! (Expected \${CARGO_BUILD_TARGET}, which is CARGO_BUILD_TARGET)" >&2 echo "args: \${ARGS[@]}" >&2 exit 1 fi else - PRE_FLAGS+=( '--target=\${CARGO_BUILD_TARGET}' ) + PRE_FLAGS+=( "--target=\${CARGO_BUILD_TARGET}" ) fi """ wrapper(io, "/opt/$(host_target)/bin/rustc"; flags=rust_flags!(p), allow_ccache=false, extra_cmds=extra_cmds)