LongDirtyAnimAlf / fpcupdeluxe

A GUI based installer for FPC and Lazarus
476 stars 88 forks source link

Cross compiling, incorrect Android interpreter defined in Android executable #697

Closed han-k59 closed 19 hours ago

han-k59 commented 2 weeks ago

Cross compiling from Linux to Android produces executables with an interpreter defined as libdl.so, They do not execute unless the interpreter is modified to /system/bin/linker64

This is what is reported in Linux after entering: file yourprogram: yourprogram: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter libdl.so, BuildID[sha1]=8eeee3c498f7728fe5428122b4acb179362e7bc3, stripped

The interpreter can be corrected using the patchelf program as follows:

patchelf --set-interpreter /system/bin/linker64 ./yourprogram

This results in:

yourprogram: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, BuildID[sha1]=2bf966cbb671b53c38504d838ff2d4c6b4979095, stripped

Only after this path the command-line program can be run correctly

Why does this happen and can this be corrected by a compiler setting or is there a problem with the compiler setup?

Han

LongDirtyAnimAlf commented 19 hours ago

Fixed. Next release. https://github.com/LongDirtyAnimAlf/fpcupdeluxe/commit/1fc01971705f2d9b7d57640c8b4a4a092608275a