并不是所有的万花筒示例都能编译。有些人这样做了。
在LLVM Cmake的构建过程中,会抱怨"-找不到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章中的示例无法编译。
发布于 2019-04-28 09:27:50
您还需要使用当前源代码(27-04-2019)将googletest作为共享库进行编译。当我在构建llvm、clang、lld和clang额外工具时遇到错误时,这并不是一个要求,这是非常令人沮丧的。
存放当前代码的最佳位置是:github.com/google/googletest
对于如何构建googletest,最好的答案是here
https://stackoverflow.com/questions/54619690
复制相似问题