Skip to content

Commit 365a46d

Browse files
committed
Include the rustup target add step in the cross-compile assistance text
In order to compile buildpacks, users need to have both the musl toolchain and the Rust target installed. If the musl toolchain is missing, we already showed help text that says what packages need to be installed. However, this help text did not mention the Rust target, meaning after installing the musl tools, users would then go on to receive another error - this time from the Rust compiler. Whilst the Rust compiler error message does suggest running the `rustup target add` command itself: - this suggestion is often lost in the noise: rust-lang/rust#117640 - it means the users has had two failed attempts in a row, which could make the experience feel open-ended/frustrating Now, the cross-compile assistance help text also suggests the `rustup target add` step, improving the UX slightly. The help texts are starting to include a fair bit of duplication, however, refactoring is covered by the separate #727. Fixes #716. GUS-W-14438920.
1 parent 4ec39b6 commit 365a46d

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
### Changed
1313

1414
- Improved the consistency of all user-facing libcnb.rs error message wordings. ([#722](https://github.com/heroku/libcnb.rs/pull/722))
15+
- The assistance error message shown when the necessary cross-compilation tools are not found now also includes the `rustup target add` step. ([#729](https://github.com/heroku/libcnb.rs/pull/729))
1516

1617
### Fixed
1718

libcnb-package/src/cross_compile.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ The easiest way to install the required cross-compilation toolchain is to run:
2525
brew install messense/macos-cross-toolchains/x86_64-unknown-linux-musl
2626
2727
For more information, see:
28-
https://github.com/messense/homebrew-macos-cross-toolchains",
28+
https://github.com/messense/homebrew-macos-cross-toolchains
29+
30+
You will also need to install the Rust target, using:
31+
rustup target add x86_64-unknown-linux-musl",
2932
)), |gcc_binary_path| {
3033
CrossCompileAssistance::Configuration {
3134
cargo_env: vec![
@@ -57,7 +60,10 @@ linker for the target platform must be installed on your computer.
5760
5861
The easiest way to install 'musl-gcc' is to install the 'musl-tools' package:
5962
- https://packages.ubuntu.com/focal/musl-tools
60-
- https://packages.debian.org/bullseye/musl-tools",
63+
- https://packages.debian.org/bullseye/musl-tools
64+
65+
You will also need to install the Rust target, using:
66+
rustup target add x86_64-unknown-linux-musl",
6167
)),
6268
}
6369
} else if target_triple.as_ref() == AARCH64_UNKNOWN_LINUX_MUSL && cfg!(target_os = "linux") {
@@ -82,7 +88,10 @@ linker for the target platform must installed on your computer.
8288
The easiest way to install the 'g++-aarch64-linux-gnu', 'libc6-dev-arm64-cross', and 'musl-tools' packages:
8389
- https://packages.ubuntu.com/focal/g++-aarch64-linux-gnu
8490
- https://packages.ubuntu.com/focal/musl-tools
85-
- https://packages.ubuntu.com/focal/libc6-dev-arm64-cross",
91+
- https://packages.ubuntu.com/focal/libc6-dev-arm64-cross
92+
93+
You will also need to install the Rust target, using:
94+
rustup target add aarch64-unknown-linux-musl",
8695
)),
8796
}
8897
} else {

0 commit comments

Comments
 (0)