【问题标题】:What are the steps to build LLVM from source for Ubuntu Bionic Beaver?从源代码为 Ubuntu Bionic Beaver 构建 LLVM 的步骤是什么?
【发布时间】: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


    【解决方案1】:

    您还需要 googletest 作为具有当前源代码的共享库 (27-04-2019) 才能编译。当我在构建 llvm、clang、lld 和 clang 额外工具时遇到错误时,它没有被声明为一项非常令人沮丧的要求。

    当前代码的最佳位置是:github.com/google/googletest

    关于如何构建 googletest 的最佳答案是here

    【讨论】:

      猜你喜欢
      • 2017-12-15
      • 2017-12-02
      • 2020-07-22
      • 2015-10-14
      • 1970-01-01
      • 2010-12-31
      • 2020-10-30
      • 2011-12-11
      • 1970-01-01
      相关资源
      最近更新 更多