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

clang-18: cannot execute: required file not found #175

Open
61rd opened this issue Feb 15, 2025 · 4 comments
Open

clang-18: cannot execute: required file not found #175

61rd opened this issue Feb 15, 2025 · 4 comments

Comments

@61rd
Copy link

61rd commented Feb 15, 2025

../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18: cannot execute: required file not found

ldd ../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18
../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18: error while loading shared libraries: /usr/lib/libc.so: invalid ELF header

cat /usr/lib/libc.so
/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf64-littleaarch64)
GROUP ( /usr/lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /usr/lib/ld-linux-aarch64.so.1 ) )

uname -a
Linux localhost 5.15.149-android13-8-o-01121-g97042f284a84 #1 SMP PREEMPT Wed Jan 8 03:34:35 UTC 2025 aarch64 GNU/Linux

fastfetch
....
OS: Arch Linux ARM aarch64
Host: Qualcomm Technologies, Inc. Kalama MTP,salami
Kernel: Linux 5.15.149-android13-8-o-01121-g97042f284a84
Uptime: 1 day, 2 hours, 49 mins
Packages: 431 (pacman)
Shell: bash 5.2.37
Display (QCM0001): 1080x2412 @ 120 Hz in 7"
Display (QCM0001): 1080x2412 @ 120 Hz in 7"
Cursor: Adwaita
Terminal: apd
CPU: kalama (8) @ 3.19 GHz
GPU: Mesa llvmpipe (LLVM 19.1.7, 128 bits)
Memory: 7.67 GiB / 14.77 GiB (52%)
Swap: 2.04 GiB / 17.00 GiB (12%)
Disk (/tmp): 108.62 GiB / 217.81 GiB (50%) - f2fs
Local IP (wlan0): 192.168.31.187/24
Battery: 35% [Discharging]
Locale: C

@robertkirkman
Copy link

it says your OS is Arch Linux ARM GNU/Linux , this means that you must exit proot or chroot before trying to use termux-ndk , by typing the command exit and then trying again, because termux-ndk is not for GNU/Linux OS it is for Android OS and the primary difference is that the libc.so file of Android OS is different

@robertkirkman
Copy link

uname -o should print Android to use termux-ndk

@61rd
Copy link
Author

61rd commented Feb 15, 2025

I patched the clang-18, by :

patchelf --replace-needed libc.so /usr/lib/libc.so.6 ../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18

patchelf --replace-needed libm.so /usr/lib/libm.so.6 ../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18

patchelf --replace-needed libdl.so /usr/lib/libdl.so.2 ../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18

but it still lack something flag and show errors:

ldd ../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18
../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18: /usr/lib/libc.so.6: version `LIBC' not found (required by ../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18)
../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18: /usr/lib/libc.so.6: version `LIBC_O' not found (required by ../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18)
../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18: /usr/lib/libc.so.6: version `LIBC_P' not found (required by ../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18)
../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18: /usr/lib/libdl.so.2: version `LIBC' not found (required by ../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18)
../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18: /usr/lib/libm.so.6: version `LIBC' not found (required by ../android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18)
        linux-vdso.so.1 (0x00000077660b2000)
        /usr/lib/libc.so.6 (0x000000775e720000)
        /usr/lib/libdl.so.2 (0x000000775e6e0000)
        /usr/lib/libm.so.6 (0x000000775e620000)
        /system/bin/linker64 => /usr/lib/ld-linux-aarch64.so.1 (0x0000007766080000)

let me have a try to port the android bionic(libc),I dont know why ld-android.so => not found !!!!

ldd ./android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18
linux-vdso.so.1 (0x0000007039642000)
/usr/lib/android/libc.so (0x0000007031d30000)                                                   
/usr/lib/android/libdl.so (0x0000007031d00000)                                                  
/usr/lib/android/libm.so (0x0000007031ca0000)                                                   
/usr/lib/android/ld-android.so => not found                                                     
/usr/lib/android/ld-android.so => not found

@robertkirkman
Copy link

ld-android.so is not found because that file exists only on Android Operating System and not on GNU/Linux , but you have Arch Linux ARM which is GNU/Linux. it does not have ld-android.so.

Image

You should try to get to the default shell of clean installed Termux as pictured, which is Bash running unsandboxed on Android

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

No branches or pull requests

2 participants