gpt4 book ai didi

android - 运行编译文件问题 - eh_frame_hdr

转载 作者:行者123 更新时间:2023-11-29 00:36:24 26 4
gpt4 key购买 nike

我使用 android-ndk-r8b 编译了简单文件 main.cpp:

#include <stdio.h>
#include <stdlib.h>

int main(void) {
puts("!!!Hello World!!!");
return EXIT_SUCCESS;
}

我使用的命令如下:

.../android-ndk-r8b/ndk-build APP_ABI=x86

从main.cpp文件目录我的 Android.mk 文件:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CFLAGS += -fPIC
LOCAL_MODULE := main
LOCAL_SRC_FILES := main.cpp
include $(BUILD_EXECUTABLE)

然后我尝试在 debian x86 上打开这个文件,我得到了这个信息:

./main: No such file or directory

然后我使用命令:

ld main

并有信息:

ld: error in main(.eh_frame); no .eh_frame_hdr table will be created.
ld: warning: cannot find entry symbol _start; defaulting to 0000000008048320

是否可以在常见的 linux x86 发行版上运行通过 android-ndk 编译的文件?

最佳答案

不,Android 运行时库与桌面 Linux 不兼容。

请注意,您的 ndk-build 将 ma​​in 可执行文件放在 ./libs/x86/

关于android - 运行编译文件问题 - eh_frame_hdr,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12460743/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com