Home

Awesome

nBallerina

Translate Ballerina IR to LLVM IR.

Building from source in Ubuntu 20.04

Prerequisites

Build steps

  1. cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++-11 -DCMAKE_C_COMPILER=clang-11 -S . -B build/
  2. cmake --build ./build/ -- -j

This will build:

Usage

Run tests

  1. Install Java 11 runtime (e.g. openjdk-11-jre on ubuntu)

  2. Create JAVA_HOME environment variable and point it to the Java install dir

  3. Get this specific Ballerina version : 2.0.0-alpha8-20210419-135100-df7a4e3f.zip)

  4. Extract Ballerina pack and add the bin folder with the bal executable to your PATH system variable

  5. Run:

     cmake --build ./build/ -t check
    

To codegen the C header for the Rust runtime lib

  1. Install cbindgen

     cargo install cbindgen
    
  2. Execute build command

     cmake --build ./build/ -t runtime_header
    
  3. The generated header will be at : runtime/include/ballerina_rt.h

Check whether LTO is inlining runtime functions

  1. Execute command

     cmake --build ./build/ -t check_lto
    

Building from source in MacOSX 10.15.0

Prerequisites

Build steps

  1. cd build
  2. cmake ../ -DCMAKE_BUILD_TYPE=Release -DLLVM_DIR=/usr/local/opt/llvm/lib/cmake/llvm/ -DCMAKE_CXX_STANDARD=14
  3. make -j

This will build:

Run tests

  1. Install Java 11 runtime (e.g. JRE 11 package for MacOS)

  2. Create JAVA_HOME environment variable and point it to the Java install dir

  3. Get this specific Ballerina version : 2.0.0-alpha8-20210419-135100-df7a4e3f.zip)

  4. Extract Ballerina pack and add the bin folder with the bal executable to your PATH system variable

  5. Navigate to nBallerina build/ folder and run tests

     cd build/
     make check
    

Usage

To codegen the C header for the Rust runtime lib

  1. Install cbindgen

     cargo install cbindgen
    
  1. Execute build command

     cd build/
     make runtime_header
    
  2. The generated header will be at : runtime/include/ballerina_rt.h

Building from source in Windows 10(x64)

Prerequisites

Build steps

Clone the nballerina source and run below commands.

  1. cmake -DLLVM_DIR=<LLVM_INSTALL_PATH>\lib\cmake\llvm -S . -B .\build
  2. cmake --build .\build --config Release

Usage

Run tests

  1. Install cbindgen

     cargo install cbindgen
    
  2. Install lit

     pip3 Install lit filecheck
    
  3. Install java 11 and set up JAVA_HOME in your PATH system variable

  4. Get this specific Ballerina version : 2.0.0-alpha8-20210419-135100-df7a4e3f.zip)

  5. Extract Ballerina pack and add the bin folder with the ballerina executable to your PATH system variable

  6. Run tests

     msbuild test /p:configuration=Release
    

Setting up for Development (Ubuntu 20.04)

Debug Builds

By default debug build enables both sanitizers (via gcc or clang) and static analysis (via clang-tidy). To build a debug build use the following command template:

    cmake -DCMAKE_BUILD_TYPE=Release <options> -S . -B build/
    cmake --build ./build/

Valid options:

Additional notes: