I want to develop a small application (in rust) for a friend, who uses a Mac. I, however, have a Windows PC. My understanding is that it's possible to cross-compile, so I (naively!) went ahead and ran
rustup target add aarch64-apple-darwin. That worked fine. But when I tried to build a simple "Hello, world" example, I got an error
❯ cargo build --release --target aarch64-apple-darwin Compiling test_exe v0.1.0 (C:\Work\Scratch\test_exe) error: linker `cc` not found | = note: The system cannot find the file specified. (os error 2) error: could not compile `test_exe` due to previous error
I suppose it was a bit optimistic to expect things to "just work"...
I've done some hunting around, and there's a number of articles on cross-compiling for mac, but they all seem to be for people on Linux, I wasn't able to find anything for Windows. I'm assuming the problem is that rust needs some form of linker that understands MacOS, but I don't know how I'd provide something like that. I do have gcc and clang installed on my PC (windows ports), but neither provide the
cc command that rust seems to be looking for.
I guess the first question is, is this something that it's reasonable for me to be even trying to do? And if it is, where can I find some information on what I need? I did some searches, but couldn't find anything that seemed relevant.
Just to be clear, I can solve the underlying issue here (sending my friend a program to solve his problem) in many ways. It's not by any means essential to write it in rust and cross-compile. My main interest in cross-compiling is to learn more about how it works, find out what is and isn't possible, and generally experiment. So, for example, while I could use WSL and set up a linux-to-mac cross-compilation environment following the articles I've found, it's not really what I'm trying to achieve here.