October 23, 2024

Installing Hikari-LLVM15 version 18.1.8 and compiling LLVM

1. Clone the repository:

Run the following command in the terminal to clone the necessary version of Hikari-LLVM15:

git clone --branch llvm-18.1.8rel --recursive https://github.com/61bcdefg/Hikari-LLVM15.git
This command clones the repository with the specified branch and fetches all required submodules.

2. Update the system and install dependencies:

Update the package list and install the necessary tools for building:

sudo apt-get update  
sudo apt-get install build-essential cmake ninja-build python3
build-essential includes compilers and libraries for building packages, cmake manages the build process, ninja-build is a fast build system, and python3 is needed for configuration scripts.

3. Create a directory for the build:

Navigate to your user’s home directory and create a folder for building LLVM:

mkdir ~/llvm
This directory will be used to store the build files.

4. Navigate to the project directory:

Move to the directory where you cloned the Hikari-LLVM15 repository:

cd Hikari-LLVM15

5. Create a build directory:

Create a folder to store the build files, isolating them from the source code:

mkdir build

6. Enter the build directory:

Move to the newly created build directory:

cd build

7. Configure the build:

Run the CMake configuration command with Ninja, specifying which targets (architectures) to build:

cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" ../llvm

-G Ninja: specifies the use of the Ninja build system.
-DCMAKE_BUILD_TYPE=MinSizeRel: minimizes the size of the release build.
-DLLVM_ENABLE_PROJECTS="clang": includes Clang, needed for compiling and analyzing C/C++ code.
-DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64": targets architectures X86, ARM, and AArch64.

8. Start the build:

After successful configuration, run the following command to build all components:

ninja
ninja is a fast and efficient build system that will speed up the compilation process.