No such file or directory while executing existing binary

来源:互联网 发布:公共英语网络培训 编辑:程序博客网 时间:2024/05/29 13:50

最近在自动化构建toolchain的时候,在shell脚本中运行 binary 时,提示如下错误:

No such file or directory while executing existing binary

刚开始感觉很奇怪,在目录下能查看到对应的可执行文件,为什么就不能执行呢。而且用ldd $binary 的时候,显示this is not an executing binary 类似的语句,最后在archlinux上看到如下解释:

The file you'retrying to execute (/lmutil) exists but itsloader doesn't exist, where

the loader of a nativeexecutable is its dynamic loader, for example /lib/ld-linux.so.2;

the loader of a script is theprogram mentioned on its shebang line, e.g., /bin/sh if the script begins with#!/bin/sh

大概的意思就是,这个excuting binary是存在,但是执行这个binary的解释器没有找到,shell脚本对应的解释器就是/bin/sh, 而binary的话对应的加载器就是/lib64/ld-linux-x86_64.so.2。

最后查找到的原因也是如此,发现我在构建toolchain过程中在/lib64下没有找到加载器,默认的加载器安装在了$prefix/usr/lib64下,然而用readelf $binary | grep interpreter, 发现需要的加载器路径为/lib64/ld-linux-x86_64.so.2。这个问题怎么办呢?

最后的解决办法是在编译glibc过程中指定shared library dir, 采用如下方法可以解决:

echo "slibdri=/lib64" > configparms , 强行指定共享库路径,然后对应的共享库便会安装在slibdir下。


原创粉丝点击