Fail to build for watchOS `arm64_32-apple-watchos` from macOS 15 with XCode 16.4
I'm trying this on a uniffi-rs and cargo swift project. All the other Apple targets build successfully. Any clue where to look?
Failed due to the following error:
Compiling ring v0.17.14 (https://github.com/briansmith/ring.git?branch=main#b9c8f4f5)
Compiling uniffi v0.29.3
warning: [email protected]: /Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/fipsmodule/ec/p256-nistz.c:391:19: error: implicit conversion loses integer precision: 'crypto_word_t' (aka 'unsigned long long') to 'size_t' (aka 'unsigned long') [-Werror,-Wshorten-64-to-32]
warning: [email protected]: 391 | size_t wvalue = calc_first_wvalue(&index, p_str);
warning: [email protected]: | ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: [email protected]: /Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/fipsmodule/ec/p256-nistz.c:413:14: error: implicit conversion loses integer precision: 'crypto_word_t' (aka 'unsigned long long') to 'size_t' (aka 'unsigned long') [-Werror,-Wshorten-64-to-32]
warning: [email protected]: 413 | wvalue = calc_wvalue(&index, p_str);
warning: [email protected]: | ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~
warning: [email protected]: 2 errors generated.
error: failed to run custom build command for `ring v0.17.14 (https://github.com/briansmith/ring.git?branch=main#b9c8f4f5)`
Caused by:
process didn't exit successfully: `/Users/setoelka/Personal/test-ring/target/debug/build/ring-8eb90645d2630de4/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
cargo:rerun-if-env-changed=PERL_EXECUTABLE
OPT_LEVEL = Some(0)
OUT_DIR = Some(/Users/setoelka/Personal/test-ring/target/arm64_32-apple-watchos/debug/build/ring-05f2ac0271980667/out)
TARGET = Some(arm64_32-apple-watchos)
HOST = Some(aarch64-apple-darwin)
cargo:rerun-if-env-changed=CC_arm64_32-apple-watchos
CC_arm64_32-apple-watchos = None
cargo:rerun-if-env-changed=CC_arm64_32_apple_watchos
CC_arm64_32_apple_watchos = 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
RUSTC_WRAPPER = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some(true)
cargo:rerun-if-env-changed=WATCHOS_DEPLOYMENT_TARGET
WATCHOS_DEPLOYMENT_TARGET = None
Detecting "watchos" SDK path for watchos
cargo:rerun-if-env-changed=SDKROOT
SDKROOT = Some(/Applications/Xcode-16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk)
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
cargo:rerun-if-env-changed=TARGET_CFLAGS
TARGET_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS_arm64_32_apple_watchos
CFLAGS_arm64_32_apple_watchos = None
cargo:rerun-if-env-changed=CFLAGS_arm64_32-apple-watchos
CFLAGS_arm64_32-apple-watchos = None
CARGO_ENCODED_RUSTFLAGS = Some()
cargo:warning=/Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/fipsmodule/ec/p256-nistz.c:391:19: error: implicit conversion loses integer precision: 'crypto_word_t' (aka 'unsigned long long') to 'size_t' (aka 'unsigned long') [-Werror,-Wshorten-64-to-32]
cargo:warning= 391 | size_t wvalue = calc_first_wvalue(&index, p_str);
cargo:warning= | ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cargo:warning=/Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/fipsmodule/ec/p256-nistz.c:413:14: error: implicit conversion loses integer precision: 'crypto_word_t' (aka 'unsigned long long') to 'size_t' (aka 'unsigned long') [-Werror,-Wshorten-64-to-32]
cargo:warning= 413 | wvalue = calc_wvalue(&index, p_str);
cargo:warning= | ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~
cargo:warning=2 errors generated.
--- stderr
running "perl" "//Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/chacha/asm/chacha-armv8.pl" "ios64" "//Users/setoelka/Personal/test-ring/target/arm64_32-apple-watchos/debug/build/ring-05f2ac0271980667/out/chacha-armv8-ios64.S"
running "perl" "//Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/cipher/asm/chacha20_poly1305_armv8.pl" "ios64" "//Users/setoelka/Personal/test-ring/target/arm64_32-apple-watchos/debug/build/ring-05f2ac0271980667/out/chacha20_poly1305_armv8-ios64.S"
running "perl" "//Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/fipsmodule/aes/asm/aesv8-armx.pl" "ios64" "//Users/setoelka/Personal/test-ring/target/arm64_32-apple-watchos/debug/build/ring-05f2ac0271980667/out/aesv8-armx-ios64.S"
running "perl" "//Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/fipsmodule/aes/asm/aesv8-gcm-armv8.pl" "ios64" "//Users/setoelka/Personal/test-ring/target/arm64_32-apple-watchos/debug/build/ring-05f2ac0271980667/out/aesv8-gcm-armv8-ios64.S"
running "perl" "//Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/fipsmodule/aes/asm/ghash-neon-armv8.pl" "ios64" "//Users/setoelka/Personal/test-ring/target/arm64_32-apple-watchos/debug/build/ring-05f2ac0271980667/out/ghash-neon-armv8-ios64.S"
running "perl" "//Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/fipsmodule/aes/asm/ghashv8-armx.pl" "ios64" "//Users/setoelka/Personal/test-ring/target/arm64_32-apple-watchos/debug/build/ring-05f2ac0271980667/out/ghashv8-armx-ios64.S"
running "perl" "//Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/fipsmodule/aes/asm/vpaes-armv8.pl" "ios64" "//Users/setoelka/Personal/test-ring/target/arm64_32-apple-watchos/debug/build/ring-05f2ac0271980667/out/vpaes-armv8-ios64.S"
running "perl" "//Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/fipsmodule/bn/asm/armv8-mont.pl" "ios64" "//Users/setoelka/Personal/test-ring/target/arm64_32-apple-watchos/debug/build/ring-05f2ac0271980667/out/armv8-mont-ios64.S"
running "perl" "//Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/fipsmodule/ec/asm/p256-armv8-asm.pl" "ios64" "//Users/setoelka/Personal/test-ring/target/arm64_32-apple-watchos/debug/build/ring-05f2ac0271980667/out/p256-armv8-asm-ios64.S"
running "perl" "//Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/fipsmodule/sha/asm/sha512-armv8.pl" "ios64" "//Users/setoelka/Personal/test-ring/target/arm64_32-apple-watchos/debug/build/ring-05f2ac0271980667/out/sha512-armv8-ios64.S"
running "perl" "//Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/fipsmodule/sha/asm/sha512-armv8.pl" "ios64" "//Users/setoelka/Personal/test-ring/target/arm64_32-apple-watchos/debug/build/ring-05f2ac0271980667/out/sha256-armv8-ios64.S"
error occurred in cc-rs: command did not execute successfully (status code exit status: 1): LC_ALL="C" SDKROOT="/Applications/Xcode-16.4.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS11.5.sdk" "clang" "-O0" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=arm64_32-apple-watchos" "-mwatchos-version-min=11.5" "-isysroot" "/Applications/Xcode-16.4.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS11.5.sdk" "-I" "/Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/include" "-I" "/Users/setoelka/Personal/test-ring/target/arm64_32-apple-watchos/debug/build/ring-05f2ac0271980667/out" "-Werror" "-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" "-gfull" "-o" "/Users/setoelka/Personal/test-ring/target/arm64_32-apple-watchos/debug/build/ring-05f2ac0271980667/out/a0330e891e733f4e-p256-nistz.o" "-c" "/Users/setoelka/.cargo/git/checkouts/ring-794206c1dca33632/b9c8f4f/crypto/fipsmodule/ec/p256-nistz.c"
Could you please tell me how I can test a Rust project in the arm64_32 emulator on an Apple Silicon Mac? We have done some preliminary work to support arm64_32 but we don't know how to test it. If there's a project that runs its tests in GitHub Actions in the emulator for this target, please point me to that.
See #2622. Needs testing and links to the ABI documentation.
Late reply, been busy building stuff
I managed to build it correctly with the cargo swift package from this branch. The crate project is open source here.
Android wearOS build successfully.
See #2622. Needs testing and links to the ABI documentation.
I'll check the branch later today.
Did you have any chance to try it out?
See #2622. Needs testing and links to the ABI documentation.
I'll check the branch later today.
Did you have any chance to try it out?
Works fine with a simple crate setup.
[lib]
crate-type = ["lib", "cdylib", "staticlib"]
name = "wallet_kit_test"
[[bin]]
name = "uniffi-bindgen"
path = "uniffi-bindgen.rs"
[dependencies]
#solana-sdk = { git = "https://github.com/joncinque/solana-sdk", branch = "move-wasm" }
ring = { git = "https://github.com/briansmith/ring", branch = "b/arm64_32" }
uniffi = { version = "0.29", features = ["cli"] }
[build-dependencies]
uniffi = { version = "0.29", features = ["build"] }
I have other issues with the real crate, so I need to wait for that dependency first.
So, I was hoping to use cargo-dinghy to test this in the watchOS simulator but it doesn't seem to support arm64_32. And I can't find any documentation about how to run arm64_32 apps in the simulator. I guessed that I need to build using --target=arm64_32-apple-watchos but my understanding is that if I want to run in a simulator, I need to use a -sim target; yet there is no arm64_32-apple-watchos-sim target.
So then my thinking is that I need to define my own arm64_32-apple-watchos-sim that is just like arm64_32-apple-watchos except linking against different libraries. Or, use target arm64_32-apple-watchos` but configure the build system in some way to link against simulator libraries instead?
Any tips regarding this?
I merged the PR to the main branch as commit f161d1c1fe690d5379a9357a35355f24b2600b3c. I am going to leave all those changes but I am going to add another change to break the build in PR #2650 until I can figure out a way to test it.
I'm trying this again and got an error from the master branch:
setoelkahfi@Heighliner1 wallet-kit-v3 % cargo swift package
✔ Swift Package Name · WalletKitV3
✔ Select Target Platforms · watchOS (Experimental)
x Building target watchOS
cargo +nightly build -Z build-std --target aarch64-apple-watchos
Failed due to the following error:
Compiling security-framework-sys v2.15.0
Compiling tracing v0.1.41
Compiling ring v0.16.15 (https://github.com/briansmith/ring.git?branch=master#8d4e283c)
Compiling untrusted v0.7.1
Compiling spin v0.5.2
Compiling security-framework v2.11.1
Compiling h2 v0.4.12
error[E0283]: type annotations needed
--> /Users/setoelkahfi/.cargo/git/checkouts/ring-794206c1dca33632/8d4e283/build.rs:489:52
|
489 | let _ = c.flag("-Wl,--gc-sections".into());
| ---- ^^^^
| |
| required by a bound introduced by this call
|
= note: multiple `impl`s satisfying `_: AsRef<OsStr>` found in the following crates: `find_msvc_tools`, `std`:
- impl AsRef<OsStr> for OsStr;
- impl AsRef<OsStr> for OsString;
- impl AsRef<OsStr> for Path;
- impl AsRef<OsStr> for PathBuf;
- impl AsRef<OsStr> for String;
- impl AsRef<OsStr> for find_msvc_tools::find_tools::Env;
- impl AsRef<OsStr> for str;
note: required by a bound in `Build::flag`
--> /Users/setoelkahfi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cc-1.2.37/src/lib.rs:652:39
|
652 | pub fn flag(&mut self, flag: impl AsRef<OsStr>) -> &mut Build {
| ^^^^^^^^^^^^ required by this bound in `Build::flag`
help: try using a fully qualified path to specify the expected types
|
489 - let _ = c.flag("-Wl,--gc-sections".into());
489 + let _ = c.flag(<&str as Into<T>>::into("-Wl,--gc-sections"));
|
help: consider removing this method call, as the receiver has type `&'static str` and `&'static str: AsRef<OsStr>` trivially holds
|
489 - let _ = c.flag("-Wl,--gc-sections".into());
489 + let _ = c.flag("-Wl,--gc-sections");
|
For more information about this error, try `rustc --explain E0283`.
error: could not compile `ring` (build script) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
Cargo.toml
[package]
name = "wallet_kit_v3"
version = "0.1.0"
edition = "2021"
description = "Solana toolkit for Not Wallet"
license = "MIT"
[lib]
crate-type = ["lib", "cdylib", "staticlib"]
name = "wallet_kit_v3"
[[bin]]
name = "uniffi-bindgen"
path = "uniffi-bindgen.rs"
[dependencies]
base64 = "0.22"
bincode = "1.3"
bip39 = { version = "2", features = ["rand"] }
bs58 = "0.5.0"
env_logger = "0.10"
log = "0.4.20"
network = { path = "../network" }
reqwest = { version = "0.12", features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
ring = { git = "https://github.com/briansmith/ring.git", branch = "master" }
#quinn = { path = "../../../quinn/quinn" }
#solana-address = "1"
#solana-account-decoder = "3"
#solana-client = "3"
#solana-program = "3"
#solana-sdk = "3"
#solana-instruction = "3"
#solana-system-interface = { version = "2", features = ["bincode"] }
#spl-associated-token-account = { version = "7", features = ["no-entrypoint"] }
#spl-token = { version = "8", features = ["no-entrypoint"] }
thiserror = "1.0.56"
tokio = { version = "1.35.1", features = ["full"] }
tsync = "2"
uniffi = { version = "0.28", features = ["cli"] }
[build-dependencies]
uniffi = { version = "0.28", features = ["build"] }
#[patch.crates-io]
#ring = { git = "https://github.com/briansmith/ring.git", branch = "master" }
Original issue.
Wrong branch, wrong error. This is from the main branch:
Compiling network v0.1.0 (/Users/setoelkahfi/Repositories/not/crates/network)
error[E0080]: evaluation panicked: not yet implemented
--> /Users/setoelkahfi/.cargo/git/checkouts/ring-794206c1dca33632/1bb94b3/src/cpu/aarch64/mod.rs:38:13
|
38 | todo!(); // Need to run tests for this ABI.
| ^^^^^^^ evaluation of `cpu::aarch64::abi_assumptions::_ASSUMED_POINTER_SIZE` failed here
|
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
note: erroneous constant encountered
--> /Users/setoelkahfi/.cargo/git/checkouts/ring-794206c1dca33632/1bb94b3/src/cpu/aarch64/mod.rs:46:67
|
46 | const _ASSUMED_USIZE_SIZE: () = assert!(size_of::<usize>() == _ASSUMED_POINTER_SIZE);
| ^^^^^^^^^^^^^^^^^^^^^
note: erroneous constant encountered
--> /Users/setoelkahfi/.cargo/git/checkouts/ring-794206c1dca33632/1bb94b3/src/cpu/aarch64/mod.rs:47:71
|
47 | const _ASSUMED_REF_SIZE: () = assert!(size_of::<&'static u8>() == _ASSUMED_POINTER_SIZE);
| ^^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0080`.
error: could not compile `ring` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
So, I was hoping to use cargo-dinghy to test this in the watchOS simulator but it doesn't seem to support arm64_32. And I can't find any documentation about how to run arm64_32 apps in the simulator. I guessed that I need to build using
--target=arm64_32-apple-watchosbut my understanding is that if I want to run in a simulator, I need to use a-simtarget; yet there is noarm64_32-apple-watchos-simtarget.So then my thinking is that I need to define my own
arm64_32-apple-watchos-simthat is just likearm64_32-apple-watchosexcept linking against different libraries. Or, use target arm64_32-apple-watchos` but configure the build system in some way to link against simulator libraries instead?Any tips regarding this?
Does this help? Haven't done low-level programming that long, but I'm familiar with the Apple tooling.
@briansmith I remove the todo and it works:
setoelkahfi@Heighliner1 wallet-kit-v3 % cargo swift package
✔ Swift Package Name ·
✔ Select Target Platforms · watchOS (Experimental)
✔ Building target watchOS
cargo +nightly build -Z build-std --target aarch64-apple-watchos
cargo +nightly build -Z build-std --target arm64_32-apple-watchos
cargo +nightly build -Z build-std --target armv7k-apple-watchos
mkdir -p target/universal-watchos/debug
lipo target/aarch64-apple-watchos/debug/libwallet_kit_v3.a \
target/arm64_32-apple-watchos/debug/libwallet_kit_v3.a \
target/armv7k-apple-watchos/debug/libwallet_kit_v3.a -create -output \
target/universal-watchos/debug/libwallet_kit_v3.a
✔ Building target watchOS Simulator
cargo +nightly build -Z build-std --target aarch64-apple-watchos-sim
cargo +nightly build -Z build-std --target x86_64-apple-watchos-sim
mkdir -p target/universal-watchos-sim/debug
lipo target/aarch64-apple-watchos-sim/debug/libwallet_kit_v3.a \
target/x86_64-apple-watchos-sim/debug/libwallet_kit_v3.a -create -output \
target/universal-watchos-sim/debug/libwallet_kit_v3.a
✔ Generating Swift bindings...
✔ Creating XCFramework...
✔ Creating Swift Package ' '...
✔ Successfully created Swift Package in ' /'!
setoelkahfi@Heighliner1 wallet-kit-v3 %