Ubuntu

如何為 12.04.4 LTS 獲取 libstdc++.so.5?

  • June 25, 2021

我嘗試執行一些軟體來監控舊的adaptec陣列控制器,並得到了這個:

error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory

所以我試圖搜尋但它沒有列出:

  $ sudo apt-cache search libstd*
   libstonith1 - Reusable cluster libraries -- libstonith1
   libstdc++6-4.6-dev - GNU Standard C++ Library v3 (development files)
   libstdc++6 - GNU Standard C++ Library v3
   perl - Larry Wall's Practical Extraction and Report Language
   libruby1.8 - Libraries necessary to run Ruby 1.8
   libstartup-notification0 - library for program launch feedback (shared library)

apt-get update 失敗,因為線上儲存庫不再適用於這個舊版本,即使我嘗試了其他地方推薦的 sed 技巧,

sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

接下來我從這裡下載了 DVD ISO並將其添加到一個乾淨的 /etc/apt/sources.list 中,但仍然不高興。

這是目前的 sources.list 文件:

# CD
deb file:/media/ubuntu-12.04.5-iso/ precise main  restricted

# DVD
#deb file:/media/ubuntu-12.04.5-dvd-iso/ precise main  restricted

$ sudo apt-get update
Get:1 file: precise Release.gpg [198 B]
Get:2 file: precise Release [4,595 B]
Ign file: precise/main TranslationIndex
Ign file: precise/restricted TranslationIndex
Ign file: precise/main Translation-en_AU
Ign file: precise/main Translation-en
Ign file: precise/restricted Translation-en_AU
Ign file: precise/restricted Translation-en
Reading package lists... Done

我嘗試了 DVD 和 CD ISO。

然後我嘗試從 http://old-releases.ubuntu.com/ubuntu/pool/main/g/gcc-3.3/libstdc++5_3.3.6-15ubuntu2_amd64.deb下載並安裝一個 .deb 文件

$ sudo gdebi libstdc++5_3.3.6-15ubuntu2_amd64.deb 
[sudo] password for zanotech: 
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Building data structures... Done 
Building data structures... Done 
This package is not able to be installed
Dependency is not satisfiable: gcc-3.3-base (>= 1:3.3.6-15ubuntu2)

果然這台伺服器正在執行 gcc-4.6-base。

作為比較,在 Centos 7 伺服器上,我通過以下方式解決了這個問題:

# yum -y install compat-libstdc++-33

我哪裡錯了?

有沒有辦法將舊的 libstdc++ 安裝到我執行該實用程序的目錄中?

這是高度推測性的,絕對不推薦,但如果共享對象文件真的是你想要的,為什麼不從舊的、過時的 Ubuntu 版本“手動”複製它(如果有必要,你剛剛創建的版本,比如說,一個虛擬盒子)?

引用自:https://unix.stackexchange.com/questions/655743