Android: 无法执行通过 Linux 编译的文件 在同一个 phone 上部署
Android: cannot execute file compiled through Linux Deploy on the same phone
root@hammerhead:/data/local # ./HelloWorld
tmp-mksh: ./HelloWorld: No such file or directory
您好!
我在 Linux Deploy 上使用 gcc 进行编译,据我所知,它会下载 Ubuntu 并 chroot 到环境中。该文件在此 chroot 环境中运行良好。
据我了解,当文件与机器的体系结构不匹配时会出现此错误。但是在同一台机器上是运行!有谁知道为什么会这样?
文件权限、所有权和上下文:
-rwxrwxrwx root root u:object_r:system_data_file:s0 HelloWorld
Id输出:
uid=0(root) gid=0(root) context=u:r:init:s0
使用/system/bin/sh
/system/bin/sh: ./Helloworld: No such file or directory
正在尝试执行一个不存在的文件:
/system/bin/sh: ./test: not found
您应该使用 gcc '-static' 密钥编译您的二进制文件。如果你不这样做,你的二进制文件将需要 Android 上不存在的动态链接器 ld.so(但肯定存在于你的 chroot 中!)。这意味着奇怪的错误消息 "No such file or directory".
root@hammerhead:/data/local # ./HelloWorld
tmp-mksh: ./HelloWorld: No such file or directory
您好!
我在 Linux Deploy 上使用 gcc 进行编译,据我所知,它会下载 Ubuntu 并 chroot 到环境中。该文件在此 chroot 环境中运行良好。
据我了解,当文件与机器的体系结构不匹配时会出现此错误。但是在同一台机器上是运行!有谁知道为什么会这样?
文件权限、所有权和上下文:
-rwxrwxrwx root root u:object_r:system_data_file:s0 HelloWorld
Id输出:
uid=0(root) gid=0(root) context=u:r:init:s0
使用/system/bin/sh
/system/bin/sh: ./Helloworld: No such file or directory
正在尝试执行一个不存在的文件:
/system/bin/sh: ./test: not found
您应该使用 gcc '-static' 密钥编译您的二进制文件。如果你不这样做,你的二进制文件将需要 Android 上不存在的动态链接器 ld.so(但肯定存在于你的 chroot 中!)。这意味着奇怪的错误消息 "No such file or directory".