Linux执行可执行文件提示No such file or directory的解决方法
最近在使用Linux操作系统执行一个可执行文件,结果出现了Nosuchfileordirectory的提示,表示很疑惑。
./tshrf bash:./tshref:Nosuchfileordirectory
查看文件信息,可以看到文件是存在的,并且是可以执行的。
-rwxr-xr-x1yuanyuan205814月292004tshref
查阅资料后,原因是系统位数与该可执行文件需要的lib库位数不匹配。
用uname命令打印系统信息,发现系统是64位系统
uname-a Linuxyuan-vm3.13.0-32-generic#57-UbuntuSMPTueJul1503:51:08UTC2014x86_64x86_64x86_64GNU/Linux
用file命令查看文件信息,发现是一个32位可执行文件。
file./tshref ./tshref:ELF32-bitLSBexecutable,Intel80386,version1(SYSV), dynamicallylinked(usessharedlibs),forGNU/Linux2.2.5,notstripped
要想在64位系统上与运行32位程序,则需要安装32位lib库。
对于Ubuntu用户可以使用下面的命令安装。
sudoapt-getinstallia32-libs Readingpackagelists...Done Buildingdependencytree Readingstateinformation...Done Packageia32-libsisnotavailable,butisreferredtobyanotherpackage. Thismaymeanthatthepackageismissing,hasbeenobsoleted,or isonlyavailablefromanothersource Howeverthefollowingpackagesreplaceit: lib32z1lib32ncurses5lib32bz2-1.0
过程中有可能找不到需要的库,但是会有几个替代包,选择安装其中一个。
sudoapt-getinstalllib32bz2-1.0 lib32bz2-1.0
然后就可以正常运行之前的可执行文件了。
遇到这种问题其实还有可能是其他原因,例如文本的编码格式问题等,本文仅提出了一种解决方法,读者遇到相同问题要具体问题具体分析。
到此这篇关于Linux执行可执行文件提示Nosuchfileordirectory的解决方法的文章就介绍到这了,更多相关LinuxNosuchfileordirectory内容请搜索毛票票以前的文章或继续浏览下面的相关文章希望大家以后多多支持毛票票!