Skip to content

Clone and Build

Davide Paro edited this page Dec 28, 2020 · 11 revisions

Building the compiler from scratch

Cloning the repo

git clone --recursive --depth 1 https://github.com/dparo/dpcc
cd dpcc

Getting the dependencies

The most notable dependencies for building the compiler are

  • Unix/Posix environment
  • GCC or CLANG compiler
  • CMake>=3.11 build system
  • Flex>=2.6
  • Bison>=3.6

Building on Linux

Your Linux distribution should provide CMake>=3.11. CMake 3.11 was released on November 2018. If you use a relatively updated Linux distribution there shouldn't be a problem.

On Linux, the build process automatically downloads, extracts and build Flex and Bison dependencies with the correct required version. Unfortunately Flex requires Bison to be installed in order to perform the bootstrapping. Thus Linux users should still install the associated system-wide dependencies.

Getting the dependencies on Debian/Ubuntu Based distros

  • Getting the dependencies

    sudo apt install gcc make cmake libtool flex bison 

Getting the dependencies on Fedora

sudo dnf install gcc make cmake libtool flex bison

Getting the dependencies on Arch Linux

sudo pacman -S gcc make cmake libtool flex bison

Building on Linux

mkdir -p build
cd build
cmake ../
cmake --build ./

Building on MacOS X

It's assumed that the user has a workinjg MacOs development environment with a C compiler installed. It is also assumet that Brew is setup correctly on the machine.

Getting the dependencies on MacOs X

brew install cmake flex bison

Building on MacOS

In order to build the dpcc compiler we need to use the latest version of Flex and Bison which are provided through brew.

In order to build the compiler type:

mkdir -p build
cd build
env PATH="/usr/local/opt/flex/bin:/usr/local/opt/bison/bin:$PATH" cmake ../
env PATH="/usr/local/opt/flex/bin:/usr/local/opt/bison/bin:$PATH" cmake --build ./
Clone this wiki locally