Skip to content

Unable to build aarch64-apple-ios-macabi and x86_64-apple-ios-macabi targets using clang 13.1 and above #726

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

Closed
kgrech opened this issue Oct 10, 2022 · 7 comments
Labels
O-apple Apple targets and toolchains

Comments

@kgrech
Copy link

kgrech commented Oct 10, 2022

I am trying to compile the ring crate for the targets mentioned in the target:

cargo +nightly build -Z build-std --release --target aarch64-apple-ios-macabi -vv
cargo +nightly build -Z build-std --release --target x86_64-apple-ios-macabi -vv

Both builds fail with the same error:

clang: error: invalid version number in '--target=arm64-apple-ios13.0-macabi'

I am using M1 mac and my clang version is the following:

clang -v
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: arm64-apple-darwin21.6.0

I was trying to solve this problem by downgrading the clang. It starts working if I downgrade to 13.0. Version 13.1 and above are failing.

I see the same problem on my x64 mac as well.

@kgrech
Copy link
Author

kgrech commented Oct 10, 2022

I've found a simple solution, see PR #727, but I have some concerns. I've outlined them in the PR and would be happy to discuss it there

@thomcc thomcc added the O-apple Apple targets and toolchains label Oct 26, 2022
@thomcc
Copy link
Member

thomcc commented Oct 26, 2022

I think the support for catalyst upstream in rustc_target is kind of broken here, we should figure out a fix there before doing too much here...

... That said, I've merged #727 in the meantime, since it seems like a reasonable approach that we wouldn't be upset about no matter how we resolve that.

@imWildCat
Copy link

@thomcc @kgrech I created another PR to fix in the rust compiler: rust-lang/rust#106925

@madsmtm
Copy link
Collaborator

madsmtm commented Apr 30, 2024

All of the mentioned PRs have been merged, so I believe this can be closed.

@NobodyXu
Copy link
Collaborator

NobodyXu commented May 1, 2024

I tried cargo +nightly build -Z build-std --release --target aarch64-apple-ios-macabi and it still failed:

   Compiling ring v0.17.8 (/private/tmp/ring)
   Compiling addr2line v0.21.0
   Compiling std v0.0.0 (/Users/nobodyxu/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std)
The following warnings were emitted during compilation:

warning: ring@0.17.8: clang: error: argument unused during compilation: '-L/usr/lib' [-Werror,-Wunused-command-line-argument]

error: failed to run custom build command for `ring v0.17.8 (/private/tmp/ring)`

Caused by:
  process didn't exit successfully: `/private/tmp/ring/target/release/build/ring-f5376eacf2ad17e2/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=CARGO_MANIFEST_DIR
  cargo:rerun-if-env-changed=CARGO_PKG_NAME
  cargo:rerun-if-env-changed=CARGO_PKG_VERSION_MAJOR
  cargo:rerun-if-env-changed=CARGO_PKG_VERSION_MINOR
  cargo:rerun-if-env-changed=CARGO_PKG_VERSION_PATCH
  cargo:rerun-if-env-changed=CARGO_PKG_VERSION_PRE
  cargo:rerun-if-env-changed=CARGO_MANIFEST_LINKS
  cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
  cargo:rerun-if-env-changed=OUT_DIR
  cargo:rerun-if-env-changed=CARGO_CFG_TARGET_ARCH
  cargo:rerun-if-env-changed=CARGO_CFG_TARGET_OS
  cargo:rerun-if-env-changed=CARGO_CFG_TARGET_ENV
  cargo:rerun-if-env-changed=DEBUG
  cargo:rerun-if-env-changed=PERL_EXECUTABLE
  OPT_LEVEL = Some("3")
  TARGET = Some("aarch64-apple-ios-macabi")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_aarch64-apple-ios-macabi
  CC_aarch64-apple-ios-macabi = None
  cargo:rerun-if-env-changed=CC_aarch64_apple_ios_macabi
  CC_aarch64_apple_ios_macabi = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  Detecting iOS SDK path for macosx
  cargo:rerun-if-env-changed=CFLAGS_aarch64-apple-ios-macabi
  CFLAGS_aarch64-apple-ios-macabi = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_apple_ios_macabi
  CFLAGS_aarch64_apple_ios_macabi = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:warning=clang: error: argument unused during compilation: '-L/usr/lib' [-Werror,-Wunused-command-line-argument]

  --- stderr
  running "perl" "//private/tmp/ring/crypto/fipsmodule/aes/asm/aesv8-armx.pl" "ios64" "//private/tmp/ring/target/aarch64-apple-ios-macabi/release/build/ring-62b3b7fcfc0d3429/out/aesv8-armx-ios64.S"
  running "perl" "//private/tmp/ring/crypto/fipsmodule/modes/asm/ghashv8-armx.pl" "ios64" "//private/tmp/ring/target/aarch64-apple-ios-macabi/release/build/ring-62b3b7fcfc0d3429/out/ghashv8-armx-ios64.S"
  running "perl" "//private/tmp/ring/crypto/chacha/asm/chacha-armv8.pl" "ios64" "//private/tmp/ring/target/aarch64-apple-ios-macabi/release/build/ring-62b3b7fcfc0d3429/out/chacha-armv8-ios64.S"
  running "perl" "//private/tmp/ring/crypto/cipher_extra/asm/chacha20_poly1305_armv8.pl" "ios64" "//private/tmp/ring/target/aarch64-apple-ios-macabi/release/build/ring-62b3b7fcfc0d3429/out/chacha20_poly1305_armv8-ios64.S"
  running "perl" "//private/tmp/ring/crypto/fipsmodule/aes/asm/vpaes-armv8.pl" "ios64" "//private/tmp/ring/target/aarch64-apple-ios-macabi/release/build/ring-62b3b7fcfc0d3429/out/vpaes-armv8-ios64.S"
  running "perl" "//private/tmp/ring/crypto/fipsmodule/bn/asm/armv8-mont.pl" "ios64" "//private/tmp/ring/target/aarch64-apple-ios-macabi/release/build/ring-62b3b7fcfc0d3429/out/armv8-mont-ios64.S"
  running "perl" "//private/tmp/ring/crypto/fipsmodule/ec/asm/p256-armv8-asm.pl" "ios64" "//private/tmp/ring/target/aarch64-apple-ios-macabi/release/build/ring-62b3b7fcfc0d3429/out/p256-armv8-asm-ios64.S"
  running "perl" "//private/tmp/ring/crypto/fipsmodule/modes/asm/ghash-neon-armv8.pl" "ios64" "//private/tmp/ring/target/aarch64-apple-ios-macabi/release/build/ring-62b3b7fcfc0d3429/out/ghash-neon-armv8-ios64.S"
  running "perl" "//private/tmp/ring/crypto/fipsmodule/modes/asm/aesv8-gcm-armv8.pl" "ios64" "//private/tmp/ring/target/aarch64-apple-ios-macabi/release/build/ring-62b3b7fcfc0d3429/out/aesv8-gcm-armv8-ios64.S"
  running "perl" "//private/tmp/ring/crypto/fipsmodule/sha/asm/sha512-armv8.pl" "ios64" "//private/tmp/ring/target/aarch64-apple-ios-macabi/release/build/ring-62b3b7fcfc0d3429/out/sha512-armv8-ios64.S"
  running "perl" "//private/tmp/ring/crypto/fipsmodule/sha/asm/sha512-armv8.pl" "ios64" "//private/tmp/ring/target/aarch64-apple-ios-macabi/release/build/ring-62b3b7fcfc0d3429/out/sha256-armv8-ios64.S"


  error occurred: Command "clang" "-O3" "-fPIC" "--target=arm64-apple-ios-macabi" "-isysroot" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" "-isystem" "/usr/include" "-iframework" "/System/Library/Frameworks" "-L/usr/lib" "-F/System/Library/Frameworks" "-I" "/private/tmp/ring/include" "-I" "/private/tmp/ring/target/aarch64-apple-ios-macabi/release/build/ring-62b3b7fcfc0d3429/out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-Wall" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-g3" "-DNDEBUG" "-Werror" "-o" "/private/tmp/ring/target/aarch64-apple-ios-macabi/release/build/ring-62b3b7fcfc0d3429/out/7eef37ad3802d723-curve25519.o" "-c" "/private/tmp/ring/crypto/curve25519/curve25519.c" with args clang did not execute successfully (status code exit status: 1).


warning: build failed, waiting for other jobs to finish...

@NobodyXu
Copy link
Collaborator

NobodyXu commented May 1, 2024

It seems like a different error this time due to -Werror:

  cargo:warning=clang: error: argument unused during compilation: '-L/usr/lib' [-Werror,-Wunused-command-line-argument]

@NobodyXu
Copy link
Collaborator

NobodyXu commented May 1, 2024

Turns out that ring enables -Werror if .git is present.
After disabling it, I can compile ring on these targets.

Closing this as completed.

@NobodyXu NobodyXu closed this as completed May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-apple Apple targets and toolchains
Projects
None yet
Development

No branches or pull requests

5 participants