请问如何才能用NDK编译Android程序顺利执行不出现not executable: magic 7F451错误
编译环境:32位android-ndk-r10e-windows-x86/android-ndk-r14b-windows-x86 + ctgwin + jdk1.8.0_131
使用ndk-build编译后,输出文件为poison,把程序push到虚拟机,chmod 0777执行,提示"not executable: magic 7F451"
IDA自带的android_server在虚拟机中可以执行,用readelf查看文件信息发现android_server和poison文件的Type类型一个是"EXEC (Executable file)"一个是"DYN (Shared object file)",不知道是否由于这个问题导致poison无法执行,如果是的话,请问该如何修改才能让程序可执行呢?
Application.mk文件:
APP_ABI := armeabi-v7a
#APP_ABI := armeabi
APP_PLATFORM = android-19
Android.mk文件:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := poison
LOCAL_SRC_FILES := poison.c
LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog
include $(BUILD_EXECUTABLE)
使用ndk-build编译后,输出文件为poison,把程序push到虚拟机,chmod 0777执行,提示"not executable: magic 7F451"
IDA自带的android_server在虚拟机中可以执行,用readelf查看文件信息发现android_server和poison文件的Type类型一个是"EXEC (Executable file)"一个是"DYN (Shared object file)",不知道是否由于这个问题导致poison无法执行,如果是的话,请问该如何修改才能让程序可执行呢?
android_server:
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0xd8b0
Start of program headers: 52 (bytes into file)
Start of section headers: 569984 (bytes into file)
Flags: 0x4000002, has entry point, Version4 EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 7
Size of section headers: 40 (bytes)
Number of section headers: 23
Section header string table index: 22
poison:
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: ARM
Version: 0x1
Entry point address: 0xb38
Start of program headers: 52 (bytes into file)
Start of section headers: 62048 (bytes into file)
Flags: 0x5000000, Version5 EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 8
Size of section headers: 40 (bytes)
Number of section headers: 34
Section header string table index: 33
cygwin信息:
$ gcc --version
gcc (GCC) 6.3.0
Copyright 2016 Free Software Foundation, Inc.
本程序是自由软件;请参看源代码的版权声明。本软件没有任何担保;
包括没有适销性和某一专用目的下的适用性担保。
$ g++ --version
g++ (GCC) 6.3.0
Copyright 2016 Free Software Foundation, Inc.
本程序是自由软件;请参看源代码的版权声明。本软件没有任何担保;
包括没有适销性和某一专用目的下的适用性担保。
$ make -version
GNU Make 4.2.1
为 i686-pc-cygwin 编译
Copyright (C) 1988-2016 Free Software Foundation, Inc.
许可证:GPLv3+:GNU 通用公共许可证第 3 版或更新版本<http://gnu.org/licenses/gpl. html>。
本软件是自由软件:您可以自由修改和重新发布它。
在法律允许的范围内没有其他保证。
$ gdb --version
GNU gdb (GDB) (Cygwin 7.11.1-2) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
...全文
相关推荐
windows下eclipse集成cygwin编译android_NDK
windows下eclipse集成cygwin编译android_NDK.doc
Android NDK 编译 TensorflowLite 的笔记
Android NDK 编译 TensorflowLite 的笔记 互联网上有很多关于 TensorflowLite 的 Android JNI 编译方法,但关于 TensorflowLite 本身的编译却不太好找。因此,我把自己的相关经验做一个总结分享。分享前先感谢一下小雨同学和谷歌 TensorflowLite 团队的一位朋友,他们为我提供了宝贵的经验和建议。 官网方法 Tensorflow ...
android NDK开发
android ndk 开发的流程 自己写的 搞了几天
Windows下Eclipse搭建Android_NDK开发环境
Windows下Eclipse搭建Android_NDK开发环境,开发过程中用到了JNI,必然要牵扯到NDK开发环境的搭建。也就是安装Cygwin的过程。相信按照文档你能够完成任务。因为搭建环境如果不认真的话,你可能还真的搭不成功哈~~~
Eclipse下安装Android开发环境NDK和CDT
Eclipse下安装Android开发环境NDK和CDT.doc


