Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Latest commit

 

History

History
59 lines (40 loc) · 1.85 KB

BUILD_LLVM_FROM_SOURCE.md

File metadata and controls

59 lines (40 loc) · 1.85 KB

Build LLVM From Source

The WebAssembly backend is still experimental. Therefore, it is needed to build LLVM from source. Follow these instructions to build your own LLVM installation.

First, clone LLVM into a new directory:

git clone https://github.com/llvm-mirror/llvm.git
cd llvm

The next step is optional for end users (but needed if you want to develop on Speedy.js):

cd tools
git clone https://github.com/llvm-mirror/clang.git
cd ..

From here, all steps are mandatory for all users. Create a directory for the build and make it the current working directory

mkdir build && cd build

Run cmake to configure the build:

cmake -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_BUILD_TYPE=MinSizeRel -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DCLANG_INCLUDE_TESTS=OFF ..

It is strongly advised to change the installation directory by setting -DCMAKE_INSTALL_PREFIX=path. Otherwise LLVM is installed in the systems default location and might override your default Clang installation.

Finally, run make

cmake --build . --target install -- -j3

The -j3 defines how many processes are used to build LLVM. A good choice is to use the number of cores + 1.

LLVM is than either installed in the systems default path or the path you have specified. To check if the installation was successful run llvm-config

/path/to/installation/directory/llvm-config --version

e.g.

~/git/llvm/bin/llvm-config --version
5.0.0svn

Remarks

  • For further details consolidate the Building LLVM with CMAKE documentation.
  • It might be needed to periodically updated the LLVM installation with newer Speedy.js releases. To do so, run git pull in the LLVM (and Clang) directory and then run make (configuration should not be needed).