<commit_before>---
title: "Build"
permalink: /docs/build/
excerpt: "How to build the PACO toolchain before running"
sidebar:
    nav: "getting-started"
---

{% include base_path %}

# Building the toolchain

## Elements that need to be build

The toolchain consints of five parts they need to be build. These parts are:

1. RISCV-Toolchain
2. Clang and LLVM
3. LUT-Compiler
4. Python Libaries
5. Rocket Libaries

## Building process

### Prerequisites

To install the toolchain make sure you have installed the following packages:
- libuuid for Clang and LLVM
- lua for the LUT Compiler

### Using the setup script

You can build the whole project by using the install script

```bash
$ cd paco-env
$ ./install.sh
```

### Manual setup

#### 1 RISCV-Toolchain

To build the RISCV-Toolchain just go to the source directory and run the build script. 
This will install the gcc compiler, binutils, and the riscv-tests into the directory riscv-
tools.

```bash
$ cd paco-env/riscv-tools-src
$ ./build.sh
```

#### 2 Clang and LLVM

Just run the following code. This will install the clang compiler and the llvm tools into the directory riscv-tools.

```bash
$ cd paco-env/riscv-tools-src/riscv-llvm
$ CC=gcc CXX=g++ ../configure --enable-targets=riscv --prefix=$RISCV
$ make -jN && make install
```
Attention: remember to replace N with the number of threads you want to spawn.

#### 3 LUT Compiler

To install the LUT compiler run this code, which will install the LUT compiler into the directory riscv-tools:

```bash
$ cd paco-env/riscv-tools-src/riscv-lut-compiler
$ make -jN && make install
```
Attention: remember to replace N with the number of threads you want to spawn.

#### 4 Python Libaries

This will install the python libs into the directory riscv-tools, if you run it:

```bash
$ cd paco-env/riscv-tools-src/py
$ make install
```

#### Rocket Libaries

This will install the RocketLib into the directory riscv-tools when you run it:

```bash
$ cd paco-env/rocket-soc/rocket_soc/lib<commit_msg>Update 013-build.md<commit_after>---
title: "Build"
permalink: /docs/build/
excerpt: "How to build the PACO toolchain before running"
sidebar:
    nav: "getting-started"
---

{% include base_path %}

# Building the toolchain

## Elements that need to be build

The toolchain consints of five parts they need to be build. These parts are:

1. RISCV-Toolchain
2. Clang and LLVM
3. LUT-Compiler
4. Python Libaries
5. Rocket Libaries

## Building process

### Prerequisites

To install the toolchain make sure you have installed the following packages:
- libuuid for Clang and LLVM
- lua for the LUT Compiler

### Using the setup script

You can build the whole project by using the install script

```bash
$ cd paco-env
$ ./install.sh
```

### Manual setup

#### 1 RISCV-Toolchain

To build the RISCV-Toolchain just go to the source directory and run the build script. 
This will install the gcc compiler, binutils, and the riscv-tests into the directory riscv-
tools.

```bash
$ cd paco-env/riscv-tools-src
$ ./build.sh
```

#### 2 Clang and LLVM

Just run the following code. This will install the clang compiler and the llvm tools into the directory riscv-tools.

```bash
$ cd paco-env/riscv-tools-src/riscv-llvm
$ CC=gcc CXX=g++ ../configure --enable-targets=riscv --prefix=$RISCV
$ make -jN && make install
```
Attention: remember to replace N with the number of threads you want to spawn.

#### 3 LUT Compiler

To install the LUT compiler run this code, which will install the LUT compiler into the directory riscv-tools:

```bash
$ cd paco-env/riscv-tools-src/riscv-lut-compiler
$ make -jN && make install
```
Attention: remember to replace N with the number of threads you want to spawn.

#### 4 Python Libaries

This will install the python libs into the directory riscv-tools, if you run it:
```bash
$ cd paco-env/riscv-tools-src/py
$ make install
```

#### Rocket Libaries

This will install the RocketLib into the directory riscv-tools when you run it:
```bash
$ cd paco-env/rocket-soc/rocket_soc/lib
{'fraction_non_alphanumeric': 0.09865470852017937, 'fraction_numerical': 0.00523168908819133, 'mean_word_length': 3.8490338164251208, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2711583', 'n_tokens_mistral': 1323, 'n_tokens_neox': 1274, 'n_words': 538}