neqo
neqo copied to clipboard
neqo fails to cross-compile to Aarch64 with error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
how to reproduce:
- clone neqo repo
- clone nss repo into the neqo repo:
/tmp/neqo
/tmp/neqo/nss
execute: RUST_BACKTRACE=1 LIBCLANG_PATH=/usr/lib/llvm/9/lib64 NSS_DIR=/tmp/neqo/nss/ cargo build --target aarch64-unknown-linux-gnu
here's the backtrace with RUST_BACKTRACE=1, I'll attach the full log with RUST_BACKTRACE=full
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include/g++-v9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include/g++-v9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information, err: true
thread 'main' panicked at 'unable to generate bindings: ()', src/libcore/result.rs:1188:5
stack backtrace:
0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
1: core::fmt::write
2: std::io::Write::write_fmt
3: std::panicking::default_hook::{{closure}}
4: std::panicking::default_hook
5: std::panicking::rust_panic_with_hook
6: rust_begin_unwind
7: core::panicking::panic_fmt
8: core::result::unwrap_failed
9: core::result::Result<T,E>::expect
at /var/tmp/portage/dev-lang/rust-1.41.0/work/rustc-1.41.0-src/src/libcore/result.rs:983
10: build_script_build::build_bindings
at neqo-crypto/build.rs:273
11: build_script_build::main
at neqo-crypto/build.rs:390
12: std::rt::lang_start::{{closure}}
at /var/tmp/portage/dev-lang/rust-1.41.0/work/rustc-1.41.0-src/src/libstd/rt.rs:67
13: std::panicking::try::do_call
14: __rust_maybe_catch_panic
15: std::rt::lang_start_internal
16: std::rt::lang_start
at /var/tmp/portage/dev-lang/rust-1.41.0/work/rustc-1.41.0-src/src/libstd/rt.rs:67
17: main
18: __libc_start_main
19: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
full log: full-log-with-backtrace.log.gz
I first noticed this when trying to cross compile firefox from an amd64 host to an aarch64 target, here is that build log as well: firefox-73-cross-aarch64.gz
Is my approach correct to provide the hosts libclang.so via LIBCLANG_PATH?
So the specific error message is baffling, because these types are defined as equivalent in size.
The reason is that neqo triggers an NSS build without regard for the specific target architecture. That is a fairly obvious flaw that we just need to fix. We need to read $CARGO_BUILD_TARGET and pass the right command-line arguments to NSS.
The Firefox build should already be right in that we don't invoke the NSS build script, so I don't really know what is going on there yet.
@martinthomson just had another hit on this with more recent firefox-75 series, and also with firefox-68 esr. Do you deem this to be fixable at some point? Being able to get past this error will most likely speed up testing fixes and betas for arm64 by a lot.
@stefson is this still an issue?