-
Notifications
You must be signed in to change notification settings - Fork 708
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
Add support for watchOS. #1914
Add support for watchOS. #1914
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I can tell, this file would require the additional OS checks that weren't necessary for tvOS as watchOS does support 32-bit ARM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like BoringSSL is disabling all assembly support for 32-bit Apple targets, so I think we should do the same, and add a target_vendor="apple"
case for this check? WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the PR author but that seems reasonable. There's no NEON available so the optimizations available on ARMv7k are more limited.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a reasonable suggestion to me 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See PR #1919.
Is there a convenient way to run the test suite on these targets? |
Global suggestions: 1: Let's do 1 PR per new target, since each target is going to have its own issues to address, it seems.
You didn't include the build output for those warnings.
This warning is caused by a bug in rustc Nightly; it is a false positive that we are tracking in #1917. |
@@ -264,7 +264,7 @@ const LINUX_ABI: &[&str] = &[ | |||
|
|||
/// Operating systems that have the same ABI as macOS on every architecture | |||
/// mentioned in `ASM_TARGETS`. | |||
const MACOS_ABI: &[&str] = &["ios", "macos", "tvos"]; | |||
const MACOS_ABI: &[&str] = &["ios", "macos", "tvos", "watchos"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think this is precise enough. More discussion about this in #1832.
In your fork, did you also patch target.h? Is target.h choosing
|
This seems like a cc-rs bug. Is this warning a false positive, or is it indicating a real problem? If it is a false positive I would accept a change to build.rs to work around it for this target. |
PR #1918 added some build-time checks to identify potential ABI issues, which I also intend to act as documentation for what changes need to be made to support all these targets. |
#[cfg(all( | ||
target_arch = "arm", | ||
not(target_os = "ios"), | ||
not(target_os = "watchos") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably needs more info in #1919 first, and to avoid derailing, but then this gate isn't fully correct. The two 64-bit ARM Apple Watch targets have NEON.
That sounds like a sane approach to me 👍. This effort is something I'm doing in my spare time, so might be slow, but will split this all up with the rest of the suggestions etc.
👍
Honestly I've not dealt with conditionally compiled code to this extent before in Rust but I agree it would be good to do this. Have been reading about cargo-dinghy which just so happens to have a recent PR for adding watchOS (and tvOS) support so seems like that would be an interesting place to start.
Its the first 4 lines that are really long:
No I didn't, and given that its the hardest target, let's take arm64_32 last and come back to this then.
Honestly I'm not sure, I'll have to look this one up and find out whats going on with the warning. |
Hi, sorry. Just realised I left this open. Unfortunately I discovered a misconfiguration in the project I was trying to compile for watchOS where one of the dependencies was using rustls instead of native-tls so my personal need for this has gone down. I would love to follow this up some day (especially to learn about some of the ideas discussed), but it's unlikely I will get the time so I'm going to close this PR and if I do, I can do it target by target. |
Hoping to make a follow-up PR to #1689 to add watchOS support, although in the current state this doesn't yet work for all of the targets:
aarch64-apple-watchos
is the only target to compile happily, although I don't believe there's any hardware actually using this yet 🙈armv7k-apple-watchos
builds although there are 4 warnings about .o files with no symbols which I'm not sure if that is to be expected or not?arm64_32-apple-watchos
fails to build, due to a couple ofimplicit conversion loses integer precision
errors. I think this makes sense as arm64_32 is considered to be aarch64 by Rust, even if the pointer size is 32-bit but I have no idea where to fix this.aarch64-apple-watchos-sim
andx86_64-apple-watchos-sim
both fail to build due to conflicting clang arguments-mwatchsimulator-version-min=2.0
and--target={aarch64|x86_64}-apple-watchos5.0-simulator
, although again, I'm failing to see where these 2 parameters come from 🤔Any pointers towards potential answers would be greatly appreciated 🙂
Build output
aarch64-apple-watchos ✅
armv7k-apple-watchos ❓
arm64_32-apple-watchos ❌
aarch64-apple-watchos-sim ❌
x86_64-apple-watchos-sim ❌
ring git:(watchos) ❯ cargo +nightly build -Zbuild-std --target "x86_64-apple-watchos-sim" Compiling ring v0.17.7 (/Users/runner/Fork/ring) The following warnings were emitted during compilation:warning: [email protected]: clang: error: overriding '-mwatchsimulator-version-min=2.0' option with '--target=x86_64-apple-watchos5.0-simulator' [-Werror,-Woverriding-t-option]
error: failed to run custom build command for
ring v0.17.7 (/Users/runner/Fork/ring)
Caused by:
process didn't exit successfully:
/Users/runner/Fork/ring/target/debug/build/ring-46c716d55784f0d8/build-script-build
(exit status: 1)--- stdout
cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
cargo:rustc-env=RING_CORE_PREFIX=ring_core_0_17_7_
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-apple-watchos-sim")
HOST = Some("x86_64-apple-darwin")
cargo:rerun-if-env-changed=CC_x86_64-apple-watchos-sim
CC_x86_64-apple-watchos-sim = None
cargo:rerun-if-env-changed=CC_x86_64_apple_watchos_sim
CC_x86_64_apple_watchos_sim = None
cargo:rerun-if-env-changed=TARGET_CC
TARGET_CC = None
cargo:rerun-if-env-changed=CC
CC = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
Detecting WatchOS SDK path for watchsimulator
running: "xcrun" "--show-sdk-path" "--sdk" "watchsimulator"
exit status: 0
cargo:rerun-if-env-changed=CFLAGS_x86_64-apple-watchos-sim
CFLAGS_x86_64-apple-watchos-sim = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_apple_watchos_sim
CFLAGS_x86_64_apple_watchos_sim = None
cargo:rerun-if-env-changed=TARGET_CFLAGS
TARGET_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
running: "clang" "-O0" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-watchos5.0-simulator" "-m64" "-mwatchsimulator-version-min=2.0" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator10.2.sdk" "-fembed-bitcode" "-I" "include" "-I" "/Users/runner/Fork/ring/target/x86_64-apple-watchos-sim/debug/build/ring-5e8917d212bd1162/out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-g3" "-Werror" "-o" "/Users/runner/Fork/ring/target/x86_64-apple-watchos-sim/debug/build/ring-5e8917d212bd1162/out/crypto/curve25519/curve25519.o" "-c" "crypto/curve25519/curve25519.c"
cargo:warning=clang: error: overriding '-mwatchsimulator-version-min=2.0' option with '--target=x86_64-apple-watchos5.0-simulator' [-Werror,-Woverriding-t-option]
exit status: 1
--- stderr
running "perl" "crypto/chacha/asm/chacha-x86_64.pl" "macosx" "/Users/runner/Fork/ring/target/x86_64-apple-watchos-sim/debug/build/ring-5e8917d212bd1162/out/chacha-x86_64-macosx.S"
running "perl" "crypto/fipsmodule/aes/asm/aesni-x86_64.pl" "macosx" "/Users/runner/Fork/ring/target/x86_64-apple-watchos-sim/debug/build/ring-5e8917d212bd1162/out/aesni-x86_64-macosx.S"
running "perl" "crypto/fipsmodule/aes/asm/vpaes-x86_64.pl" "macosx" "/Users/runner/Fork/ring/target/x86_64-apple-watchos-sim/debug/build/ring-5e8917d212bd1162/out/vpaes-x86_64-macosx.S"
running "perl" "crypto/fipsmodule/bn/asm/x86_64-mont.pl" "macosx" "/Users/runner/Fork/ring/target/x86_64-apple-watchos-sim/debug/build/ring-5e8917d212bd1162/out/x86_64-mont-macosx.S"
running "perl" "crypto/fipsmodule/bn/asm/x86_64-mont5.pl" "macosx" "/Users/runner/Fork/ring/target/x86_64-apple-watchos-sim/debug/build/ring-5e8917d212bd1162/out/x86_64-mont5-macosx.S"
running "perl" "crypto/fipsmodule/ec/asm/p256-x86_64-asm.pl" "macosx" "/Users/runner/Fork/ring/target/x86_64-apple-watchos-sim/debug/build/ring-5e8917d212bd1162/out/p256-x86_64-asm-macosx.S"
running "perl" "crypto/fipsmodule/modes/asm/aesni-gcm-x86_64.pl" "macosx" "/Users/runner/Fork/ring/target/x86_64-apple-watchos-sim/debug/build/ring-5e8917d212bd1162/out/aesni-gcm-x86_64-macosx.S"
running "perl" "crypto/fipsmodule/modes/asm/ghash-x86_64.pl" "macosx" "/Users/runner/Fork/ring/target/x86_64-apple-watchos-sim/debug/build/ring-5e8917d212bd1162/out/ghash-x86_64-macosx.S"
running "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl" "macosx" "/Users/runner/Fork/ring/target/x86_64-apple-watchos-sim/debug/build/ring-5e8917d212bd1162/out/sha512-x86_64-macosx.S"
running "perl" "crypto/cipher_extra/asm/chacha20_poly1305_x86_64.pl" "macosx" "/Users/runner/Fork/ring/target/x86_64-apple-watchos-sim/debug/build/ring-5e8917d212bd1162/out/chacha20_poly1305_x86_64-macosx.S"
running "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl" "macosx" "/Users/runner/Fork/ring/target/x86_64-apple-watchos-sim/debug/build/ring-5e8917d212bd1162/out/sha256-x86_64-macosx.S"
error occurred: Command "clang" "-O0" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-watchos5.0-simulator" "-m64" "-mwatchsimulator-version-min=2.0" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator10.2.sdk" "-fembed-bitcode" "-I" "include" "-I" "/Users/runner/Fork/ring/target/x86_64-apple-watchos-sim/debug/build/ring-5e8917d212bd1162/out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-g3" "-Werror" "-o" "/Users/runner/Fork/ring/target/x86_64-apple-watchos-sim/debug/build/ring-5e8917d212bd1162/out/crypto/curve25519/curve25519.o" "-c" "crypto/curve25519/curve25519.c" with args "clang" did not execute successfully (status code exit status: 1).