Skip to content

Building HAL

SJulianS edited this page Apr 23, 2021 · 30 revisions

If you plan to use HAL for your own research, we strongly recommend building it yourself instead of using our ppa. 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.

Ubuntu 18.04

We do currently not support building HAL on Ubuntu 18.04. We are working towards a solution and will update this guide as soon as possible.

Ubuntu 20.04

If you want to build HAL on Ubuntu 20.04, run the following commands:

  1. git clone https://github.com/emsec/hal.git && cd hal to clone the Git repository
  2. ./install_dependencies.sh to install all required dependencies
  3. mkdir build && cd build to create and move to the build folder
  4. cmake .. [OPTIONS] to run cmake
  5. make to compile HAL
  6. make install (optionally) to install HAL

macOS

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++

CMake Options

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 running ctest in 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.

Clone this wiki locally