Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Canonical cross-compilation for Linux, ARM & Windows (excluding libc)

Presently the cross-compilation story for Rust is scattered across several outdated blog posts, repos, tools (musl, crosstools-ng) or Docker files.

I've spent ~20 hours struggling to get ARM and Windows compilation and linking working for a project that does not require libc, so I would love to see complete canonical instructions to get a "Hello world!" example compiled for the following targets:

  • OSX to ARM, armv7-unknown-linux-gnueabihf
  • Linux to Windows, x86_64-pc-windows-msvc and x86_64-pc-windows-gnu
  • Windows to Linux, gcc-arm-linux-gnueabihf
  • Windows to ARM, gcc-arm-linux-gnueabihf

Here is a simple TCP server that I can't get to link on OSX for either Windows or ARM, despite installing every dependency I could spot.

Specifically:

  • For Windows ~-msvc it throws error: linker link.exe not found. Which VC++ dependency am I missing?
  • For Windows ~-gnu, it throws clang: error: linker command failed with exit code 1 with the latest XCode clang installed. gcc -v shows Apple LLVM version 10.0.0 (clang-1000.11.45.5).
  • For ARM, rustup toolchain install armv7-unknown-linux-gnueabihf throws error: no candidate toolchains found. error: toolchain 'armv7-unknown-linux-gnueabihf' is not installed.

Comments