Linux執行可執行檔提示No such file or directory的解決方案

來源:互聯網
上載者:User

標籤:linux   uname   file   ubuntu   

最近在使用Linux作業系統執行一個可執行檔,結果出現了No such file or directory的提示,表示很疑惑。

./tshrfbash: ./tshref: No such file or directory

查看檔案資訊,可以看到檔案是存在的,並且是可以執行的。

-rwxr-xr-x 1 yuan yuan 20581  4月 29  2004 tshref

查閱資料後,原因是系統位元與該可執行檔需要的lib庫位元不匹配。

用uname命令列印系統資訊,發現系統是64位系統

uname -aLinux 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命令查看檔案資訊,發現是一個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

要想在64位系統上與運行32位程式,則需要安裝32位lib庫。
對於Ubuntu使用者可以使用下面的命令安裝。

sudo apt-get install ia32-libsReading package lists... DoneBuilding dependency tree       Reading state information... DonePackage ia32-libs is not available, but is referred to by another package.This may mean that the package is missing, has been obsoleted, oris only available from another sourceHowever the following packages replace it:  lib32z1 lib32ncurses5 lib32bz2-1.0

過程中有可能找不到需要的庫,但是會有幾個替代包,選擇安裝其中一個。

sudo apt-get install lib32bz2-1.0lib32bz2-1.0

然後就可以正常運行之前的可執行檔了。

遇到這種問題其實還有可能是其他原因,例如文本的編碼格式問題等,本文僅提出了一種解決方案,讀者遇到相同問題要具體問題具體分析。

Linux執行可執行檔提示No such file or directory的解決方案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.