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 compiling to OSX from Linux can error if a crate sets a -march flag #130

Closed
j-baker opened this issue May 9, 2023 · 0 comments · Fixed by #135
Closed

Cross compiling to OSX from Linux can error if a crate sets a -march flag #130

j-baker opened this issue May 9, 2023 · 0 comments · Fixed by #135

Comments

@j-baker
Copy link

j-baker commented May 9, 2023

When I try to compile the sha2 crate with feature asm, this errors, with an error log looking like:

  cargo:warning=info: available CPUs for architecture 'aarch64':
  cargo:warning= a64fx
  cargo:warning= ampere1
  cargo:warning= apple_a10
  cargo:warning= apple_a11
  cargo:warning= apple_a12
  cargo:warning= apple_a13
  cargo:warning= apple_a14
  cargo:warning= apple_a7
  cargo:warning= apple_a8
  cargo:warning= apple_a9
  cargo:warning= apple_latest
  cargo:warning= apple_m1
  cargo:warning= apple_s4
  cargo:warning= apple_s5
  cargo:warning= carmel
  cargo:warning= cortex_a34
... lots more...
  cargo:warning= thunderxt88
  cargo:warning= tsv110
  cargo:warning= xgene1
  cargo:warning=
  cargo:warning=error: unknown CPU: 'armv8'

This happens due to https://github.com/RustCrypto/asm-hashes/blob/1ea2ff7172a3a7e3cbab6e0014cebcb1a85366a4/sha2/build.rs#L13, which I think is filed as ziglang/zig#4911.

This error appears to come from Zig, in here: https://github.com/ziglang/zig/blob/8e9c9f6fdc76bcb6ea0eb4b73a6683041c7a08ad/lib/std/Build.zig#L999

While cargo-zigbuild has a workaround, here: https://github.com/rust-cross/cargo-zigbuild/pull/58/files, it doesn't seem to be triggering.

I'm wondering, should this line: https://github.com/rust-cross/cargo-zigbuild/pull/58/files#diff-49b1f98d9d763bc0e0db9c28ba3dc79ca7413959f017924bc333f7a086d16189R77 be .starts_with("arm") or "aarch64"?

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

Successfully merging a pull request may close this issue.

1 participant