2013-10-04 127 views
0

我使用的是運行Ubuntu的服務器12.04安裝升壓版本1.40

我想在其中安裝boost庫。我知道

sudo apt-get install libboost-all-dev 

將使工作完成,但它安裝了最新版本1.52或更高版本。

但我需要安裝特定的版本1.40,因爲在我用於學術目的的模擬器中存在問題。是什麼使特定的命令,這樣我可以提前

+0

最有可能你必須下載並建立自己的源 –

+0

可以DOWNLO廣告需要二進制文件 - http://sourceforge.net/projects/boost/files/boost-binaries/。但是你必須刪除當前版本。 – SChepurin

回答

0

快速回答:sudo apt-get install libboost-dev= 1.40.0.1

如果它不能正常工作,請繼續閱讀。

apt-get確實支持安裝包as long as it is in an archive that apt knows about的特定版本。來自apt-get手冊頁:

A specific version of a package can be selected for installation by following the 
package name with an equals and the version of the package to select. This will 
cause that version to be located and selected for install. Alternatively a specific  
distribution can be selected by following the package name with a slash and the version of 
the distribution or the Archive name (stable, frozen, unstable). 

例如,如果你想安裝阿帕奇2.20的Ubuntu,你會做這樣的事情:

sudo apt-get install apache2=2.2.20-1ubuntu1 

注意,你可能需要做一些依賴分辨率你自己在這種情況下,但如果有任何問題apt-get會告訴你什麼是他們造成的。對於例如(在11.04)

sudo apt-get install apache2=2.2.20-1ubuntu1 \ 
        apache2.2-common=2.2.20-1ubuntu1 \ 
        apache2.2-bin=2.2.20-1ubuntu1 \ 
        apache2-mpm-worker=2.2.20-1ubuntu1 

注:必須首先檢查是否建立1.40仍然可用。對於使用:

aptitude search libboost 

如果資質搜索命令不給你足夠的效果,嘗試sudo aptitude update然後再次運行aptitude search

您可能需要調查是否可以安裝早期Ubuntu版本的版本。即刪除當前包,下載並安裝它們。但是可能會依賴舊版本的標準庫。如果是這樣,您可以嘗試從launchpad下載源代碼。

作爲最後的手段,從下載boost.org並建立它 - 痛苦!

編輯:我看到你在ubuntu論壇上提出過同樣的問題,而且你的默認值是1.48。您可能必須自行構建庫。你可以試試這個apt-get

sudo apt-get install libboost1.40-all-dev=1.40.0-4ubuntu4 

如果這也不行,你必須建立並自行安裝。您可以從

下載源(1.40.0)下載源:libboost 1.40.0 source files

它的安裝後,運行以下命令來保存你安裝的版本,防止包管理器在將來自動更新它:

sudo echo "[packagename] hold" | sudo dpkg --set-selections 

來源:How to Downgrade Packages on Ubuntu

+0

aptitude search返回1.46,1.48的包。我怎樣才能安裝1.40 –

0

一般來說,你下載的來源與其他要求一起安裝Boost庫爲它就像連接文件

謝謝,構建它(部分不只是頭像Windows上的文件系統)。然後,您可以選擇要安裝的庫的哪個子集(您可以只使用您需要的緊湊版本)。然後通過調用bootstrap腳本,將其構建到另一個目錄中,並且您調用install。

這裏是一個很好的說明如何做到這一點:http://ubuntuforums.org/showthread.php?t=1180792

+0

是不是有命令來選擇類似於gcc的版本我們可以使用sudo apt-get install gcc-4.5 –

+0

可能是,請參閱user2339071響應。從源頭建設始終是可能的。 – omikron