/qbicc

Experimental static compiler for Java programs.

Primary LanguageJavaOtherNOASSERTION

qbicc

This is the README for qbicc. There’s not much here yet but be sure to read the overview.

Building

To build the project, execute mvn install in the root.

The first time you build qbicc, the tests will fail as the class library isn’t built yet. Use mvn install -DskipTests the first time to build so that the class library can be built.

Class Library

QBICC cannot run without qbicc-class-library.

After you have built qbicc, fetch and install the class libraries as follows:

git clone --recurse-submodules git@github.com:qbicc/qbicc-class-library.git
cd qbicc-class-library
mvn install

Rebuild qbicc

After building the class library, rebuild qbicc with the tests enabled using mvn clean install to get qbicc is ready for further development and use.

Running

To run the driver, first build the project and then use jbang to run it:

jbang --quiet org.qbicc:qbicc-main:1.0.0-SNAPSHOT --boot-module-path /path/to/main.jar:~/.m2/repository/org/qbicc/rt/qbicc-rt-java.base/11.0.1-SNAPSHOT/qbicc-rt-java.base-11.0.1-SNAPSHOT.jar:~/.m2/repository/org/qbicc/qbicc-runtime-unwind/1.0.0-SNAPSHOT/qbicc-runtime-unwind-1.0.0-SNAPSHOT.jar:~/.m2/repository/org/qbicc/qbicc-runtime-api/1.0.0-SNAPSHOT/qbicc-runtime-api-1.0.0-SNAPSHOT.jar:~/.m2/repository/org/qbicc/qbicc-runtime-gc-nogc/1.0.0-SNAPSHOT/qbicc-runtime-gc-nogc-1.0.0-SNAPSHOT.jar:~/.m2/repository/org/qbicc/qbicc-runtime-main/1.0.0-SNAPSHOT/qbicc-runtime-main-1.0.0-SNAPSHOT.jar --output-path /tmp/output hello/world/Main

Replace the java.base JAR with your locally-built JAR path from Class Library.

For a step-by-step example, see examples/helloworld/hello/world/Main.java

JBang cache

When plugins are added or removed, the jbang cache may become inconsistent and result in build errors. If that happens, add the --fresh option to the above command line. Eg: jbang --fresh …​ Alternatively, clear the entire cache using:

jbang cache clear

Requirements

Please ensure the follow are installed and available on your path:

  • LLVM 12

  • JDK 11

  • Maven 3.6.1+

MacOS

The libgcc_s.dylib is also required to be available and must be present (or symlinked) to /usr/local/lib/libgcc_s.dylib.

One way to get this library, if it’s not already on your system, is to brew install gcc and symlink the file.

For Catalina, it may already be present and the following symlink will resolve the compile failures

ln -s /usr/lib/libgcc_s.1.dylib /usr/local/lib/libgcc_s.dylib

For BigSur, the brew install gcc path is likely necessary and following symlink resolves the issue

ln -s /usr/local/Cellar/gcc/11.1.0/lib/gcc/11/libgcc_s.1.dylib /usr/local/lib/libgcc_s.dylib