I am on Linux(x86_64-unknown-linux-gnu), and trying to cross compile for Intel based Mac (x86_64-apple-darwin). My code is the default hello world script, when I run the command cargo build --target=x86_64-apple-darwin on my terminal I get the following error:
error: linking with `cc` failed: exit status: 1
note: <imagine a long path here>
note: cc: error: unrecognized command-line option '-arch'
error: could not compile `hello_world` (bin "hello_world") due to previous error
Here is my Cargo.toml:
[package]
name = "hello_world"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
Here are the respective versions of the rust tool chain:
rustup 1.26.0
cargo 1.70.0
rustc 1.70.0
I have searched my various errors and have found that these two articles have the most in common with my errors:
Article one: https://github.com/rust-lang/rust/issues/112501
Article two: https://stackoverflow.com/questions/75485076
Unfortunately both of them are unsolved or don't have a clear solution.
Here is some info on my operating system if needed:
OS: Debian GNU/Linux 12 (bookworm) x86_64
Kernel: 6.1.0-9-amd64
DE: Plasma 5.27.5
If anyone knows as to why I can't cross compile and has a solution, thanks in advance.