【发布时间】:2019-07-04 07:20:27
【问题描述】:
并非所有 Kaleidoscope 示例都能编译。有些会。
在 LLVM Cmake 的构建过程中报错“- Failed to find LLVM FileCheck”
我的兴趣是在 64 位 Ubuntu Bionic Beaver 笔记本电脑上使用 LLVM 开发玩具编译器。因此我需要从源代码编译 LLVM。文档说构建需要 Cmake、gcc/g++、clang 和 zlib。是的,这是真的。我发现这个列表是不完整的。
sudo apt update
sudo apt upgrade
sudo apt install -y cmake gcc g++ python build-essential opam ocaml
sudo apt install -y checkinstall python-pygments python-yaml llvm
opam init /* and say yes to creating a profile
opam config env
opam install ctypes ctypes-foreign
opam depext conf-llvm.6.0.0 /* and said Y to install
opam depext conf-m4.1 /* and said Y to install
opam depext conf-pkg-config.1.1 /* and said Y to install
sudo apt install libxml2-dev libplist-dev
sudo apt install llvm-7-tools
/*the z3 package is outdated, need to build from source:
mkdir z3 /*somewhere
git clone https://github.com/Z3Prover/z3
python scripts/mk_make.py
cd build
make
sudo checkinstall /* y and enter
cd <to sourceroot of llvm>
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
mkdir build; cd build
cmake -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_BUILD_TYPE=Release ../llvm
make -j2
第 3 章和第 8 章中的万花筒示例编译良好。来自第 8 章的玩具编译器的输出甚至可以编译并链接到工作程序。第 2、4、5、6、7 和 9 章中的示例无法编译。
【问题讨论】:
标签: llvm