Android Not Executable: 64-Bit Elf File

I'm trying to build a C binary for my Oneplus 3T (LogoInjector) which uses a snapdragon 821 so it's a arm64 device.

When I run:

android-ndk-r13b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-gcc -I android-ndk-r13b/platforms/android-24/arch-arm64/usr/include -c LogoInjector.v1.4.c lodepng

and copy the compiled binary to /system/bin on my phone I get this error:

sush: /system/bin/LogoInjector: not executable: 64-bit ELF file

I also tried the 32 bit toolchain but then it gives me:

sush: /system/bin/LogoInjector: not executable: 32-bit ELF file

I set the binary's permission to 755 just like all the others in /system/bin

Can anyone help me fix this?

Thanks!

2 Answers

The -c switch is instructing the compiler to perform the compilation only step, skipping the linkage stage, producing an object file and not executable. Invoke the

aarch64-linux-android-gcc -I android-ndk-r13b/platforms/android-24/arch-arm64/usr/include LogoInjector.v1.4.c -o lodepng

command instead. It is possible that you will need to specify some linker options (like libraries to link with) in addition to these parameters.

I met this issue when trying to run an application. Try to run command :"file nameapp". Here I get:

ELF executable, 32-bit LSB arm, dynamic (/system/bin/linker), not stripped.

But my board run command:"file system/bin/sh"

ELF shared object, 64-bit LSB x86-64, dynamic(/system/bin/linker64), for Android 27,BuildID=4a49062467e2958e78ce79839f483302, stripped.

It's different so cannot run. If you want to run it. Get the file with x86-64.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest