Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo libcnb package defaults to x86 architecture #869

Open
mars opened this issue Oct 17, 2024 · 0 comments
Open

cargo libcnb package defaults to x86 architecture #869

mars opened this issue Oct 17, 2024 · 0 comments

Comments

@mars
Copy link
Member

mars commented Oct 17, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants