signalapp / libsignal

Home to the Signal Protocol as well as other cryptographic primitives which make Signal possible.
GNU Affero General Public License v3.0
3.63k stars 420 forks source link

aarch64 build fails while linking #482

Closed morph027 closed 2 years ago

morph027 commented 2 years ago
$ export LINKER=aarch64-linux-gnu-gcc
$ cat >~/.cargo/config <<EOF
[target.$TARGET]
linker = "$LINKER"
EOF
$ export CARGO_BUILD_TARGET=$TARGET RUSTFLAGS="-C link-arg=-s" CARGO_FLAGS="-p libsignal-jni"
$ cargo build --release --verbose $CARGO_FLAGS

fails with:

   Compiling libsignal-jni v0.19.3 (/tmp/libsignal-client/rust/bridge/jni)
     Running `rustc --crate-name signal_jni --edition=2018 rust/bridge/jni/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type cdylib --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="armv8"' --cfg 'feature="default"' -C metadata=bff49d76ae8478b1 --out-dir /tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps --target aarch64-unknown-linux-gnu -C linker=aarch64-linux-gnu-gcc -L dependency=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps -L dependency=/tmp/libsignal-client/target/release/deps --extern async_trait=/tmp/libsignal-client/target/release/deps/libasync_trait-288c77eeee9764d7.so --extern cfg_if=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libcfg_if-319324b691dee26a.rlib --extern jni=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libjni-914747eeca937d6c.rlib --extern libsignal_bridge=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/liblibsignal_bridge-8aeb4258ff909980.rlib --extern libsignal_protocol=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/liblibsignal_protocol-7f7fde8b65db60b5.rlib --extern log=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/liblog-223091cc43495150.rlib --extern log_panics=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/liblog_panics-e912127b9e715ca2.rlib --extern rand=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/librand-2edb1a9105733ffd.rlib --extern signal_crypto=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libsignal_crypto-90d159f2604eccf6.rlib -C link-arg=-s -L native=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/build/boring-sys-1a736344102f58cb/out/build/`
error: linking with `aarch64-linux-gnu-gcc` failed: exit status: 1
  |
  = note: "aarch64-linux-gnu-gcc" "-Wl,--version-script=/tmp/rustcrXaHcg/list" "/tmp/rustcrXaHcg/symbols.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.0.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.1.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.10.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.11.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.12.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.13.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.14.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.15.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.2.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.3.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.4.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.5.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.6.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.7.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.8.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.signal_jni.0ebda322-cgu.9.rcgu.o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/signal_jni.p8xvh8xja2ckwv5.rcgu.o" "-Wl,--as-needed" "-L" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps" "-L" "/tmp/libsignal-client/target/release/deps" "-L" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/build/boring-sys-1a736344102f58cb/out/build/" "-L" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/liblog_panics-e912127b9e715ca2.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libbacktrace-bba3e73e50a5d651.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libminiz_oxide-1ec08ea541efa9da.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libadler-68a33e39bda2c479.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libobject-813ba44a96a08171.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libaddr2line-b91699a987fbd1dd.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libgimli-ef4e635788d840ee.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/librustc_demangle-b36519ea690f9bc3.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/liblibsignal_bridge-8aeb4258ff909980.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libfutures_util-43392fec2830e60e.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libslab-ae4ba2fcdd082726.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libpin_project_lite-3d9948de666c3195.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libfutures_task-f745aa5bbbd904a0.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libpin_utils-1e5b00d325e84b5a.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libfutures_core-c8c8eb32d5b3e45e.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libzkgroup-04d0f74e8f92cd5c.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libbincode-e76a7d9bf81e796c.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libpoksho-b1995fd12d7aa3b1.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libsignal_crypto-90d159f2604eccf6.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libghash-54894ec8c45801f5.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libsha1-62025d4258509b88.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/liblibsignal_protocol-7f7fde8b65db60b5.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libhkdf-b7e19c051ef25a5e.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libnum_enum-0ef579da64593ec8.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libitertools-9b9e816bb6fc6874.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libeither-df83b344dd4a35b0.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libaes_gcm_siv-f291a9a45657cfb3.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libpolyval-ab537c2c5d83eff6.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libarrayref-a885c792cc0bdfbc.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/librand-2edb1a9105733ffd.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/librand_chacha-78899f925dbb1173.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libppv_lite86-0e3b18e722e88f6c.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libhmac-b20b7d8f3bc005b2.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libcrypto_mac-3ba05197a5fd4e9a.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libblock_modes-b544ab35fd93e71e.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libblock_padding-789fa94184733671.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libaes-1b35aab3bb174916.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libctr-19424213d63533f3.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libcpufeatures-f5a418634802bd45.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libdevice_transfer-5c5d0d1a4a8bc04d.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libattest-dc302489626a405b.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libstatic_assertions-2c3b8014ec807b71.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libx25519_dalek-d0abadf9491026ba.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libcurve25519_dalek-ae3396690140ef70.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/librand_core-9a06c5a4e3542c7d.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libgetrandom-2a84ad6d1c02f1f1.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libbyteorder-d62e4bfc79136463.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libsnow-c8d2c02177790240.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/librand_core-2a1e260e9d31c33e.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libgetrandom-ec2b022fe7dade74.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libchacha20poly1305-2e6286ae7436cc1c.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libchacha20-fbceacdf668c8d46.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libzeroize-9984b2676480b8f5.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libpoly1305-64da5eb9ca96e332.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libuniversal_hash-c71509823ba4b492.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libsubtle-cd3c560ad81d8bb4.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libaead-85aa8dbb4ec8fd3a.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libcipher-27239f2d81cd9c10.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libasn1-cfb8a20a897a9a68.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libserde_json-b0008fbf7ccc7b93.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libryu-5a2117cebe7360d9.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libitoa-0f934995b89f2372.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libchrono-e535c4e3e05ad745.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libnum_integer-3ccc4ff6bcf9f769.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libnum_traits-5f6fa5da635d7f64.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libtime-76a880a2a8aca6b2.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libsha2-e1b764a70d14f493.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libopaque_debug-bb3dee8f17790f92.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libdigest-7b48b0ca4724002c.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libblock_buffer-467a4e18db359d7f.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libgeneric_array-faed9f9829a1eace.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libtypenum-b70a21793d9f9ec7.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libuuid-36fa5d7d4549611f.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libhex-16a16c8f93b965ed.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libserde-cb5af5e38b814ac9.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libboring-48be56d31e134474.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/liblibc-bc3533728b26d1a9.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libboring_sys-916e5e331a1f17d0.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libforeign_types-2b22cae391d9b5e6.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libforeign_types_shared-4c741ab5f6d62e8c.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libbitflags-23db6ffbcf363788.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libprost-2a15758fef409fe0.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/liblazy_static-2c33a22b764eecca.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libjni-914747eeca937d6c.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libcesu8-aaacd85f82dc549e.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/liblog-223091cc43495150.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libcfg_if-319324b691dee26a.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libcombine-a6af2ff7606f739f.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libmemchr-b5350db79e9050ff.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libbytes-dc4f811a1813e252.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libthiserror-e32f93a4372181f2.rlib" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libjni_sys-f60b1afb3b127c56.rlib" "-Wl,--start-group" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd-c6776109d9fae8e1.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libpanic_unwind-9e625e374cafe301.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libobject-b4e3180ef786b02f.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libmemchr-428d5ed163f5bc19.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libaddr2line-8710e5ac2d1f40c6.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libgimli-936bacb0e0c816b3.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_demangle-ce330380c2d1d017.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd_detect-ed525c63c6d095fe.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libhashbrown-217328d4b0643bf1.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libminiz_oxide-254c090170f1ff6e.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libadler-294036ac252aeb4e.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-6795bcaa1822c198.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libunwind-06e00ea827af2626.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcfg_if-3a66cb6c2370c818.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/liblibc-9ad51d85e9b1d70f.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/liballoc-79ff9e8e1bd3586c.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_core-5a016b349f64c169.rlib" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcore-ba3072fd9d1e03a2.rlib" "-Wl,--end-group" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-277087cf11259302.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/root/.rustup/toolchains/nightly-2022-06-22-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libsignal_jni.so" "-Wl,--gc-sections" "-shared" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs" "-s"
  = note: /usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libboring_sys-916e5e331a1f17d0.rlib(a_int.c.o): Relocations in generic ELF (EM: 62)
          /usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libboring_sys-916e5e331a1f17d0.rlib(a_int.c.o): Relocations in generic ELF (EM: 62)
          /usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libboring_sys-916e5e331a1f17d0.rlib(a_int.c.o): Relocations in generic ELF (EM: 62)
          /usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libboring_sys-916e5e331a1f17d0.rlib(a_int.c.o): Relocations in generic ELF (EM: 62)
          /usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libboring_sys-916e5e331a1f17d0.rlib(a_int.c.o): Relocations in generic ELF (EM: 62)
          /usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libboring_sys-916e5e331a1f17d0.rlib(a_int.c.o): Relocations in generic ELF (EM: 62)
          /usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libboring_sys-916e5e331a1f17d0.rlib(a_int.c.o): Relocations in generic ELF (EM: 62)
          /usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libboring_sys-916e5e331a1f17d0.rlib(a_int.c.o): Relocations in generic ELF (EM: 62)
          /usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libboring_sys-916e5e331a1f17d0.rlib(a_int.c.o): Relocations in generic ELF (EM: 62)
          /usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libboring_sys-916e5e331a1f17d0.rlib: error adding symbols: file in wrong format
          collect2: error: ld returned 1 exit status

error: could not compile `libsignal-jni` due to previous error

Caused by:
  process didn't exit successfully: `rustc --crate-name signal_jni --edition=2018 rust/bridge/jni/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type cdylib --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="armv8"' --cfg 'feature="default"' -C metadata=bff49d76ae8478b1 --out-dir /tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps --target aarch64-unknown-linux-gnu -C linker=aarch64-linux-gnu-gcc -L dependency=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps -L dependency=/tmp/libsignal-client/target/release/deps --extern async_trait=/tmp/libsignal-client/target/release/deps/libasync_trait-288c77eeee9764d7.so --extern cfg_if=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libcfg_if-319324b691dee26a.rlib --extern jni=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libjni-914747eeca937d6c.rlib --extern libsignal_bridge=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/liblibsignal_bridge-8aeb4258ff909980.rlib --extern libsignal_protocol=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/liblibsignal_protocol-7f7fde8b65db60b5.rlib --extern log=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/liblog-223091cc43495150.rlib --extern log_panics=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/liblog_panics-e912127b9e715ca2.rlib --extern rand=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/librand-2edb1a9105733ffd.rlib --extern signal_crypto=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/deps/libsignal_crypto-90d159f2604eccf6.rlib -C link-arg=-s -L native=/tmp/libsignal-client/target/aarch64-unknown-linux-gnu/release/build/boring-sys-1a736344102f58cb/out/build/` (exit status: 1)
jrose-signal commented 2 years ago

I believe you also need to set CC, CXX, and possibly CPATH when cross-compiling now, thanks to adding BoringSSL as a dependency. You can see how we do this for the aarch64-linux NPM package:

https://github.com/signalapp/libsignal/blob/13b60197a98c166a7bde7b3cd615e2c2f774cb29/node/docker-prebuildify.sh#L22-L26

Let me know if that works for you!

morph027 commented 2 years ago

Thanks for the hint, will try and report back!

morph027 commented 2 years ago

Thanks, this did the trick :tada:

    ...
    Finished release [optimized] target(s) in 0.07s
root@976d43a95272:/tmp/libsignal-client# file target/aarch64-unknown-linux-gnu/release/libsignal_jni.so 
target/aarch64-unknown-linux-gnu/release/libsignal_jni.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=7a41ad466a5cab304e0942edff97ceaf4bcc3202, stripped