-
Notifications
You must be signed in to change notification settings - Fork 89
Building HAL
HAL officially supports (and is tested for) Ubuntu 20.04 only, but you are free to add support for other platforms. We also offer experimental support for macOS.
If you want to build HAL on Ubuntu 20.04, run the following commands:
-
git clone https://github.com/emsec/hal.git && cd halto clone the Git repository -
./install_dependencies.shto install all required dependencies -
mkdir build && cd buildto create and move to the build folder -
cmake .. [OPTIONS]to run cmake -
maketo compile HAL
After completing step 5 successfully the binary will end up in build/bin/ and can be launched from there.
-
bin/hal -g(example) to launch HAL in GUI mode. More command line options can be found in ('Starting HAL').
Specifying options for cmake is optional and only required to build tests, documentation, or specific plugins that are disabled by default (see below). We do currently not support building on any other Linux distribution.
Warning: Building on macOS is experimental and may not always work.
Please make sure to use a compiler that supports OpenMP. You can install one using, e.g., Homebrew via: brew install llvm.
To let cmake know of the custom compiler use following command.
cmake .. -DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++
You can try using HAL directly on Windows using an Ubuntu 20.04 subsystem on WSL 2. After setting up WSL 2, follow the installation instructions for Ubuntu 20.04 provided above.
To work with the HAL GUI, you will need to set up an XServer. Install VcXsrv and run Xlaunch on your Windows machine. Now go to Ubuntu 20.04 and start HAL with GUI support using the command below. Note that the command assumes the DISPLAY to be at located at localhost:0. This will need adjustment on your machine.
export LIBGL_ALWAYS_INDIRECT=1; export DISPLAY=:0; hal -g
In case you encounter an error, try restarting the XServer and select One Large Window.
Using the CMake build system, your HAL build can be configured quite easily (by adding -D<OPTION>=1 to the cmake command).
Here is a selection of the most important options:
-
BUILD_TESTS: builds all available tests which can be executed by runningctestin the build directory. This also builds all tests of plugins that are built. -
BUILD_DOCUMENTATION: build the C++ and Python documentation -
PL_<plugin name>: enable (or disable) building a specific plugin -
BUILD_ALL_PLUGINS: all-in-one option to build all available plugins, overrides the options for individual plugins -
SANITIZE_ADDRESS,SANITIZE_MEMORY,SANITIZE_THREAD,SANITIZE_UNDEFINED: builds with the respective sanitizers (recommended only for debug builds)
If you do not specify CMAKE_BUILD_TYPE, it defaults to Release.