如何编译LLVM工程

如何编译LLVM工程

llvm官网编译帮助:[link]https://llvm.org/docs/CMake.html
llvm编译说明位置:[link]https://github.com/llvm-mirror/llvm/blob/master/docs/GettingStarted.rst

下载源代码

// download llvm source code
git clone https://github.com/llvm-mirror/llvm.git
cd llvm/tools
// download clang source code
git clone https://github.com/llvm-mirror/clang.git
//download compiler-rt source code
git clone https://github.com/llvm-mirror/compiler-rt.git

编译LLVM工程

cd llvm
mkdir build; cd build
cmake ..
make -j 40				// 根据自己机器的配置
sudo make install 		// 有root权限的话可以安装

生成的的Clang和LLVM的可执行文件在build/bin目录下面

编译LLVM Demo程序

cd llvm/build
make Kaleidoscope

Kaleidoscope是LLVM官网的Demo程序,对于理解LLVM原理还是很有帮组的

猜你喜欢

转载自blog.csdn.net/weixin_31614117/article/details/87892364