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

Building using xargo to support tier 3 target aarch64-apple-ios-sim error. rust-src component not found. #361

Closed
MuhtasimTanmoy opened this issue Sep 23, 2021 · 4 comments

Comments

@MuhtasimTanmoy
Copy link

MuhtasimTanmoy commented Sep 23, 2021

I am trying to install it through the pod.

Error is given compiling libsignal-ffi:

 Compiling libsignal-ffi v0.9.4 (/Users/tanmoy/Library/Caches/CocoaPods/Pods/External/SignalClient/94c18a0d31671033b99c08bafb98f6e4/rust/bridge/ffi)
    Finished release [optimized + debuginfo] target(s) in 2m 38s
warning: Building using xargo to support tier 3 target aarch64-apple-ios-sim.
error: `rust-src` component not found. Run `rustup component add rust-src`.
note: run with `RUST_BACKTRACE=1` for a backtrace

But I already have that required module.

Based on the toolchain used in this repository,

https://github.com/signalapp/libsignal-client/blob/master/rust-toolchain

I used the exact same rust-src

export XARGO_RUST_SRC=/Users/tanmoy/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library

This time another error building std.

 Compiling std v0.0.0 (/Users/tanmoy/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std)
error[E0557]: feature has been removed
   --> /Users/tanmoy/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/lib.rs:102:37

.....

error: aborting due to 325 previous errors; 7 warnings emitted

Some errors have detailed explanations: E0277, E0307, E0522, E0557, E0658.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `core`

Update

Based on the solution provided by this repo, commenting these three solved this with keeping compatibility only to iOS devices.

CARGO_BUILD_TARGET=aarch64-apple-ios swift/build_ffi.sh --release
CARGO_BUILD_TARGET=x86_64-apple-ios swift/build_ffi.sh --release
# CARGO_BUILD_TARGET=aarch64-apple-ios-sim swift/build_ffi.sh --release --use-xargo
# CARGO_BUILD_TARGET=x86_64-apple-ios-macabi swift/build_ffi.sh --release --use-xargo
# CARGO_BUILD_TARGET=aarch64-apple-ios-macabi swift/build_ffi.sh --release --use-xargo

What the specific reason for those errors and how to get past them?

@jrose-signal
Copy link
Contributor

I've never had to set XARGO_RUST_SRC, but also that doesn't look like the same toolchain at all: you're pointing at stable-x86_64-apple-darwin, and we use nightly-2021-06-08-x86_64-apple-darwin. Just to check, have you tried running rustup component add rust-src from within the libsignal-client directory?

@jrose-signal
Copy link
Contributor

…ah, there is no libsignal-client directory if you are depending on this as a CocoaPod, huh. Guess we should tweak the error message: rustup +nightly-2021-06-08 component add rust-src.

You're also welcome to turn off the extra targets yourself, but we do want to build for those platforms.

@MuhtasimTanmoy
Copy link
Author

MuhtasimTanmoy commented Sep 24, 2021

I've never had to set XARGO_RUST_SRC, but also that doesn't look like the same toolchain at all: you're pointing at stable-x86_64-apple-darwin, and we use nightly-2021-06-08-x86_64-apple-darwin. Just to check, have you tried running rustup component add rust-src from within the libsignal-client directory?

I did use that exact toolchain specified with export (though shown only one).

Used the two specified below:

  • nightly-2021-06-08-x86_64-apple-darwin
  • stable-x86_64-apple-darwin

To regenerate this error simply add 'SignalClient' as a dependency in your Podfile.

pod 'SignalClient', git: 'https://github.com/signalapp/libsignal-client.git'

As per, running rustup component add rust-src from within the libsignal-client directory?, which I generated cloning this repo and using as development pod. It worked as it took the nightly rust toolchain.

 pod 'SignalClient', path: '../libsignal-client', testspecs: ["Tests"]

Solution

rustup +nightly-2021-06-08 component add rust-src

This did solve for all cases.

Could generate, release build for all these architecture finally.

  • aarch64-apple-ios
  • x86_64-apple-ios
  • aarch64-apple-ios-sim
  • x86_64-apple-ios-macabi
  • aarch64-apple-ios-macabi`

Thanks for your help. Kindly tweak the error message.

Why the nightly rust build was used instead of stable, default?

@jrose-signal
Copy link
Contributor

There's some discussion on why-nightly-not-stable in #141:

It builds on stable for x86, but not for aarch64, due to the use of intrinsics in the AES-GCM-SIV part. Additionally, cbindgen's support for macros requires nightly as well due to the use of unstable rustc flag --pretty=expanded. Rather than test against two different configurations, we decided to stick with nightly for now.

I'll leave this issue open to track the error message tweak.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants