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

Cross Compilation from macOS to Linux fails #1

Closed
franziskusz opened this issue Mar 8, 2024 · 2 comments
Closed

Cross Compilation from macOS to Linux fails #1

franziskusz opened this issue Mar 8, 2024 · 2 comments

Comments

@franziskusz
Copy link
Owner

franziskusz commented Mar 8, 2024

Edit:

My bad, the build command was wrong:
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=x86_64-linux-musl-gcc cargo build --release --target=x86_64-unknown-linux-musl

and

CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-musl-gcc cargo build --release --target=aarch64-unknown-linux-musl

worked as expected.

error: linker `x86_64-unknown-linux-musl-gcc` not found | = note: No such file or directory (os error 2)
and
error: linker `aarch64-unknown-linux-musl-gcc` not found | = note: No such file or directory (os error 2)

even though both are installed:

which aarch64-linux-musl-gcc->
/usr/local/bin/aarch64-linux-musl-gcc

which x86_64-linux-musl-gcc->
/usr/local/bin/x86_64-linux-musl-gcc

Similar Issues:

rust-lang/rust#25289

rust-lang/backtrace-rs#34

rust-lang/rust#115430

Partial Solutions:

https://saktidwicahyono.name/blogs/cross-compile-to-linux-amd64-from-mac-m1/

https://www.docker.com/blog/cross-compiling-rust-code-for-multiple-architectures/

https://betterprogramming.pub/cross-compiling-rust-from-mac-to-linux-7fad5a454ab1

https://gist.github.com/Mefistophell/9787e1b6d2d9441c16d2ac79d6a505e6

https://stackoverflow.com/questions/41761485/how-to-cross-compile-from-mac-to-linux

https://www.reddit.com/r/rust/comments/18r8wic/cross_compile_rust_on_mac_os/

https://medium.com/@mr.pankajbahekar/cross-comiple-rust-binaries-on-mac-m1-a252e3a8925e

briansmith/ring#1414

@jonwolski
Copy link

What was the corrected command?

@franziskusz
Copy link
Owner Author

franziskusz commented Mar 25, 2024

The ones in the build-commands.txt should work in combination with this cargo config. And you also have to install the respective rust toolchain + c-linker like in this example before.

But I still am working on testing the builds: #2

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

No branches or pull requests

2 participants