LLVM教程(二)-- LLVM的安裝

1 下載CMake版本

https://cmake.org/download/
這裏寫圖片描述
下載的CMake版本必須大於 Version 3.4.3。(注如果系統中已經有CMake了通過 cmake -version 查看一下版本號 大於就不用下載了)

<1> 解壓 tar xzvf cmake-3.8.0-rc1.tar.gz;進入到解壓目錄 依次執行 ./bootstrap
<2> make
<3> make install

2 下載SVN (如果有不用下載了 )

sudo apt-get install subversion

3 下載LLVM 項目

<1> cd where-you-want-llvm-to-live
<2> svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm

4 下載Clang項目

<1> cd where-you-want-llvm-to-live
<2> cd llvm/tools
<3> svn co http://llvm.org/svn/llvm-project/cfe/trunk clang

5 下載 Compiler-RT

<1> cd where-you-want-llvm-to-live
<2> cd llvm/projects
<3> svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt

6 下載測試部分代碼(可選 並且比較大)

<1> cd where-you-want-llvm-to-live
<2> cd llvm/projects
<3> svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite

7 創建build-llvm文件夾放這個文件夾下編譯

<1> cd where-you-want-llvm-to-live
<2> mkdir build-llvm
<3> cd build-llvm
<4> ../configure [options]Some common options:
–prefix=directory — 設置llvm編譯的安裝路徑(default/usr/local).
–enable-optimized — 是否選擇優化(defaultis NO),yes是指安裝一個Release版本.
–enable-assertions — 是否斷言檢查(default is YES).

8 執行cmake命令

在build-llvm目錄下執行 cmake ../

9 執行make命令

在build-llvm目錄下執行make

10 執行安裝命令

在build-llvm 目錄下執行 sudo make install

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章