fdo-rs / fido-device-onboard-rs

An implementation of the FIDO Device Onboard (FDO) spec written in Rust.
BSD 3-Clause "New" or "Revised" License
62 stars 34 forks source link

cross compilation fail: libcrypto.so: undefined reference to `sigsetjmp' #347

Open muvarov opened 1 year ago

muvarov commented 1 year ago

Native compilation (aarch64) works fine. But cross compilation (aarch64 on aarch64) mostly works fine, but fails on linking fdo-data-formats.

  = note: /usr/bin/ld: warning: libc.so, needed by /home/muvarov/buildroot/buildroot.git/output/host/bin/../aarch64-buildroot-linux-musl/sysroot/usr/lib/libssl.so, not found (try using -rpath or -rpath-link)
          /usr/bin/ld: /home/muvarov/buildroot/buildroot.git/output/host/bin/../aarch64-buildroot-linux-musl/sysroot/usr/lib/libcrypto.so: undefined reference to `sigsetjmp'
          collect2: error: ld returned 1 exit status

Full log:

PATH="/home/muvarov/buildroot/buildroot.git/output/host/bin:/home/muvarov/buildroot/buildroot.git/output/host/sbin:/home/muvarov/.local/bin:/home/muvarov/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" PATH="/home/muvarov/buildroot/buildroot.git/output/host/bin:/home/muvarov/buildroot/buildroot.git/output/host/sbin:/home/muvarov/.local/bin:/home/muvarov/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" AR="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-gcc-ar" AS="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-as" LD="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-ld" NM="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-gcc-nm" CC="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-gcc" GCC="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-gcc" CPP="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-cpp" CXX="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-g++" FC="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-gfortran" F77="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-gfortran" RANLIB="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-gcc-ranlib" READELF="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-readelf" STRIP="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-strip" OBJCOPY="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-objcopy" OBJDUMP="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-objdump" AR_FOR_BUILD="/usr/bin/ar" AS_FOR_BUILD="/usr/bin/as" CC_FOR_BUILD="/usr/bin/gcc" GCC_FOR_BUILD="/usr/bin/gcc" CXX_FOR_BUILD="/usr/bin/g++" LD_FOR_BUILD="/usr/bin/ld" CPPFLAGS_FOR_BUILD="-I/home/muvarov/buildroot/buildroot.git/output/host/include" CFLAGS_FOR_BUILD="-O2 -I/home/muvarov/buildroot/buildroot.git/output/host/include" CXXFLAGS_FOR_BUILD="-O2 -I/home/muvarov/buildroot/buildroot.git/output/host/include" LDFLAGS_FOR_BUILD="-L/home/muvarov/buildroot/buildroot.git/output/host/lib -Wl,-rpath,/home/muvarov/buildroot/buildroot.git/output/host/lib" FCFLAGS_FOR_BUILD="" DEFAULT_ASSEMBLER="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-as" DEFAULT_LINKER="/home/muvarov/buildroot/buildroot.git/output/host/bin/aarch64-buildroot-linux-musl-ld" CPPFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 " CXXFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 " LDFLAGS="" FCFLAGS=" -Os -g0" FFLAGS=" -Os -g0" PKG_CONFIG="/home/muvarov/buildroot/buildroot.git/output/host/bin/pkg-config" STAGING_DIR="/home/muvarov/buildroot/buildroot.git/output/host/aarch64-buildroot-linux-musl/sysroot" INTLTOOL_PERL=/usr/bin/perl CARGO_HOME=/home/muvarov/buildroot/buildroot.git/output/host/share/cargo __CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS="nightly" CARGO_UNSTABLE_TARGET_APPLIES_TO_HOST="true" CARGO_TARGET_APPLIES_TO_HOST="false" CARGO_BUILD_TARGET="aarch64-unknown-linux-musl" CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-buildroot-linux-musl-gcc RUSTFLAGS="-Clink-arg=--sysroot=/home/muvarov/buildroot/buildroot.git/output/host/aarch64-buildroot-linux-musl/sysroot -C target-feature=-crt-static"  cargo build --offline --release --manifest-path Cargo.toml 
   Compiling openssl v0.10.42
   Compiling fdo-data-formats v0.4.6 (/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/data-formats)
   Compiling fdo-data v0.4.6 (/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/libfdo-data)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "/tmp/rustcxsSnZs/symbols.o" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/build/fdo-data-formats-9d382fed23df02e9/build_script_build-9d382fed23df02e9.build_script_build.e76bd0c6-cgu.0.rcgu.o" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/build/fdo-data-formats-9d382fed23df02e9/build_script_build-9d382fed23df02e9.build_script_build.e76bd0c6-cgu.1.rcgu.o" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/build/fdo-data-formats-9d382fed23df02e9/build_script_build-9d382fed23df02e9.build_script_build.e76bd0c6-cgu.10.rcgu.o" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/build/fdo-data-formats-9d382fed23df02e9/build_script_build-9d382fed23df02e9.build_script_build.e76bd0c6-cgu.2.rcgu.o" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/build/fdo-data-formats-9d382fed23df02e9/build_script_build-9d382fed23df02e9.build_script_build.e76bd0c6-cgu.3.rcgu.o" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/build/fdo-data-formats-9d382fed23df02e9/build_script_build-9d382fed23df02e9.build_script_build.e76bd0c6-cgu.4.rcgu.o" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/build/fdo-data-formats-9d382fed23df02e9/build_script_build-9d382fed23df02e9.build_script_build.e76bd0c6-cgu.5.rcgu.o" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/build/fdo-data-formats-9d382fed23df02e9/build_script_build-9d382fed23df02e9.build_script_build.e76bd0c6-cgu.6.rcgu.o" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/build/fdo-data-formats-9d382fed23df02e9/build_script_build-9d382fed23df02e9.build_script_build.e76bd0c6-cgu.7.rcgu.o" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/build/fdo-data-formats-9d382fed23df02e9/build_script_build-9d382fed23df02e9.build_script_build.e76bd0c6-cgu.8.rcgu.o" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/build/fdo-data-formats-9d382fed23df02e9/build_script_build-9d382fed23df02e9.build_script_build.e76bd0c6-cgu.9.rcgu.o" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/build/fdo-data-formats-9d382fed23df02e9/build_script_build-9d382fed23df02e9.4l69t0egttyxkiof.rcgu.o" "-Wl,--as-needed" "-L" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/deps" "-L" "/home/muvarov/buildroot/buildroot.git/output/host/bin/../aarch64-buildroot-linux-musl/sysroot/usr/lib" "-L" "/home/muvarov/buildroot/buildroot.git/output/host/bin/../aarch64-buildroot-linux-musl/sysroot/usr/lib" "-L" "/home/muvarov/buildroot/buildroot.git/output/host/lib64/rustlib/aarch64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/deps/libopenssl_kdf-1d957389b602adfc.rlib" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/deps/libopenssl-54892732806029a7.rlib" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/deps/libonce_cell-cdb0fec3c00439ae.rlib" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/deps/libbitflags-4edccd338c6afb66.rlib" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/deps/libforeign_types-a7ef904efe44189e.rlib" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/deps/libforeign_types_shared-cfe30b6ad2d9a298.rlib" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/deps/libcfg_if-3baf2a8e239ac5e2.rlib" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/deps/libopenssl_sys-cea328f909d5c9a0.rlib" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/deps/liblibc-74cd1606c5a81043.rlib" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/deps/libthiserror-ff6f7c082f06fd2a.rlib" "-Wl,--start-group" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd-68cf989bf21576a2.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libpanic_unwind-a06938467eba1401.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libobject-3a5b6fbc6fdbd79e.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libmemchr-b760ba801dcc2c4f.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libaddr2line-f912143f598459d8.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libgimli-ab7d76fd621aea54.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_demangle-e9b54f33a40972fa.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd_detect-14886220ace6ba73.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libhashbrown-2f3b3ea5bb956d21.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libminiz_oxide-6b4b76d573c9561d.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libadler-70e46d3f193845b3.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-69fbd16faf01b79c.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libunwind-a96fac268e04fc76.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcfg_if-2ebd35fa8a5f2bca.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/liblibc-b7bba26ece2a80fc.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/liballoc-b09ca59ce6e3d695.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_core-d8caf46c8eb1e1d6.rlib" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcore-6571ef23d2152d40.rlib" "-Wl,--end-group" "/home/muvarov/buildroot/buildroot.git/output/host/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-1bd0e5fd0bd49923.rlib" "-Wl,-Bdynamic" "-lssl" "-lcrypto" "-lssl" "-lcrypto" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/home/muvarov/buildroot/buildroot.git/output/host/lib64/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "/home/muvarov/buildroot/buildroot.git/output/build/fido-98da7827660a275ce53f5a9ac556415fff0dae83/target/release/build/fdo-data-formats-9d382fed23df02e9/build_script_build-9d382fed23df02e9" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs"
  = note: /usr/bin/ld: warning: libc.so, needed by /home/muvarov/buildroot/buildroot.git/output/host/bin/../aarch64-buildroot-linux-musl/sysroot/usr/lib/libssl.so, not found (try using -rpath or -rpath-link)
          /usr/bin/ld: /home/muvarov/buildroot/buildroot.git/output/host/bin/../aarch64-buildroot-linux-musl/sysroot/usr/lib/libcrypto.so: undefined reference to `sigsetjmp'
          collect2: error: ld returned 1 exit status

  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)
muvarov commented 1 year ago

data-formats/build.rs breaks compilation. If file deleted compilation works fine.

7flying commented 1 year ago

Just to re-check everything, you are cross-compiling aarch64 on aarch64, and native compilation worked on aarch64. Is that right?

muvarov commented 1 year ago

Just to re-check everything, you are cross-compiling aarch64 on aarch64, and native compilation worked on aarch64. Is that right?

Yes, that is correct.