Android 可执行文件有错误的解释器?
Android executable with wrong interpreter?
我已经转移到新的笔记本电脑和最新的 android NDK,将二进制文件重新编译到我的 android 应用程序中并在 运行 时出现 "executable not found" 异常。我已经检查过该文件存在并且在预期的路径上。
然后我分析了文件并得到以下信息:
$file ./build_pie/my_file
./build_pie/my_file: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /usr/lib/libc.so.1, not stripped
然后我检查了以前版本的可执行文件,它是:
$file /tmp/f4_old/my_file
/tmp/f4_old/my_file: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /system/bin/linker, not stripped
我相信错误的翻译是原因。我该如何解决?
PS.
以下是配置中的一些行:
... // override PATH and SYSROOT to android NDK (standalone toolchain)
export CFLAGS="-I$SRC/libftdi1.0-2-android-arm-lollipop/include -I$SRC/libusb1.0-2-android-arm-lollipop/include -fPIE"
export CPPLAGS="$CPPFLAGS -fPIE"
export CXXLAGS="$CXXFLAGS -fPIE"
export LDFLAGS="$LDFLAGS -lusb-1.0 -lusb -lftdi -L$SRC/libftdi1.0-2-android-arm-lollipop/lib -L$SRC/libusb1.0-2-android-arm-lollipop/lib -L$SRC/libusb-android-arm-lollipop/lib -static -fPIE -pie"
../configure --build=x86-unknown-linux-gnu --host=arm-linux-androideabi --target=arm-linux-androideabi --verbose
我必须使用 -Wl,--dynamic-linker=/system/bin/linker
指定动态链接器(添加到 LDFLAGS
)
根据您的回答,您已经完成了自己组装交叉编译器以与 autoconf 一起使用的所有工作。您应该看看 standalone toolchains,NDK 提供的工具可以帮助您避免此类错误。
我已经转移到新的笔记本电脑和最新的 android NDK,将二进制文件重新编译到我的 android 应用程序中并在 运行 时出现 "executable not found" 异常。我已经检查过该文件存在并且在预期的路径上。
然后我分析了文件并得到以下信息:
$file ./build_pie/my_file
./build_pie/my_file: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /usr/lib/libc.so.1, not stripped
然后我检查了以前版本的可执行文件,它是:
$file /tmp/f4_old/my_file
/tmp/f4_old/my_file: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /system/bin/linker, not stripped
我相信错误的翻译是原因。我该如何解决?
PS.
以下是配置中的一些行:
... // override PATH and SYSROOT to android NDK (standalone toolchain)
export CFLAGS="-I$SRC/libftdi1.0-2-android-arm-lollipop/include -I$SRC/libusb1.0-2-android-arm-lollipop/include -fPIE"
export CPPLAGS="$CPPFLAGS -fPIE"
export CXXLAGS="$CXXFLAGS -fPIE"
export LDFLAGS="$LDFLAGS -lusb-1.0 -lusb -lftdi -L$SRC/libftdi1.0-2-android-arm-lollipop/lib -L$SRC/libusb1.0-2-android-arm-lollipop/lib -L$SRC/libusb-android-arm-lollipop/lib -static -fPIE -pie"
../configure --build=x86-unknown-linux-gnu --host=arm-linux-androideabi --target=arm-linux-androideabi --verbose
我必须使用 -Wl,--dynamic-linker=/system/bin/linker
指定动态链接器(添加到 LDFLAGS
)
根据您的回答,您已经完成了自己组装交叉编译器以与 autoconf 一起使用的所有工作。您应该看看 standalone toolchains,NDK 提供的工具可以帮助您避免此类错误。