user265889
user265889

Reputation: 667

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!

Upvotes: 0

Views: 30300

Answers (2)

Thinh Dinh
Thinh Dinh

Reputation: 9

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.

Upvotes: -1

Eugene Sh.
Eugene Sh.

Reputation: 18299

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.

Upvotes: 2

Related Questions