The JIT compiler for the LKQL language.
- GraalVM : The high performance JVM (version 24.2.1)
- Maven : Java building tool
- Python3 : The language (3.9 or later)
- Langkit : The language front-end creation framework
- Libadalang and Liblkqllang and their Java bindings
First, you need to ensure that the mvn command is accessible and fairly recent (at least 3.8.5).
Then, make sure you have an accessible Python3 installation, version 3.9 or later.
Also make sure that your GraalVM installation is in the 24.2.1 version.
Finally, make sure that native-image tool is available in your environment.
$[langkit]> pip3 install -r requirement-pypi.txt
$[langkit]> ./manage.py make
$[langkit]> eval `./manage.py printenv`
$[langkit]> export PATH="/path/to/langkit/scripts:$PATH"If you get a Python error about the Langkit library, add the Langkit directory to your PYTHONPATH
environment variable.
Note: If for some reason you are not running ./manage.py printenv, make sure that the
sigsegv_handler library is reachable from your LD_LIBRARY_PATH.
Install the Java LangkitSupport library:
$[langkit]> mvn -f langkit/java_support install$[libadalang]> lkm make --enable-java
$[libadalang]> eval `lkm printenv`Make sure the Java bindings are installed locally
$[libadalang]> mvn -f build/java install$[langkit-query-language/lkql]> lkm make --enable-java
$[langkit-query-language/lkql]> eval `lkm printenv`As for Libadalang, make sure Java bindings are installed
$[langkit-query-language/lkql]> mvn -f build/java installJAVA_HOMEshould points to your local GraalVM installationGRAAL_HOMEshould also points to your GraalVM installation
$[langkit-query-language/lkql_jit]> mvn clean packageYou can now access LKQL JIT by running the langkit-query-language/lkql_jit/standalone/target/lkql.py
script.
This script will launch LKQL JIT with the current accessible Java installation (java -jar ...)
so you have to run it in a valid environment.
If you want to build LKQL JIT as a native executable, you can use the native Maven profile:
$[langkit-query-language/lkql_jit]> mvn clean package -P nativeThen the lkql executable will be available under the langkit-query-language/lkql_jit/standalone/target
directory.
LKQL JIT project uses prettier-java as code formatter, and the spotless Maven plugin is configured
to run it on demand. You can run the following command to format all Java sources:
$[langkit-query-language/lkql_jit]> mvn spotless:applyHowever, running it is very prone to error, thus you can install pre-commit hooks to perform this formatting operation on each commit:
$[langkit-query-language]> pre-commit installTo debug LKQL JIT native-image builds you can use the debug maven profile:
$[langkit-query-language/lkql_jit]> mvn clean package -P native,debugIf you need to debug or profile LKQL JIT native-image binaries there is the dev profile which
enable support for tools like valgrind, gdb or perf on the produced binaries.
$[langkit-query-language/lkql_jit]> mvn clean package -P native,devIf you don't need or want any of those, use the prod profile to disable all debugging and
profiling information.
$[langkit-query-language/lkql_jit]> mvn clean package -P native,prod