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

The target passed to clang is wrong for aarch64-apple-darwin #542

Closed
glandium opened this issue Aug 13, 2020 · 13 comments · Fixed by #1252
Closed

The target passed to clang is wrong for aarch64-apple-darwin #542

glandium opened this issue Aug 13, 2020 · 13 comments · Fixed by #1252

Comments

@glandium
Copy link
Contributor

cc-rs passes the rust target unchanged, but unfortunately, in the case of aarch64-apple-darwin, the clang target is different, and clang doesn't recognize aarch64-apple-darwin at all. The right target to use is arm64-apple-darwin.

@sebdanielsson
Copy link

Anyone working on this?

@lmtr0
Copy link

lmtr0 commented Mar 5, 2022

Hello there, any Status on this?

@dot-asm
Copy link
Contributor

dot-asm commented Mar 11, 2022

I for one have no problem compiling for M1. I don't see any unrecognized flags passed to cc. I do observe additional --target flag if I attempt to compile with CC environment variable set to clang, but it's correct arm64-apple-darwin. In other words this looks resolved...

@lmtr0
Copy link

lmtr0 commented Mar 11, 2022

No, it isn't, arm64-apple-darwin isn't a valid target

[root@52bd9e36c736 be]# cargo build --target arm64-apple-darwin
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --target arm64-apple-darwin --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 1)
  --- stderr
  error: Error loading target specification: Could not find specification for target "arm64-apple-darwin". Run `rustc --print target-list` for a list of built-in targets

however this does when the target doesn't need the flags:

[root@52bd9e36c736 be]# RUSTFLAGS="-C linker=o64h-clang" cargo build --target aarch64-apple-darwin
   Compiling be v0.1.0 (/be)
    Finished dev [unoptimized + debuginfo] target(s) in 0.96s

For example, when compinling ring the aarch64 target doesn't work because it gives this error:

[root@52bd9e36c736 be]# CC=o64h-clang cargo build --target aarch64-apple-darwin
    Updating crates.io index
   Compiling cc v1.0.73
   Compiling untrusted v0.7.1
   Compiling ring v0.16.20
error: failed to run custom build command for `ring v0.16.20`

Caused by:
  process didn't exit successfully: `/be/target/debug/build/ring-742f4d26dc21a850/build-script-build` (exit status: 101)
  --- stdout
  OPT_LEVEL = Some("0")
  TARGET = Some("aarch64-apple-darwin")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  TARGET_CC = None
  CC = Some("o64h-clang")
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")

  --- stderr
  running "o64h-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-gfull" "-DNDEBUG" "-c" "-o/be/target/aarch64-apple-darwin/debug/build/ring-bc471d909e7e38fa/out/aesv8-armx-ios64.o" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/aesv8-armx-ios64.S"
  In file included from /root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/aesv8-armx-ios64.S:12:
  include/GFp/arm_arch.h:96:5: error: "unsupported ARM architecture"
  #   error "unsupported ARM architecture"
      ^
  1 error generated.
  thread 'main' panicked at 'execution failed', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/build.rs:656:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[root@52bd9e36c736 be]# 

@dot-asm
Copy link
Contributor

dot-asm commented Mar 11, 2022

No, it isn't, arm64-apple-darwin isn't a valid target

What I meant was that if I run env CC=clang cargo build on a M1 machine or env CC=clang cargo build --target=aarch64-apple-darwin on an x86 machine, cc-rs passes --target=arm64-apple-darwin to clang. This is with cc-rs 1.0.73.

@lmtr0
Copy link

lmtr0 commented Mar 11, 2022

Ah, got it, sorry I misunderstood. Btw I used o64-clang (for amd64 builds) instead of o64h-clang (for aarch64 builds) and somehow, it worked.

[root@52bd9e36c736 be]# CC=o64-clang RUSTFLAGS="-C linker=o64-clang -C link-args=-D__ARM_ARCH__" cargo build --target aarch64-apple-darwin
   Compiling untrusted v0.7.1
   Compiling ring v0.16.20
   Compiling be v0.1.0 (/be)
    Finished dev [unoptimized + debuginfo] target(s) in 3.27s
[root@52bd9e36c736 be]# file target/aarch64-apple-darwin/debug/be
target/aarch64-apple-darwin/debug/be: Mach-O 64-bit arm64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE|HAS_TLV_DESCRIPTORS>

@dot-asm
Copy link
Contributor

dot-asm commented Mar 11, 2022

In other words cc-rs did nothing wrong. At least in the sense that it passed same flags as it would to generic clang [for MacOS]. Case can be dismissed.

@lmtr0
Copy link

lmtr0 commented Mar 11, 2022

for some weird reason, this works:

[root@52bd9e36c736 be]# CC=clang RUSTFLAGS="-C linker=o64h-clang -C link-args=-D__ARM_ARCH__" cargo build --target aarch64-apple-darwin
   Compiling ring v0.16.20
error: failed to run custom build command for `ring v0.16.20`

Caused by:
  process didn't exit successfully: `/be/target/debug/build/ring-742f4d26dc21a850/build-script-build` (exit status: 101)
  --- stdout
  OPT_LEVEL = Some("0")
  TARGET = Some("aarch64-apple-darwin")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  TARGET_CC = None
  CC = Some("clang")
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  OPT_LEVEL = Some("0")
  TARGET = Some("aarch64-apple-darwin")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  TARGET_CC = None
  CC = Some("clang")
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  OPT_LEVEL = Some("0")
  TARGET = Some("aarch64-apple-darwin")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  TARGET_CC = None
  CC = Some("clang")
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  OPT_LEVEL = Some("0")
  TARGET = Some("aarch64-apple-darwin")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  TARGET_CC = None
  CC = Some("clang")
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  OPT_LEVEL = Some("0")
  TARGET = Some("aarch64-apple-darwin")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  TARGET_CC = None
  CC = Some("clang")
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  OPT_LEVEL = Some("0")
  TARGET = Some("aarch64-apple-darwin")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  TARGET_CC = None
  CC = Some("clang")
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  OPT_LEVEL = Some("0")
  TARGET = Some("aarch64-apple-darwin")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  TARGET_CC = None
  CC = Some("clang")
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  OPT_LEVEL = Some("0")
  TARGET = Some("aarch64-apple-darwin")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  TARGET_CC = None
  CC = Some("clang")
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  OPT_LEVEL = Some("0")
  TARGET = Some("aarch64-apple-darwin")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  TARGET_CC = None
  CC = Some("clang")
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  OPT_LEVEL = Some("0")
  TARGET = Some("aarch64-apple-darwin")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  TARGET_CC = None
  CC = Some("clang")
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")

  --- stderr
  running "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-gfull" "-DNDEBUG" "-c" "-o/be/target/aarch64-apple-darwin/debug/build/ring-bc471d909e7e38fa/out/aesv8-armx-ios64.o" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/aesv8-armx-ios64.S"
  running "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-gfull" "-DNDEBUG" "-c" "-o/be/target/aarch64-apple-darwin/debug/build/ring-bc471d909e7e38fa/out/ghashv8-armx-ios64.o" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/ghashv8-armx-ios64.S"
  running "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-gfull" "-DNDEBUG" "-c" "-o/be/target/aarch64-apple-darwin/debug/build/ring-bc471d909e7e38fa/out/vpaes-armv8-ios64.o" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/vpaes-armv8-ios64.S"
  running "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-gfull" "-DNDEBUG" "-c" "-o/be/target/aarch64-apple-darwin/debug/build/ring-bc471d909e7e38fa/out/armv8-mont-ios64.o" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/armv8-mont-ios64.S"
  running "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-gfull" "-DNDEBUG" "-c" "-o/be/target/aarch64-apple-darwin/debug/build/ring-bc471d909e7e38fa/out/chacha-armv8-ios64.o" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/chacha-armv8-ios64.S"
  running "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-gfull" "-DNDEBUG" "-c" "-o/be/target/aarch64-apple-darwin/debug/build/ring-bc471d909e7e38fa/out/ecp_nistz256-armv8-ios64.o" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/ecp_nistz256-armv8-ios64.S"
  running "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-gfull" "-DNDEBUG" "-c" "-o/be/target/aarch64-apple-darwin/debug/build/ring-bc471d909e7e38fa/out/ghash-neon-armv8-ios64.o" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/ghash-neon-armv8-ios64.S"
  running "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-gfull" "-DNDEBUG" "-c" "-o/be/target/aarch64-apple-darwin/debug/build/ring-bc471d909e7e38fa/out/sha512-armv8-ios64.o" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/sha512-armv8-ios64.S"
  running "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-gfull" "-DNDEBUG" "-c" "-o/be/target/aarch64-apple-darwin/debug/build/ring-bc471d909e7e38fa/out/sha256-armv8-ios64.o" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/sha256-armv8-ios64.S"
  running "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-I" "include" "-Wall" "-Wextra" "-std=c1x" "-Wbad-function-cast" "-Wnested-externs" "-Wstrict-prototypes" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-gfull" "-DNDEBUG" "-c" "-o/be/target/aarch64-apple-darwin/debug/build/ring-bc471d909e7e38fa/out/aes_nohw.o" "crypto/fipsmodule/aes/aes_nohw.c"
  In file included from crypto/fipsmodule/aes/aes_nohw.c:15:
  In file included from include/GFp/aes.h:52:
  In file included from include/GFp/base.h:66:
  In file included from /usr/lib/clang/13.0.0/include/stdint.h:52:
  In file included from /usr/include/stdint.h:26:
  In file included from /usr/include/bits/libc-header-start.h:33:
  In file included from /usr/include/features.h:514:
  /usr/include/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found
  # include <gnu/stubs-32.h>
            ^~~~~~~~~~~~~~~~
  1 error generated.
  thread 'main' panicked at 'execution failed', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/build.rs:656:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[root@52bd9e36c736 be]# CC=o64h-clang RUSTFLAGS="-C linker=o64h-clang -C link-args=-D__ARM_ARCH__" cargo build --target aarch64-apple-darwin
   Compiling ring v0.16.20
   Compiling be v0.1.0 (/be)
    Finished dev [unoptimized + debuginfo] target(s) in 4.24s

but this doesn't:

[root@52bd9e36c736 be]# cargo clean
[root@52bd9e36c736 be]# CC=o64h-clang RUSTFLAGS="-C linker=o64h-clang -C link-args=-D__ARM_ARCH__" cargo build --target aarch64-apple-darwin
   Compiling cc v1.0.73
   Compiling untrusted v0.7.1
   Compiling ring v0.16.20
error: failed to run custom build command for `ring v0.16.20`

Caused by:
  process didn't exit successfully: `/be/target/debug/build/ring-742f4d26dc21a850/build-script-build` (exit status: 101)
  --- stdout
  OPT_LEVEL = Some("0")
  TARGET = Some("aarch64-apple-darwin")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  TARGET_CC = None
  CC = Some("o64h-clang")
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")

  --- stderr
  running "o64h-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-gfull" "-DNDEBUG" "-c" "-o/be/target/aarch64-apple-darwin/debug/build/ring-bc471d909e7e38fa/out/aesv8-armx-ios64.o" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/aesv8-armx-ios64.S"
  In file included from /root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/aesv8-armx-ios64.S:12:
  include/GFp/arm_arch.h:96:5: error: "unsupported ARM architecture"
  #   error "unsupported ARM architecture"
      ^
  1 error generated.
  thread 'main' panicked at 'execution failed', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/build.rs:656:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[root@52bd9e36c736 be]# 

@dot-asm
Copy link
Contributor

dot-asm commented Mar 11, 2022

Still looks like it's between you and your C compiler... In other words, I still don't see cc-rs doing anything wrong...

@lmtr0
Copy link

lmtr0 commented Mar 11, 2022

HMmmmmmmm

@lmtr0
Copy link

lmtr0 commented Mar 27, 2022

If anyone is having the same issue with o64h-clang, I started this issue tpoechtrager/osxcross#333

@briansmith
Copy link

In the case of ring issues, the latest version (0.17) redoes the ARM target detection so the "unsupported ARM architecture" error may no longer be relevant. I do build and test on aarch64-apple-darwin and it works fine so I think any issues here are likely (a) solved with ring 0.17, for people having problems with ring, and/or (b) issues with cross-compiling toolchains.

@lmtr0
Copy link

lmtr0 commented Oct 11, 2023

Awesome. Unfortunately due to work, I can't test it. But as soon as I'm available I'll let you guys know

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.

5 participants