Ubuntu18.04可执行文件运行提示No such file or directory

参考原文见

https://blog.csdn.net/sun927/article/details/46593129?

 

最近我也遇到一个类似问题,同一个工具在Ubuntu16.04里面运行是好的,但是Ubuntu18.04运行就出错了。

我用file也看了是32bit的应用程序,但一直没想到Ubuntu18.04竟然默认去掉了32bit的library。

 

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

$ uname -a
Linux latitude-e5440 5.3.0-40-generic #32~18.04.1-Ubuntu SMP Mon Feb 3 14:05:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

 安装ia32-libs,提示找不到了,候选lib32ncurses5或lib32z1,我用了lib32z1.

 sudo apt-get install ia32-libs
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:
  lib32ncurses5 lib32z1

E: Package 'ia32-libs' has no installation candidate
$ sudo apt-get install lib32z1

 另外,如果用到32bit的libstdc++6,应该是安装

lib32stdc++6。

顺便看了一下查询用到的so,有两种办法

之一是ldd命令

ldd ./combine-image
	linux-gate.so.1 (0xf7f63000)
	libc.so.6 => /lib32/libc.so.6 (0xf7d71000)
	/lib/ld-linux.so.2 (0xf7f64000)

 之二是readelf -d

readelf -d  ./combine-image

Dynamic section at offset 0x7f20 contains 21 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000c (INIT)                       0x8048880

 调用的是32bit的libc.so。

之前有部分应用不能运行估计也是这个原因。

不知道这个方法是不是可以适合WSL

原文链接: https://www.cnblogs.com/shinedream/p/12367173.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    Ubuntu18.04可执行文件运行提示No such file or directory

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/193629

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月12日 下午6:26
下一篇 2023年2月12日 下午6:27

相关推荐