“没有这样的文件或目录";试图在Android设备上执行linux二进制文件 [英] "No such file or directory" trying to execute linux binary on Android device
问题描述
我使用Android GCC工具链(普通linux,没有android或NDK)构建了本机linux ARM二进制文件.
I built a native linux ARM binary using the Android GCC toolchain (plain linux, no android or NDK).
我通过adb shell从PC连接到运行Android 4的平板电脑. 我"adb推送"了该二进制文件到该设备上的/system/bin中,希望我可以在那里执行它.我用chmod 777将其标记为可执行.
I connected, from my PC, via adb shell, to a tablet running Android 4. I "adb push"'ed that binary into /system/bin on that device, hoping I would get it to execute there. I marked it executable with chmod 777.
如果我尝试执行它,我会得到没有这样的文件或目录".
If I try to execute it, I would get "No such file or directory".
更多信息: 这个小程序使用fc和fm库.由于ARM工具链似乎没有crt1(在我发现的示例中通常包含启动代码),因此我们在android版本中搜索了包含它的文件,找到了crtbegin_dynamic和crtend_dynamic,但对于_static等效,是一对丢失了,所以我没有将-static传递给GCC.它是用"-nostdlib"构建的.
Further info: The little program uses fc and fm libs. Since the ARM toolchain does not appear to have crt1, which, from an example I found, normally contains the startup code, we searched through files containing it in the android build, found crtbegin_dynamic and crtend_dynamic, but for _static equivalent, one of the pair was missing, so I did not pass -static to GCC. It was built with "-nostdlib".
可能是什么问题?
推荐答案
如果您正在使用Ubuntu 64之类的64位平台,那么本技巧可以帮助您解决问题.只需尝试简单地使用安装的i386 32位兼容性库即可 apt-get:
If you are working on a 64-bit platform like Ubuntu 64, then this tip may help you solve the issue. Just try to get the i386 32-bit compatibility libraries installed simply with apt-get:
sudo apt-get install ia32-libs
对我来说效果很好.让我知道您是否遇到同样的麻烦.
It worked great for me. Let me know if you are stuck in same trouble.
对于Ubuntu 13.10或更高版本
正如aditya在对此答案的评论中所说:
As aditya said in the comments to this answer:
从Ubuntu 13.10开始,必须立即运行此命令:
sudo apt-get install lib32z1
,您可能还需要获取C ++ stdlib,如下所示:sudo apt-get install lib32ncurses5 lib32stdc++6
As of Ubuntu 13.10, one has to run this now:
sudo apt-get install lib32z1
, you may need to get the C++ stdlibs too, with this: sudo apt-get install lib32ncurses5 lib32stdc++6
这篇关于“没有这样的文件或目录";试图在Android设备上执行linux二进制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!