Step 1:
Download LLVM and Clang
Download LLVM and Clang
git clone http://llvm.org/git/llvm.git llvm
cd llvm/tools
git clone
http://llvm.org/git/clang.git clang
|
Step 2:
Configure and install LLVM and Clang
cd ../
mkdir build (for building
without polluting the source directory)
cd build
../configure
--enable-optimized --enable-assertions
--prefix=/home/user/llvm/install
make
make install
|
for more information about configure and install see. Getting Started with the LLVM System
Output:
Step 3:
Testing LLVM/Clang, compile small C++ program (test.cpp)
Testing LLVM/Clang, compile small C++ program
// test.cpp
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
cout << "Hello LLVM/Clang" << "\n";
return 0;
}
|
Step 4:
Run
Run
/home/user/llvm/install/bin/clang++
test.cpp -o hello
./hello
|
Output:
Hello LLVM/Clang
|
No comments:
Post a Comment