Linux可执行文件No such file or directory

最近在使用Linux操作系统执行一个可执行文件,结果出现了No such file or directory的提示,表示很疑惑。

./tshrf

bash: ./tshref: No such file or directory

  • 1
  • 2
  • 3

查看文件信息,可以看到文件是存在的,并且是可以执行的。

-rwxr-xr-x 1 yuan yuan 20581  429  2004 tshref
 
 
  • 1

查阅资料后,原因是系统位数与该可执行文件需要的lib库位数不匹配。

用uname命令打印系统信息,发现系统是64位系统

uname -a

Linux yuan-vm 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

  • 1
  • 2
  • 3

用file命令查看文件信息,发现是一个32位可执行文件。

file ./tshref

./tshref: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped

  • 1
  • 2
  • 3
  • 4

要想在64位系统上与运行32位程序,则需要安装32位lib库。
对于Ubuntu用户可以使用下面的命令安装。

sudo apt-get install ia32-libs

Reading package lists… Done
Building dependency tree
Reading state information… Done
Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
lib32z1 lib32ncurses5 lib32bz2-1.0

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

过程中有可能找不到需要的库,但是会有几个替代包,选择安装其中一个。

sudo apt-get install lib32bz2-1.0

lib32bz2-1.0

  • 1
  • 2
  • 3

然后就可以正常运行之前的可执行文件了。

遇到这种问题其实还有可能是其他原因,例如文本的编码格式问题等,本文仅提出了一种解决方法,读者遇到相同问题要具体问题具体分析。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

306Safe

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值