Closed TheBlueMatt closed 1 year ago
Upgraded to 1.68.0 from 1.67.1 this morning and linking for an Android target seems to be failing due to the introduction of -lunwind passed to the linker.
-lunwind
Relevant CI snippets from the build run:
+ export 'CFLAGS_x86_64_linux_android=-ffile-prefix-map=/github/home/.cargo= -frandom-seed=42' + CFLAGS_x86_64_linux_android='-ffile-prefix-map=/github/home/.cargo= -frandom-seed=42' + export CC_x86_64_linux_android=x86_64-linux-android24-clang + CC_x86_64_linux_android=x86_64-linux-android24-clang + RUSTFLAGS='--cfg=c_bindings --remap-path-prefix /__w/ldk-garbagecollected/ldk-garbagecollected/rust-lightning=rust-lightning --remap-path-prefix /__w/ldk-garbagecollected/ldk-garbagecollected/ldk-c-bindings=ldk-c-bindings --remap-path-prefix /github/home/.cargo= -C embed-bitcode=yes -C lto -C linker=x86_64-linux-android24-clang' + CARGO_PROFILE_RELEASE_LTO=true + cargo build --features=std -v --release --target x86_64-linux-android
Note that Cargo.toml for the crate also includes:
Cargo.toml
[lib] name = "ldk" crate-type = ["staticlib", "cdylib"] [features] ... [dependencies] ... [profile.dev] panic = "abort" [profile.release] panic = "abort"
Ultimately it errors with:
error: linking with `x86_64-linux-android24-clang` failed: exit status: 1 | = note: LC_ALL="C" PATH="/github/home/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/github/home/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/__w/ldk-garbagecollected/ldk-garbagecollected/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/bin:~/.cargo/bin" VSLANG="1033" "x86_64-linux-android24-clang" "-Wl,--version-script=/tmp/rustchxgOwt/list" "-m64" "/tmp/rustchxgOwt/symbols.o" "/__w/ldk-garbagecollected/ldk-garbagecollected/ldk-c-bindings/lightning-c-bindings/target/x86_64-linux-android/release/deps/ldk.ldk.e1ac8e4d-cgu.1.rcgu.o" "-Wl,--as-needed" "-L" "/__w/ldk-garbagecollected/ldk-garbagecollected/ldk-c-bindings/lightning-c-bindings/target/x86_64-linux-android/release/deps" "-L" "/__w/ldk-garbagecollected/ldk-garbagecollected/ldk-c-bindings/lightning-c-bindings/target/release/deps" "-L" "/__w/ldk-garbagecollected/ldk-garbagecollected/ldk-c-bindings/lightning-c-bindings/target/x86_64-linux-android/release/build/secp256k1-sys-f58fb0f1ec277fc7/out" "-L" "/github/home/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-linux-android/lib" "-Wl,-Bstatic" "/tmp/rustchxgOwt/libsecp256k1_sys-513b9661f2c3756c.rlib" "/github/home/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-linux-android/lib/libcompiler_builtins-367de5b14a245593.rlib" "-Wl,-Bdynamic" "-ldl" "-llog" "-lunwind" "-ldl" "-lm" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/github/home/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-linux-android/lib" "-o" "/__w/ldk-garbagecollected/ldk-garbagecollected/ldk-c-bindings/lightning-c-bindings/target/x86_64-linux-android/release/deps/libldk.so" "-Wl,--gc-sections" "-shared" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs" = note: ld: error: unable to find library -lunwind clang: error: linker command failed with exit code 1 (use -v to see invocation)
Exact replication can be found in the CI script at https://github.com/TheBlueMatt/ldk-garbagecollected/blob/11c3a5cc649678de124295c7aff725df00905a0d/.github/workflows/build.yml#L253
You'll need a newer NDK: https://blog.rust-lang.org/2023/01/09/android-ndk-update-r25.html
Ah, okay, will just pin to rust 1.67.
Upgraded to 1.68.0 from 1.67.1 this morning and linking for an Android target seems to be failing due to the introduction of
-lunwind
passed to the linker.Relevant CI snippets from the build run:
Note that
Cargo.toml
for the crate also includes:Ultimately it errors with:
Exact replication can be found in the CI script at https://github.com/TheBlueMatt/ldk-garbagecollected/blob/11c3a5cc649678de124295c7aff725df00905a0d/.github/workflows/build.yml#L253