最近在使用Linux操作系統(tǒng)執(zhí)行一個可執(zhí)行文件,結(jié)果出現(xiàn)了No such file or directory的提示,表示很疑惑。
./tshrf
bash: ./tshref: No such file or directory
查看文件信息,可以看到文件是存在的,并且是可以執(zhí)行的。
-rwxr-xr-x 1 yuan yuan 20581 4月 29 2004 tshref
查閱資料后,原因是系統(tǒng)位數(shù)與該可執(zhí)行文件需要的lib庫位數(shù)不匹配。
用uname命令打印系統(tǒng)信息,發(fā)現(xiàn)系統(tǒng)是64位系統(tǒng)
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
用file命令查看文件信息,發(fā)現(xiàn)是一個32位可執(zhí)行文件。
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
要想在64位系統(tǒng)上與運(yùn)行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
過程中有可能找不到需要的庫,但是會有幾個替代包,選擇安裝其中一個。
sudo apt-get install lib32bz2-1.0
lib32bz2-1.0
然后就可以正常運(yùn)行之前的可執(zhí)行文件了。
遇到這種問題其實(shí)還有可能是其他原因,例如文本的編碼格式問題等,本文僅提出了一種解決方法,讀者遇到相同問題要具體問題具體分析。
到此這篇關(guān)于Linux執(zhí)行可執(zhí)行文件提示No such file or directory的解決方法的文章就介紹到這了,更多相關(guān)Linux No such file or directory內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!