Closed mouse07410 closed 4 months ago
I'm sorry about this. Because we bind to the AWS-LC (libcrypto) library, we must generate Rust bindings for its API. For Linux (x86, x86-64, aarch64) and Mac (x86-64), these bindings are pre-generated. However, other platforms need to enable our "bindgen" feature so that the binding are created at build-time.
One possible work-around is to take a direct dependency on aws-lc-rs
and enable the "bindgen" feature. This may also require the installation of libclang/llvm. Our User Guide provides basic instructions for this.
I'm having trouble reproducing this on an M2 Mac. I am curious whether you might be cross-compiling to a different platform?
Is your default toolchain stable-aarch64-apple-darwin
?
% rustup toolchain list
stable-aarch64-apple-darwin (default)
Another helpful data point might be your XCode active developer directory.
% xcode-select --print-path
/Library/Developer/CommandLineTools
For Linux (x86, x86-64, aarch64) and Mac (x86-64), these bindings are pre-generated. However, other platforms need to enable our "bindgen" feature so that the binding are created at build-time.
Since I'm not installing aws-lc-rs
directly (and it's a library crate, so direct install doesn't seem possible anyway), I have no control over what parameters rustls
passes to it when it builds it as a dependency. :-(
One possible work-around is to take a direct dependency on aws-lc-rs and enable the "bindgen" feature. This may also require the installation of libclang/llvm. Our User Guide provides basic instructions for this.
I already have LLVM and Clang installed via Macports, they appear to be fine (and live in /opt/local
).
Is your default toolchain
stable-aarch64-apple-darwin
? Another helpful data point might be your XCode active developer directory.
$ rustup toolchain list
stable-aarch64-apple-darwin (default)
nightly-aarch64-apple-darwin
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
$ xcode-select --version
xcode-select version 2405.
$ clang -v
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: arm64-apple-darwin23.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$
Failed to build it too, but with a different log:
error[E0425]: cannot find function, tuple struct or tuple variant `BIO_ctrl` in this scope
--> /PATH/TO/SOMEWHERE/aws-lc-sys-0.13.1/src/lib.rs:82:14
|
82 | unsafe { BIO_ctrl(b, BIO_CTRL_INFO, 0, pp.cast::<c_void>()) }
| ^^^^^^^^ not found in this scope
error[E0425]: cannot find function, tuple struct or tuple variant `CRYPTO_library_init` in this scope
--> /PATH/TO/SOMEWHERE/aws-lc-sys-0.13.1/src/lib.rs:86:14
|
86 | unsafe { CRYPTO_library_init() }
| ^^^^^^^^^^^^^^^^^^^ not found in this scope
For more information about this error, try `rustc --explain E0425`.
Failed to build it too, but with a different log:
It looks like your log matches the one reported separately in https://github.com/aws/aws-lc-rs/issues/348
@justsmth is it possible to add macos aarch64 to the list of pre-generated targets? A lot of developers are using Apple M1/2/3 computers, and the number of affected people (who will have to build from scratch) will only be increasing. Thanks!
@justsmth is it possible to add macos aarch64 to the list of pre-generated targets? A lot of developers are using Apple M1/2/3 computers, and the number of affected people (who will have to build from scratch) will only be increasing. Thanks!
Yes! :-)
This is something we've started working. I hope to have something ready to PR for it soon.
Closing issue. For latest discussion of issue see: rust-lang/rust-bindgen#2401
Problem:
It happens during build of https://github.com/rustls/rustls.git which tries to build dependencies
aws-lc-rs -> aws-lc-sys
.The issue has been reported here and recommended to bring up in this repo, because it appears to be this crate's problem. Steps to reproduce are shown there.
Relevant details
AWS-LC for Rust versions or commit: v1.6 (as far as I can tell)
System information: for linux, below info can be collected by running
uname -srvmp
Build log:
Caused by: process didn't exit successfully:
/Users/ur20980/src/rustls/target/release/build/aws-lc-sys-de27243413207beb/build-script-main
(exit status: 101) --- stdout cargo:rustc-cfg=use_bindgen_generated--- stderr /Users/ur20980/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.13.0/aws-lc/include/openssl/err.h:112:10: fatal error: 'stdio.h' file not found thread 'main' panicked at /Users/ur20980/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.13.0/builder/bindgen.rs:151:10: Unable to generate bindings.: ClangDiagnostic("/Users/ur20980/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.13.0/aws-lc/include/openssl/err.h:112:10: fatal error: 'stdio.h' file not found\n") stack backtrace: 0: rust_begin_unwind at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5 1: core::panicking::panic_fmt at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14 2: core::result::unwrap_failed at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1649:5 3: core::result::Result<T,E>::expect 4: build_script_main::bindgen::generate_bindings 5: build_script_main::generate_bindings 6: build_script_main::main 7: core::ops::function::FnOnce::call_once note: Some details are omitted, run with
RUST_BACKTRACE=full
for a verbose backtrace. warning: build failed, waiting for other jobs to finish... Tue Feb 13 16:35:59 EST 2024 $