Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to ndk-r23 #7339

Merged
merged 29 commits into from
Oct 22, 2021
Merged

Update to ndk-r23 #7339

merged 29 commits into from
Oct 22, 2021

Conversation

Grimler91
Copy link
Member

Here we go again.

rust packages fails with ld: error: unable to find library -lgcc

When they try to link we get something like (example here for navi):

error: linking with `aarch64-linux-android-clang` failed: exit status: 1
  |
  = note: "aarch64-linux-android-clang" "-Wl,--allow-multiple-definition" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-Wl,--as-needed" "-L" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.0.rcgu.o" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.1.rcgu.o" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.10.rcgu.o" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.2.rcgu.o" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.3.rcgu.o" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.4.rcgu.o" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.5.rcgu.o" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.6.rcgu.o" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.7.rcgu.o" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.8.rcgu.o" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.9.rcgu.o" "-o" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.47fzxe70psd4n8fn.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps" "-L" "/work/termux-build/navi/src/target/release/deps" "-L" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib" "-Wl,-Bstatic" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libnavi-64bf022ce5fd5a5b.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libshellwords-e34d65cc38cd2e21.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libserde_yaml-bc1b21b3adf1573e.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libdtoa-3f5d4a04271a3470.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libyaml_rust-c5d952bb583fba36.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/liblinked_hash_map-0d8b05706ecc031f.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libstrip_ansi_escapes-2ca786acbfbd6653.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libvte-19a2531bbed06eb8.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libutf8parse-24757c3b888196d8.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libedit-1fb712d33f8c67d3.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libwhich-60d6fa58cd4a18bd.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libeither-e680eeb81b02c2cf.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libtempfile-d29448bf85bfca09.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/librand-4bcb7e1877eeb01c.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/librand_chacha-e6190827f7dcfe31.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libppv_lite86-54288b4f1a200c26.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/librand_core-5b0271d28b31ad4d.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libgetrandom-fd158b19613409d5.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libremove_dir_all-8ecd85beac3b860c.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libcrossterm-5d3e93a8ffa1f924.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libsignal_hook_mio-7af87ea77c161def.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libsignal_hook-7659a8f2d44ed324.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libsignal_hook_registry-95f6e8163b459144.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libmio-f0a65f2cd9c64fb8.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/liblog-9ab5d84af7d4db68.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libparking_lot-734268b1144f3a72.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libparking_lot_core-24b88d5fc837ec1c.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libsmallvec-9d4dc7ad6dd1c05d.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/liblock_api-453fab6920c214c5.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libscopeguard-578eda6ad3e5fd02.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libinstant-31bf41a740cf9c6e.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libthiserror-0be275457ab318f6.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libremove_dir_all-420cc32177b65c89.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libwalkdir-9b952a7fcb7096a1.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libsame_file-407c42f784403851.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libregex-64c23884de5dab58.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libaho_corasick-fbb0dd1177c4b040.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libmemchr-c859dc0dcbf05488.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libregex_syntax-9742ceef1dc566e2.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libdirectories_next-ec5491b68550743a.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libdirs_sys_next-ac210efe031202a9.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libcfg_if-639be26b668c7646.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libserde-18fbf8fa798cdad9.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libclap-a4f01b96f8601ed2.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libstrsim-e8a8adcc68c40650.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libatty-e015232ab4965128.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/liblibc-ffa26ec1ebffa434.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libtextwrap-5de04e37c2a21232.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libvec_map-8416e876165750fb.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libos_str_bytes-baa0e81058c174ec.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libtermcolor-5dacba88dfb2698b.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libunicode_width-50b3534c70960aa7.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libindexmap-d8b06d43c5213be7.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libhashbrown-94bfc1c48ac270ec.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libbitflags-4e36f4b68c8e9b51.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/libanyhow-b0a9dce0b4445e85.rlib" "/work/termux-build/navi/src/target/aarch64-linux-android/release/deps/liblazy_static-1d8a45718878a61b.rlib" "-Wl,--start-group" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libstd-3a3c67c83f6e9693.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libpanic_unwind-4a7f1b4e8df66edf.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libminiz_oxide-1c444b92bf260b59.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libadler-a34baa6bd1fa056a.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libobject-9990946deb29ccd8.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libaddr2line-eac9d989053b21b1.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libgimli-76b6de8634d853f5.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libstd_detect-2ba4973c38d1e35a.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/librustc_demangle-1b7f8c5062d787de.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libhashbrown-7c08916365b94a34.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/librustc_std_workspace_alloc-085a7d01870b7259.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libunwind-3c84bbb091cf0b9c.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libcfg_if-442d7bfd08c535f4.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/liblibc-531b225150a26641.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/liballoc-421c1f5001becd46.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/librustc_std_workspace_core-b8bb8ba11acf6a13.rlib" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libcore-8397e2343cbd11b1.rlib" "-Wl,--end-group" "/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libcompiler_builtins-5ccae58f29f153e7.rlib" "-Wl,-Bdynamic" "-ldl" "-llog" "-lgcc" "-lc" "-lm" "-Wl,-rpath=/data/data/com.termux/files/usr/lib" "-Wl,--enable-new-dtags"
  = note: ld: error: unable to find library -lgcc
          clang-12: error: linker command failed with exit code 1 (use -v to see invocation)

Broken up into lines we have

linker command
aarch64-linux-android-clang \
-Wl,--allow-multiple-definition \
-Wl,--eh-frame-hdr \
-Wl,-znoexecstack \
-Wl,--as-needed \
-L /home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.0.rcgu.o \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.1.rcgu.o \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.10.rcgu.o \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.2.rcgu.o \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.3.rcgu.o \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.4.rcgu.o \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.5.rcgu.o \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.6.rcgu.o \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.7.rcgu.o \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.8.rcgu.o \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.navi.c9gk4uh9-cgu.9.rcgu.o \
-o /termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636 \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/navi-a2815ecf113c1636.47fzxe70psd4n8fn.rcgu.o \
-Wl,--gc-sections \
-pie \
-Wl,-zrelro \
-Wl,-znow \
-Wl,-O1 \
-nodefaultlibs \
-L /termux-build/navi/src/target/aarch64-linux-android/release/deps \
-L /termux-build/navi/src/target/release/deps \
-L /home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib \
-Wl,-Bstatic \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libnavi-64bf022ce5fd5a5b.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libshellwords-e34d65cc38cd2e21.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libserde_yaml-bc1b21b3adf1573e.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libdtoa-3f5d4a04271a3470.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libyaml_rust-c5d952bb583fba36.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/liblinked_hash_map-0d8b05706ecc031f.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libstrip_ansi_escapes-2ca786acbfbd6653.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libvte-19a2531bbed06eb8.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libutf8parse-24757c3b888196d8.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libedit-1fb712d33f8c67d3.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libwhich-60d6fa58cd4a18bd.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libeither-e680eeb81b02c2cf.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libtempfile-d29448bf85bfca09.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/librand-4bcb7e1877eeb01c.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/librand_chacha-e6190827f7dcfe31.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libppv_lite86-54288b4f1a200c26.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/librand_core-5b0271d28b31ad4d.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libgetrandom-fd158b19613409d5.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libremove_dir_all-8ecd85beac3b860c.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libcrossterm-5d3e93a8ffa1f924.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libsignal_hook_mio-7af87ea77c161def.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libsignal_hook-7659a8f2d44ed324.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libsignal_hook_registry-95f6e8163b459144.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libmio-f0a65f2cd9c64fb8.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/liblog-9ab5d84af7d4db68.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libparking_lot-734268b1144f3a72.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libparking_lot_core-24b88d5fc837ec1c.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libsmallvec-9d4dc7ad6dd1c05d.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/liblock_api-453fab6920c214c5.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libscopeguard-578eda6ad3e5fd02.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libinstant-31bf41a740cf9c6e.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libthiserror-0be275457ab318f6.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libremove_dir_all-420cc32177b65c89.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libwalkdir-9b952a7fcb7096a1.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libsame_file-407c42f784403851.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libregex-64c23884de5dab58.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libaho_corasick-fbb0dd1177c4b040.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libmemchr-c859dc0dcbf05488.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libregex_syntax-9742ceef1dc566e2.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libdirectories_next-ec5491b68550743a.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libdirs_sys_next-ac210efe031202a9.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libcfg_if-639be26b668c7646.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libserde-18fbf8fa798cdad9.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libclap-a4f01b96f8601ed2.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libstrsim-e8a8adcc68c40650.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libatty-e015232ab4965128.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/liblibc-ffa26ec1ebffa434.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libtextwrap-5de04e37c2a21232.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libvec_map-8416e876165750fb.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libos_str_bytes-baa0e81058c174ec.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libtermcolor-5dacba88dfb2698b.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libunicode_width-50b3534c70960aa7.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libindexmap-d8b06d43c5213be7.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libhashbrown-94bfc1c48ac270ec.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libbitflags-4e36f4b68c8e9b51.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/libanyhow-b0a9dce0b4445e85.rlib \
/termux-build/navi/src/target/aarch64-linux-android/release/deps/liblazy_static-1d8a45718878a61b.rlib \
-Wl,--start-group \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libstd-3a3c67c83f6e9693.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libpanic_unwind-4a7f1b4e8df66edf.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libminiz_oxide-1c444b92bf260b59.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libadler-a34baa6bd1fa056a.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libobject-9990946deb29ccd8.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libaddr2line-eac9d989053b21b1.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libgimli-76b6de8634d853f5.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libstd_detect-2ba4973c38d1e35a.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/librustc_demangle-1b7f8c5062d787de.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libhashbrown-7c08916365b94a34.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/librustc_std_workspace_alloc-085a7d01870b7259.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libunwind-3c84bbb091cf0b9c.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libcfg_if-442d7bfd08c535f4.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/liblibc-531b225150a26641.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/liballoc-421c1f5001becd46.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/librustc_std_workspace_core-b8bb8ba11acf6a13.rlib \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libcore-8397e2343cbd11b1.rlib \
-Wl,--end-group \
/home/grimler/.rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-linux-android/lib/libcompiler_builtins-5ccae58f29f153e7.rlib \
-Wl,-Bdynamic \
-ldl \
-llog \
-lgcc \
-lc \
-lm \
-Wl,-rpath=/data/data/com.termux/files/usr/lib \
-Wl,--enable-new-dtags

If I remove the -lgcc flags at the end there it works fine. Might be rust that adds it, and might be a linker flag we can pass to cargo to fix it.

@finagolfin
Copy link
Member

Heh, looks like libgcc.a has been removed, I don't see it in NDK 23. Probably related to removing binutils, except for gas:

GNU binutils, excluding the GNU Assembler (GAS), has been removed. GAS will be removed in the next release. If you are
building with -fno-integrated-as, file bugs if anything is preventing you from removing that flag.

@Grimler91
Copy link
Member Author

@buttaface I tried building rust with r23 and it failed with a similar error as for navi (and other rust packages) above

@finagolfin
Copy link
Member

That's a good sign for the compiler build, as it probably got farther? The question is where that link requirement is added, and whether we need to replace it or just remove it. I'll look.

@Grimler91
Copy link
Member Author

@buttaface oh, wait, it is an even more trivial error:

   Compiling merge_derive v0.1.0
   Compiling merge v0.1.0
   Compiling toml v0.5.7
    Finished dev [unoptimized + debuginfo] target(s) in 27.50s
warning: x.py has made several changes recently you may want to look at
help: consider looking at the changes in `src/bootstrap/CHANGELOG.md`
note: to silence this warning, add `changelog-seen = 2` at the top of `config.toml`
thread 'main' panicked at '

couldn't find required command: "/home/builder/.termux-build/_cache/android-r23-api-24-v0/bin/aarch64-linux-android-ar"

', src/bootstrap/sanity.rs:60:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failed to run: /home/builder/.termux-build/rust/build/build/bootstrap/debug/bootstrap install --stage 1 --host aarch64-linux-android --target aarch64-linux-android
Build completed unsuccessfully in 0:00:27

Just need to patch it to use llvm-ar instead of aarch64-linux-android-ar I believe

@finagolfin
Copy link
Member

I don't see anything in our repo and NDK 23 has nothing that could even use libgcc, even the gold linker is gone with the binutils removal. clang has some code that adds libgcc automatically, but your paste above has the rust build passing that libgcc dependency to clang, so it's coming from some Rust crate dependency most likely.

@Grimler91 Grimler91 force-pushed the ndk-r23 branch 3 times, most recently from 4a73982 to 745ab73 Compare August 17, 2021 13:43
@Grimler91
Copy link
Member Author

attr fails with:

make[1]: Entering directory '/home/builder/.termux-build/attr/src/po'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/builder/.termux-build/attr/src/po'
make[1]: Entering directory '/home/builder/.termux-build/attr/src'
  CC       tools/attr.o
  CC       tools/getfattr.o
  CC       tools/setfattr.o
  CC       libattr/la-attr_copy_action.lo
  CC       libattr/la-attr_copy_check.lo
  CC       libattr/la-attr_copy_fd.lo
  CC       libattr/la-attr_copy_file.lo
  CC       libattr/la-libattr.lo
  CC       libattr/la-syscalls.lo
  CC       libmisc/high_water_alloc.lo
  CC       libmisc/next_line.lo
  CC       libmisc/quote.lo
  CC       libmisc/unquote.lo
  CC       libmisc/walk_tree.lo
  CCLD     libattr.la
  CCLD     libmisc.la
  CCLD     attr
  CCLD     getfattr
  CCLD     setfattr
clang-12: error: no such file or directory: './.libs/libattr.so'
clang-12: error: no such file or directory: './.libs/libattr.so'
make[1]: *** [Makefile:925: attr] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:937: setfattr] Error 1
clang-12: error: no such file or directory: './.libs/libattr.so'
make[1]: *** [Makefile:931: getfattr] Error 1
make[1]: Leaving directory '/home/builder/.termux-build/attr/src'
make: *** [Makefile:1225: all-recursive] Error 1

With verbose make we have

[...]
libtool: compile:  aarch64-linux-android-clang -DHAVE_CONFIG_H -I. -I/home/builder/.termux-build/attr/src -I./include -I./include -I/home/builder/.termux-build/attr/src/include -DLOCALEDIR=\"/data/data/com.termux/files/usr/share/locale\" -DSYSCONFDIR=\"/data/data/com.termux/files/usr/etc\" -I/data/data/com.termux/files/usr/include -DNDEBUG -fstack-protector-strong -Oz -fvisibility=hidden -c /home/builder/.termux-build/attr/src/libmisc/walk_tree.c  -fPIC -DPIC -o libmisc/.libs/walk_tree.o
libtool: compile:  aarch64-linux-android-clang -DHAVE_CONFIG_H -I. -I/home/builder/.termux-build/attr/src -I./include -I./include -I/home/builder/.termux-build/attr/src/include -DLOCALEDIR=\"/data/data/com.termux/files/usr/share/locale\" -DSYSCONFDIR=\"/data/data/com.termux/files/usr/etc\" -I/data/data/com.termux/files/usr/include -DNDEBUG -fstack-protector-strong -Oz -fvisibility=hidden -c /home/builder/.termux-build/attr/src/libmisc/walk_tree.c -o libmisc/walk_tree.o >/dev/null 2>&1
/bin/bash ./libtool  --tag=CC   --mode=link aarch64-linux-android-clang  -fstack-protector-strong -Oz -fvisibility=hidden  -L/data/data/com.termux/files/usr/lib -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -o libmisc.la  libmisc/high_water_alloc.lo libmisc/next_line.lo libmisc/quote.lo libmisc/unquote.lo libmisc/walk_tree.lo  
libtool: link: llvm-ar cru .libs/libmisc.a libmisc/.libs/high_water_alloc.o libmisc/.libs/next_line.o libmisc/.libs/quote.o libmisc/.libs/unquote.o libmisc/.libs/walk_tree.o 
libtool: link: llvm-ranlib .libs/libmisc.a
libtool: link: ( cd ".libs" && rm -f "libmisc.la" && ln -s "../libmisc.la" "libmisc.la" )
/bin/bash ./libtool  --tag=CC   --mode=link aarch64-linux-android-clang  -fstack-protector-strong -Oz -fvisibility=hidden  -L/data/data/com.termux/files/usr/lib -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -o attr tools/attr.o  libattr.la libmisc.la 
libtool: link: aarch64-linux-android-clang -fstack-protector-strong -Oz -fvisibility=hidden -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z -Wl,relro -Wl,-z -Wl,now -o .libs/attr tools/attr.o  -L/data/data/com.termux/files/usr/lib ./.libs/libattr.so ./.libs/libmisc.a -fopenmp -L/data/data/com.termux/files/usr/lib
clang-12: error: no such file or directory: './.libs/libattr.so'
make[1]: *** [Makefile:929: attr] Error 1
make[1]: Leaving directory '/home/builder/.termux-build/attr/build'
make: *** [Makefile:1229: all-recursive] Error 1

Where we can see that it adds ./.libs/libattr.so ./.libs/libmisc.a as libraries for linking when compiling .libs/attr, instead of ./.libs/libattr.a ./.libs/libmisc.a.

With r21 it works fine.

Really weird, TERMUX_MAKE_PROCESSES=1 does not help, autoreconf -vfi does not help, and the Makefiles look sane. Maybe some issue with clang-12.0.5? Will try to create a minimal example..

@Grimler91
Copy link
Member Author

attr error fixed by using LD=ld.lld (or LD=ld) instead of LD=lld

@Grimler91
Copy link
Member Author

Except for the issues with rust packages (maybe we need to wait for the next rust release for that), we also have some golang packages that still have the same issue as we saw with r22:

ld: error: duplicate symbol: debug
>>> defined at rr.c
>>>            rr.o:(debug)
>>> defined at options.c
>>>            options.o:(.bss+0x0)

ld: error: duplicate symbol: debug
>>> defined at rr.c
>>>            rr.o:(debug)
>>> defined at main.c
>>>            main.o:(.bss+0x0)

(for dns2tcp here). We should be able to patch it though

@Grimler91
Copy link
Member Author

The rust error should have been fixed in rust-lang/rust#85806, so looks like our issue is that it fails to find libunwind.

We have it in .termux-build/_cache/android-r23-api-24-v0/lib64/clang/12.0.5/lib/linux/<arch>/libunwind.a, so looks like we perhaps need to either cp/symlink it to somewhere where rust finds it, or add a suitable linker flag to termux_setup_rust

@Grimler91 Grimler91 force-pushed the ndk-r23 branch 3 times, most recently from 4741206 to e6209af Compare August 20, 2021 12:35
@finagolfin finagolfin force-pushed the ndk-r23 branch 2 times, most recently from ff64e77 to 903b886 Compare August 21, 2021 17:54
@finagolfin
Copy link
Member

Rebased and cached NDK 23, so we're not downloading 3+ GB every time this pull is updated and run through the CI.

@finagolfin
Copy link
Member

finagolfin commented Aug 25, 2021

I have a CI that cross-compiles the Swift stdlib for Android, here are the changes that I had to make to cross-compile the Swift 5.4 stdlib for Android with NDK 23, finagolfin/swift-android-sdk#14 (the Swift compiler is easy, since it's written in C++ nothing should break):

/home/butta/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/stdlib.h:44:44: error: '__nomerge__' attribute cannot be applied to a declaration

What's really strange about this one is it's not reproducible with the upcoming Swift 5.5 branch or the development trunk branch of Swift. I patched that NDK header locally to remove that attribute for now, will dig into it more the issue appears to be that Swift 5.4 is built against a commit from libclang 10 that errors for that new attribute but later libclang versions don't.

I will update the Swift package separately once this pull is in.

@landfillbaby
Copy link
Member

that rebase just now reenabled bgrep since the issue is fixed in upstream gnulib and bgrep's bootstrap checks out the latest version

@Grimler91
Copy link
Member Author

Unfortunately rust 1.55 does not seem to seem to fix the build issue we have, so it needs more investigation

@tomty89
Copy link
Contributor

tomty89 commented Sep 17, 2021

Would it be possible for us to workaround the problem with a linker script named libgcc.a which is empty / does nothing?

Grimler91 and others added 4 commits October 22, 2021 22:45
Package still fails to build though:

FAILED: build/obj/source_bee/subprocess_posix.obj
aarch64-linux-android-clang -MMD -MT build/obj/source_bee/subprocess_posix.obj -MF build/obj/source_bee/subprocess_posix.obj.d -std=c++17 -O2 -Wall -Werror -fvisibility=hidden -I3rd/bee.lua/bee/nonstd -I3rd/bee.lua -DBEE_INLINE -DNDEBUG  -fstack-protector-strong -Oz -I/data/data/com.termux/files/usr/include -o build/obj/source_bee/subprocess_posix.obj -c 3rd/bee.lua/bee/subprocess/subprocess_posix.cpp
3rd/bee.lua/bee/subprocess/subprocess_posix.cpp:152:17: error: 'posix_spawnattr_init' is unavailable: introduced in Android 28
        int r = posix_spawnattr_init(&spawnattr_);
                ^
/data/data/com.termux/files/usr/include/spawn.h:56:5: note: 'posix_spawnattr_init' has been explicitly marked unavailable here
int posix_spawnattr_init(posix_spawnattr_t* __attr) __INTRODUCED_IN(28);
    ^
…so indicate that this library has been backported to API 24
As we have seen [1], i686 seem to explicitly need -fPIC.  Pass
CPPFLAGS in more places when building aapt, to avoid an error like:

ld: error: relocation R_386_PC32 cannot be used against symbol config_free; recompile with -fPIC
>>> defined in /tmp/config_utils-70060d.o
>>> referenced by config_utils.c
>>>               /tmp/config_utils-70060d.o:(config_free)

[1] #7215 (comment)
As part of ndk-r23 upgrade.
Seems we need to explicitly pass -fPIC for all arches.
Includes fix for -fno-integrated-as flag, which is needed by libx265
build.
@Grimler91
Copy link
Member Author

Roughly half of the packages touched in this PR has been uploaded now. The other half are still building (currently building node for all arches), or has build issues. I will merge this now, and then spend tomorrow fixing missing packages and issues.

I have also disabled syncing of my mirror for now, so that old package versions will be available until all of this is ironed out.

@Grimler91 Grimler91 merged commit 6a86fd8 into master Oct 22, 2021
@Grimler91 Grimler91 deleted the ndk-r23 branch October 22, 2021 21:06
@landfillbaby
Copy link
Member

landfillbaby commented Oct 22, 2021

is it ok if i push a couple of package updates now, or should i wait until after the mass rebuild is finished?
i'll just wait until tomorrow

@landfillbaby
Copy link
Member

landfillbaby commented Oct 22, 2021

We have a new warning about unused DT entry as well:

it's DT_AARCH64_BTI_PLT (0x70000001). in android 12 linker it's just ignored. aosp-mirror/platform_bionic@8d55d18

@landfillbaby
Copy link
Member

termux/termux-elf-cleaner@9c739ff
should this be released as 2.0 or 1.10? :)

@@ -10,16 +9,11 @@ diff -uNr ./usr.old/include/stdio.h ./usr/include/stdio.h
+
#include <bits/seek_constants.h>

-#if __ANDROID_API__ < __ANDROID_API_N__
#include <bits/struct_file.h>
-#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This header defines FILE, rather than keeping it an opaque struct, but we're not including this header anymore, following the NDK. This causes problems if some package tries to take sizeof(FILE), as I ran into with lldb:

/home/builder/.termux-build/libllvm/src/lldb/include/lldb/Utility/ReproducerInstrumentation.h:645:58: error: invalid application of 'sizeof' to an incomplete type '__sFILE'
m_stream.write(reinterpret_cast<const char *>(&t), sizeof(T));
                                                   ^~~~~~~~~

You can work around it by including <bits/struct_file.h> in any files that need FILE to be defined.

@finagolfin
Copy link
Member

finagolfin commented Oct 23, 2021

NDK 23 is a big jump to clang 12 from the clang 9 we were using in NDK 21. For arm, I hit an issue where it may have been omitting the frame pointer in optimized builds before, but isn't anymore. A file in libcompiler-rt started breaking as a result:

/home/builder/.termux-build/libllvm/src/compiler-rt/lib/builtins/clear_cache.c:87:20: error: write to reserved register 'R7'
  __asm __volatile("svc 0x0"
                   ^

This may be because of this clang commit, llvm/llvm-project@8eda716, though I think that new isAndroid() check for arm means it should stay the same? I worked around this issue by passing -fomit-frame-pointer to clang. This issue caused the error above because as the clang commit notes:

r7 is used sometimes for the frame pointer (for example, when targeting thumb (-mthumb)). See useR7AsFramePointer() in llvm/llvm-project/llvm/lib/Target/ARM/ARMSubtarget.h. This is mostly for legacy/compatibility reasons

You can check if the frame pointer is being omitted by passing -v to the failing clang command and checking if the internal clang-12 -cc1 command includes the -mframe-pointer=none flag. If it says -mframe-pointer=all instead, passing -fomit-frame-pointer may fix it.

@finagolfin
Copy link
Member

NDK 23 enabled C++ <atomic> in stdatomic.h, aosp-mirror/platform_bionic@76e2b15, when compiling C++, which can cause problems if it expected the C declarations instead:

/home/builder/.termux-build/_cache/android-r23b-api-24-v0/sysroot/usr/include/c++/v1/ratio:97:1: error: templates must have C++ linkage
template <intmax_t _Xp, intmax_t _Yp>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/builder/.termux-build/libdispatch/src/src/internal.h:323:1: note: extern "C" language linkage specification begins here
__BEGIN_DECLS
^
/home/builder/.termux-build/_cache/android-r23b-api-24-v0/sysroot/usr/include/sys/cdefs.h:46:23: note: expanded from macro '__BEGIN_DECLS'
#define __BEGIN_DECLS extern "C" {
                      ^

The problem here is a C++ file includes a header that includes stdatomic.h inside an extern "C" {} block, with the compiler now complaining that you're calling C++ template declarations with C linkage. I worked around this for libdispatch by replacing stdatomic.h with bits/stdatomic.h, which contains only the C declarations, c629022.

MarijnS95 added a commit to rust-mobile/ndk that referenced this pull request Nov 12, 2021
Rust still searches for libgcc even though [85806] replaces internal use
with libunwind, especially now that the Android NDK (since r23-beta3)
doesn't ship with any of gcc anymore.  The apparent solution is to build
your application with nightly and compile std locally (`-Zbuild-std`),
but that is not desired for the majority of users.  [7339] suggests to
provide a local `libgcc.a` as linker script, which simply redirects
linking to `libunwind` instead - and that has proven to work fine so
far.

Intead of shipping this file with the crate or writing it to an existing
link-search directory on the system, we write it to a new directory that
can be easily passed or removed to `rustc`, say in the event that a user
switches to an older NDK and builds without cleaning.  For this we need
to switch from `cargo build` to `cargo rustc`, but the existing
arguments and desired workflow remain identical.

[85806]: rust-lang/rust#85806
[7339]: termux/termux-packages#7339 (comment)
MarijnS95 added a commit to rust-mobile/ndk that referenced this pull request Nov 15, 2021
…189)

Rust still searches for libgcc even though [85806] replaces internal use
with libunwind, especially now that the Android NDK (since r23-beta3)
doesn't ship with any of gcc anymore.  The apparent solution is to build
your application with nightly and compile std locally (`-Zbuild-std`),
but that is not desired for the majority of users.  [7339] suggests to
provide a local `libgcc.a` as linker script, which simply redirects
linking to `libunwind` instead - and that has proven to work fine so
far.

Intead of shipping this file with the crate or writing it to an existing
link-search directory on the system, we write it to a new directory that
can be easily passed or removed to `rustc`, say in the event that a user
switches to an older NDK and builds without cleaning.  For this we need
to switch from `cargo build` to `cargo rustc`, but the existing
arguments and desired workflow remain identical.

[85806]: rust-lang/rust#85806
[7339]: termux/termux-packages#7339 (comment)
@finagolfin finagolfin removed the WIP Work in progress, do not close the issue (PR) label Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants