歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux中源代碼軟件安裝

Linux中源代碼軟件安裝

日期:2017/2/28 15:31:38   编辑:Linux教程

我們常常在各種開源站點下載到源代碼程序,通常為*.tar.gz格式,這裡以一份用於Audio的開源代碼庫(libsndfile)的編譯安裝為例,說明源代碼的編譯安裝過程。

Step1:打開README文件,幾乎所有的開放源代碼中都含有該文件。別的不看,我們找到以下幾行,

If you really do need to compile from source it should be as easy as:

./configure

make

make install

Since libsndfile optionally links against libFLAC, libogg and libvorbis, you

will need to install appropriate versions of these libraries before running

configure as above.

上面的文字給出了安裝步驟。意思是說,我們得按照./configure、make、make install共3步完成安裝,而且./configure的執行依賴於libFLAC, libogg and libvorbis中的任何一個庫。

Step2:配置

運行./configure --prefix=/usr/libsndfile

功能是:完成庫依賴的檢查工作,並且在依賴沒問題的情況下生成makefile文件用具接下來的編譯。

我們可以先不管依賴的庫是否已經安裝,若編譯出現錯誤,則再安裝相應的庫。

選項--prefix=/usr/libsndfile作用,指定安裝路徑為/usr/libsndfile文件夾下,這樣利於軟件的卸載(直接刪除該文件夾就行了)和移植(拷貝該文件夾)。

Step3:編譯

運行make,主要根據上步中生成的makefile完成編譯功能。

Step4:安裝

運行make install,功能是按照Step2中--prefix配置的路徑進行安裝(實際上是文件拷貝)。

等待所有命令都運行結束,安裝完成,再到/usr/libsndfile目錄下查看是否有安裝文件。

Copyright © Linux教程網 All Rights Reserved