LongDirtyAnimAlf / fpcupdeluxe

A GUI based installer for FPC and Lazarus
505 stars 94 forks source link

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

Closed han-k59 closed 4 months ago

han-k59 commented 5 months 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 4 months ago

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