home ~ projects ~ socials

Binaries To Build For A Rust Release

I'm trying to figure out what platforms make the most sense to build Neopoligen1 for. The cargo-make folks ship these binaries with each release which seems like a good starting point.

  • aarch64-apple-darwin
  • x86_64-apple-darwin
  • x86_64-pc-windows-msvc
  • x86_64-unknown-linux-gnu
  • x86_64-unknown-linux-musl

Windows -gnu

I'm acutally using

x86_64-pc-windows-gnu

instead of

x86_64-pc-windows-msvc

because the later had problems with:

warning: onig_sys@69.8.1: oniguruma/src/regint.h:110:10: fatal error: 'stdlib.h' file not found
warning: onig_sys@69.8.1: #include <stdlib.h>

Installing Target

When I first tried to run these on my mac I'd get errors like:

error[E0463]: can't find crate for `std`
  |
  = note: the ``x86_64-pc-windows-gnu`` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-pc-windows-gnu`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

The solution of downloading the targets presented in the error message worked and everything went as expected after running these commands

rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
rustup target add x86_64-pc-windows-gnu
rustup target add x86_64-unknown-linux-gnu
rustup target add x86_64-unknown-linux-musl

mingw errors

I also got:

The following warnings were emitted during compilation:

warning: onig_sys@69.8.1: Failed to run: "x86_64-w64-mingw32-gcc" "--version"

error: failed to run custom build command for `onig_sys v69.8.1`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

I solved that on my mac via homebrew with:

brew install mingw-w64

linux gcc

Ran into this:

The following warnings were emitted during compilation:

warning: onig_sys@69.8.1: Failed to run: "x86_64-linux-gnu-gcc" "--version"

error: failed to run custom build command for `onig_sys v69.8.1`

I tried this, but it didn't fix it, but it didn't do it:

brew install x86_64-linux-gnu-binutils

also tried which did work:

brew tap messense/macos-cross-toolchains
brew install x86_64-unknown-linux-gnu
brew link x86_64-unknown-linux-gnu

Note that I also had to unlike the earlier try with: brew unlink x86_64-linux-gnu-binutils. I'm guessing if I hadn't tried to install that, I wouldn't have had to do the linking step

-- end of line --

References

Footnotes

The website builder app I'm working on