8000
Closed
Description
cargo libcnb package
defaults to x86 architecture regardless of the current system architecture.
When running this command on an ARM / Apple Silicon Mac, the following error message appears:
❯❯❯ cargo libcnb package
🚚 Preparing package directory...
🖥️ Gathering Cargo configuration (for x86_64-unknown-linux-musl)
For cross-compilation from aarch64 macos to x86_64-unknown-linux-musl,
a C compiler and linker for the target platform must be installed:
To install an x86_64 cross-compiler on macOS:
brew install messense/macos-cross-toolchains/x86_64-unknown-linux-musl
You will also need to install the Rust target:
rustup target add x86_64-unknown-linux-musl
❌ Failed to configure Cargo for cross-compilation
That is confusing, because I am not trying to cross-compile.
The solution is to set the current architecture as the target in the command:
❯❯❯ cargo libcnb package --target aarch64-unknown-linux-musl
Ideally, either that error messaging or the default behavior would be improved. So that this situation is not so confusing for developers running on non-x86 architecture.