That help message explains how to install the musl-tools package (or Homebrew equivalent), after which the packaging steps will get further, but will then fail again with errors of form:
test expected_pack_failure ... ok
Compiling component-a v0.0.0 (/Users/emorley/src/libcnb.rs/libcnb-test/tests/fixtures/buildpacks/component-a)
test build_workspace_component_buildpack ... FAILEDomponent-a(bin)
error[E0463]: can't find crate for `std`
|
= note: the `x86_64-unknown-linux-musl` target may not be installed
= help: consider downloading the target with `rustup target add x86_64-unknown-linux-musl`
error: cannot find macro `println` in this scope
--> src/main.rs:2:5
|
2 | println!("Buildpack A");
| ^^^^^^^
error: requires `sized` lang_item
For more information about this error, try `rustc --explain E0463`.
Whilst this next set of errors is better than nothing (it at least suggests the next command that needs running, rustup target add x86_64-unknown-linux-musl):
the command the user needs to run is somewhat buried inside the rest of the error message
it has meant twice in a row the user tried to run a command and it has failed - giving the impression of a never-ending set of undocumented setup steps
For a more pleasant UX, we should suggest running the rustup target add x86_64-unknown-linux-musl command in the original compile assistance message. Worst case the user reinstalls an already added target (which will just be a no-op), or misses the second install suggestion, and proceeds to see the error above anyway.
If
cargo libcnb package
(or libcnb-test, once #704 is fixed) detects that the required cross-compilation toolchain is not installed, it prints the help messages here: https://github.com/heroku/libcnb.rs/blob/a9759eef8e356f6396f1df8b16afe591645251d5/libcnb-package/src/cross_compile.rs#L9-L91That help message explains how to install the musl-tools package (or Homebrew equivalent), after which the packaging steps will get further, but will then fail again with errors of form:
Whilst this next set of errors is better than nothing (it at least suggests the next command that needs running,
rustup target add x86_64-unknown-linux-musl
):For a more pleasant UX, we should suggest running the
rustup target add x86_64-unknown-linux-musl
command in the original compile assistance message. Worst case the user reinstalls an already added target (which will just be a no-op), or misses the second install suggestion, and proceeds to see the error above anyway.GUS-W-14438920.