llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.34k stars 12.13k forks source link

Compiling on Termux, the 1st try failed, but the 2nd try succeeded. #62605

Open oilel opened 1 year ago

oilel commented 1 year ago

Termux is a terminal emulator for Android, when compiling clap_derive for the first time:

error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/bin:/data/data/com.termux/files/usr/bin" VSLANG="1033" "cc" "-Wl,--version-script=/data/data/com.termux/files/usr/tmp/rustcdaoA5e/list" "/data/data/com.termux/files/usr/tmp/rustcdaoA5e/symbols.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.0.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.1.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.10.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.11.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.12.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.13.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.14.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.15.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.2.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.3.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.4.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.5.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.6.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.7.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.8.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.clap_derive.4b790af5-cgu.9.rcgu.o" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.3peupj0dtauhco30.rcgu.rmeta" "/data/data/com.termux/files/home/pqt/target/debug/deps/clap_derive-73fb6ab0f6c09a8f.39ut04ivgmlysij6.rcgu.o" "-Wl,--as-needed" "-L" "/data/data/com.termux/files/home/pqt/target/debug/deps" "-L" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib" "-Wl,-Bstatic" "/data/data/com.termux/files/home/pqt/target/debug/deps/libheck-d1d72a006bc05876.rlib" "/data/data/com.termux/files/home/pqt/target/debug/deps/libsyn-6b186fda2b3417e9.rlib" "/data/data/com.termux/files/home/pqt/target/debug/deps/libquote-94a0f3462a4f994d.rlib" "/data/data/com.termux/files/home/pqt/target/debug/deps/libproc_macro2-cbf08b000a48cd3c.rlib" "/data/data/com.termux/files/home/pqt/target/debug/deps/libunicode_ident-3adb29540c4e0c11.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/libproc_macro-d0959266ea965ab0.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/libstd-6185eaa376222246.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/libpanic_unwind-0821caaf9ab9d9bf.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/libobject-94a4a0a6a14f2d4c.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/libmemchr-69138c55a92c87e3.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/libaddr2line-6c0b07a2fb4a6049.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/libgimli-0ef61a009dc222fd.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/librustc_demangle-b7760b494f4cf2a4.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/libstd_detect-d2d60207b70b9820.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/libhashbrown-8e1f7414b1c3d7b1.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/libminiz_oxide-6d3663ec9e1def55.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/libadler-4fabc8d167d934b4.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/librustc_std_workspace_alloc-b2566a564b794746.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/libunwind-83349ac0264113fa.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/libcfg_if-dd347d6f84de5529.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/liblibc-d40e0b26e07259ef.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/liballoc-0374e96f7402eb4a.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/librustc_std_workspace_core-c6902959a04934b9.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/libcore-a38f15711dcfb80f.rlib" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib/libcompiler_builtins-3b790efdbd7cfd32.rlib" "-Wl,-Bdynamic" "-ldl" "-llog" "-lunwind" "-ldl" "-lm" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/data/data/com.termux/files/usr/lib/rustlib/aarch64-linux-android/lib" "-o" "/data/data/com.termux/files/home/pqt/target/debug/deps/libclap_derive-73fb6ab0f6c09a8f.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: LLVM ERROR: SmallVector unable to grow. Requested capacity (4294967296) is larger than maximum value for size type (4294967295)

Then I tried to compile the same code again, the second time it successfully compiled the code.

finagolfin commented 1 year ago

This looks like a duplicate of #62165, could you add some info on what CPU you are running on and what clap_derive is, some rust package? If you're not sure what CPU you are using, this command will give us an idea, cat /proc/cpuinfo | grep Hardware.

oilel commented 1 year ago

cat /proc/cpuinfo | grep Hardware

Qualcomm Technologies, Inc SDM660

finagolfin commented 1 year ago

Thanks, I will file an Android NDK issue with this info.

@MaskRay, I think you can close this as a dupe of #62165, as the behavior appears identical.

finagolfin commented 1 year ago

@oilel, please run pkg update; pkg upgrade and see if you can reproduce now. I pushed a workaround disabling multi-threading in lld 16 in the Termux app, should fix your issue.