Compile environment

VMWare Ubuntu 16.04 compile LLDB 8

Compilation step

In my compilation environment, for example, the VIRTUAL machine has 2 gigabytes of RAM and needs enough Swap space. Otherwise, several compilations have this error:

clang: error: unable to execute command: Killed
clang: error: assembler command failed due to signal (use -v to see invocation)
Copy the code
  1. For details about how to add Swap space, see the blog

     sudo fallocate -l 6G /swapfile
     sudo chmod 600 /swapfile
     sudo mkswap /swapfile
     sudo swapon /swapfile
    Copy the code

    Automatically mount swap upon startup: Use vi or nano to add the following content to the bottom of the /etc/fstab file:

    /swapfile none swap sw 0 0
    Copy the code
  2. Secondly, with the compilation experience, compile LLVM and CLang related tools, with Debug information, at least 40 or 50 G of disk space left. For VMWare Ubuntu LVM expansion, see this blog post.

  3. Download the source code, here through Gitee speed download/LLVM

     git clone https://gitee.com/mirrors/LLVM.git
    Copy the code

    Will be better than the original warehouse github.com/llvm/llvm-p… A lot faster.

  4. Switch branch

    Git checkout llvmorg-8.0.1-b llvmorg-8.0.1Copy the code
  5. Install the required LLDB software

    Building — The LLDB Debugger (llvm.org)

     apt-get install -y libedit-dev swig
    Copy the code
  6. Also set up some soft links

    cd llvm/tools ln -s .. /.. /clang clang cd clang/tools/ ln -s .. /.. /clang-tools-extra extra cd .. /.. /.. / cd projects ln -s .. /.. /compiler-rt compiler-rt ln -s .. /.. /libcxx libcxx ln -s .. /.. /libcxxabi libcxxabi ln -s .. /.. /libunwind libunwind ln -s .. /.. /openmp openmpCopy the code
  7. Compile LLDB

    cd .. mkdir nj_build cd nj_build cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_PROJECTS="clang; lldb" -DLLVM_TARGETS_TO_BUILD="X86" .. ninja lldbCopy the code