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

Build error when targeting Apple iOS for grin-wallet v4.0.0 #479

Closed
shitong opened this issue Jul 16, 2020 · 3 comments
Closed

Build error when targeting Apple iOS for grin-wallet v4.0.0 #479

shitong opened this issue Jul 16, 2020 · 3 comments

Comments

@shitong
Copy link

shitong commented Jul 16, 2020

Describe the bug
When developing mobile wallet for grin, I was failed to buid the code for Apple iOS Device for grin-wallet v4.0.0

To Reproduce

build commend:

cargo lipo --targets aarch64-apple-ios x86_64-apple-ios armv7-apple-ios armv7s-apple-ios --release

Relevant Information
I get the following error when building for ARM64 & ARMV7 (Apple iOS Device) targets:

error: failed to run custom build command for `croaring-sys-mw v0.4.5`

Caused by:
  process didn't exit successfully: `/Users/stone/dev/project/Vite_GrinWallet/rust/target/release/build/croaring-sys-mw-8573115f4414bd6f/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("aarch64-apple-ios")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-apple-darwin")
CC_aarch64-apple-ios = None
CC_aarch64_apple_ios = None
TARGET_CC = None
CC = None
CROSS_COMPILE = None
CFLAGS_aarch64-apple-ios = None
CFLAGS_aarch64_apple_ios = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = None
Detecting iOS SDK path for iphoneos
CC_aarch64-apple-ios = None
CC_aarch64_apple_ios = None
TARGET_CC = None
CC = None
CROSS_COMPILE = None
CFLAGS_aarch64-apple-ios = None
CFLAGS_aarch64_apple_ios = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = None
Detecting iOS SDK path for iphoneos
CC_aarch64-apple-ios = None
CC_aarch64_apple_ios = None
TARGET_CC = None
CC = None
CROSS_COMPILE = None
CFLAGS_aarch64-apple-ios = None
CFLAGS_aarch64_apple_ios = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = None
Detecting iOS SDK path for iphoneos
running: "cc" "-O3" "-fPIC" "-arch" "arm64" "-miphoneos-version-min=7.0" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk" "-fembed-bitcode" "-Wall" "-Wextra" "-std=c11" "-O3" "-DDISABLEAVX=1" "-o" "/Users/stone/dev/project/Vite_GrinWallet/rust/target/aarch64-apple-ios/release/build/croaring-sys-mw-8346e4466eeb2694/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c"
exit code: 0
AR_aarch64-apple-ios = None
AR_aarch64_apple_ios = None
TARGET_AR = None
AR = None
running: "ar" "crs" "/Users/stone/dev/project/Vite_GrinWallet/rust/target/aarch64-apple-ios/release/build/croaring-sys-mw-8346e4466eeb2694/out/libroaring.a" "/Users/stone/dev/project/Vite_GrinWallet/rust/target/aarch64-apple-ios/release/build/croaring-sys-mw-8346e4466eeb2694/out/CRoaring/roaring.o"
exit code: 0
cargo:rustc-link-lib=static=roaring
cargo:rustc-link-search=native=/Users/stone/dev/project/Vite_GrinWallet/rust/target/aarch64-apple-ios/release/build/croaring-sys-mw-8346e4466eeb2694/out
cargo:warning=couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
cargo:warning=set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable

--- stderr
thread 'main' panicked at 'libclang error; possible causes include:
- Invalid flag syntax
- Unrecognized flags
- Invalid flag arguments
- File I/O errors
If you encounter an error missing from this list, please file an issue or a PR!', /Users/stone/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.52.0/src/ir/context.rs:567:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

[ERROR cargo_lipo] Failed to build "vite_grin_wallet" for "aarch64-apple-ios": Executing "/Users/stone/.rustup/toolchains/stable-x86_64-apple-darwin/bin/cargo" "--color" "auto" "build" "-p" "vite_grin_wallet" "--target" "aarch64-apple-ios" "--release" "--lib" finished with error status: exit code: 101

Desktop (please complete the following information):

  • macOS Catalina 10.15.5
  • clang
    • Apple clang version 11.0.3 (clang-1103.0.32.62)
    • Target: x86_64-apple-darwin19.5.0
    • Thread model: posix
    • InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Describe alternatives you've considered
Could anyone can help me to solve it.

@chenrui333
Copy link

I have run into the similar issue on 11.0 build for 5.0.0

@trevyn
Copy link
Contributor

trevyn commented Mar 20, 2021

This works for me:

cargo install cargo-lipo
rustup target add aarch64-apple-ios x86_64-apple-ios
git clone -b trevyn-ios https://github.com/trevyn/grin-wallet.git
cd grin-wallet
cargo lipo --targets aarch64-apple-ios x86_64-apple-ios --release

I will work on a PR for this, including iOS build CI tests, when mimblewimble/grin#3596 and #599 are merged.

(chenrui333's similar but separate issue is solved as of grin 5.0.1: mimblewimble/grin#3538)

xref: mimblewimble/grin#3393

@trevyn
Copy link
Contributor

trevyn commented Apr 5, 2021

Ok, this now works on master as of e9e6788 (with a staticlib target added).

Note that it works on Big Sur (macOS 11) but NOT on Catalina (macOS 10.15). (test CI run)

Since Azure Pipelines doesn't yet support macOS 11 runners, I'll add a CI test after that support is added.

Closable.

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

No branches or pull requests

4 participants