在 Android 上安装预构建的二进制文件:“未找到”
我正在尝试在自定义 Android 映像中安装预构建的二进制文件。 为此,我已将其复制到 prebuilt/android-arm/
中的一个新目录,其中包含与此类似的 Android.mk
文件:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := binary_name
LOCAL_MODULE := binary_name
LOCAL_MODULE_CLASS := EXECUTABLES
include $(BUILD_PREBUILT)
因此,如果我运行 make system_image binary_name
,将二进制文件复制到系统映像中的/bin/
中。 如果我运行模拟器,我可以在 /system/bin
中看到二进制文件。 权限与其他可执行文件 (-rwxr-xr-x
) 相同,并且根据 file
,这是一个 ARM 二进制文件 (ELF 32-bit LSB 可执行文件,ARM,版本 1 (SYSV),动态链接(使用共享库),已剥离
)。
但是当我在模拟器上运行它时,它说:
# binary_name
binary_name: not found
我已经对它进行了 strace,这就是我所看到的:
# strace binary_name
execve("/system/bin/binary_name", ["binary_name"], [/* 9 vars */]) = -1 ENOENT (No such file or directory)
write(2, "strace: exec", 12strace: exec) = 12
write(2, ": ", 2: ) = 2
write(2, "No such file or directory", 25No such file or directory) = 25
write(2, "\n", 1
) = 1
io_submit(1, -1344063348, {...} <unfinished ... exit status 1>
但是文件在那里,strace 能够找到它。
知道会发生什么吗?
更新:正如 Kristof 所说,这可能是动态链接的问题,但我没有适用于 Android ARM 的 ldd ...
I'm trying to install a prebuilt binary in a custom Android image. For that I have copied it to a new directory in prebuilt/android-arm/
with an Android.mk
file similar to this one:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := binary_name
LOCAL_MODULE := binary_name
LOCAL_MODULE_CLASS := EXECUTABLES
include $(BUILD_PREBUILT)
So if I run make system_image binary_name
, the binary file is copied to /bin/
in system image. And if I run the emulator I can see the binary file in /system/bin
. The permissions are the same as the other executables (-rwxr-xr-x
) and, according to file
, this is an ARM binary (ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped
).
But when I run it on the emulator, it says:
# binary_name
binary_name: not found
I have straced it and this is what I can see:
# strace binary_name
execve("/system/bin/binary_name", ["binary_name"], [/* 9 vars */]) = -1 ENOENT (No such file or directory)
write(2, "strace: exec", 12strace: exec) = 12
write(2, ": ", 2: ) = 2
write(2, "No such file or directory", 25No such file or directory) = 25
write(2, "\n", 1
) = 1
io_submit(1, -1344063348, {...} <unfinished ... exit status 1>
But the file is there, and strace is able to find it.
Any idea of what can be happening?
UPDATE: As Kristof says, this is probably a problem of dynamic linking, but I don't have ldd for Android ARM...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能有些需要的动态库找不到。
尝试 'ldd binary_name'
如果可以找到所有库,输出应该看起来有点像这样。
缺失的库应明确标记。
Perhaps some of the required dynamic libraries can't be found.
Try 'ldd binary_name'
The output should look a little like this if all libraries can be found.
Missing libraries should be clearly marked.