Rate This Document
Findability
Accuracy
Completeness
Readability

Compiling Hyperscan

In the Hyperscan source code directory, add the Boost header file and PCRE dependency library, and compile the source code in static library, dynamic library, or debug mode.

  1. Go to the Hyperscan source code directory.
    cd hyperscan-v5.4.2.aarch64
  2. Add the Boost header file.
    ln -s {boost_path}/boost include/boost

    The compilation depends on the Boost header file. {boost_path} indicates the full path after boost_1_69_0.tar.gz is decompressed. It is recommended that boost_path be set to an absolute path.

  3. Add the PCRE dependency library.

    The compilation of the hscollider tool source code depends on the PCRE tool.

    1. Copy the pcre-8.43 folder to the Hyperscan source code directory and rename the folder as pcre.
      cp -rf ./pcre-8.43 hyperscan-v5.4.2.aarch64/pcre
    2. Open pcre/CMakeLists.txt.
      vim hyperscan-v5.4.2.aarch64/pcre/CMakeLists.txt
    3. Press i to enter the insert mode and comment out line 77 in the copied pcre/CMakeLists.txt file as follows:
      CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
      #CMAKE_POLICY(SET CMP0026 OLD)

      In the CMakeLists.txt file, the command in line 77 cannot be identified in CMake versions 2.8.1 and earlier and does not affect functions. The command needs to be commented out. You can also upgrade CMake to 3.0 or later to solve the problem that the CMAKE_POLICY command cannot be identified.

    4. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Compile the source code.
    1. Go to the Hyperscan source code directory.
      cd hyperscan-v5.4.2.aarch64
    2. Create a build directory.
      mkdir -p build
    3. Go to the build directory.
      cd build
    4. Perform the compilation.
      The compilation mode can be release (default) or debug, and the compilation results can be static (default) or dynamic libraries.
      • Compile static libraries from the source code. By default, static libraries are generated in release mode.
        cmake ..
        make -j32

        After the compilation, the following static libraries and test programs of Hyperscan are generated by default:

        Generated test programs:

        Generated static libraries:

      • Compile dynamic libraries from the source code. Add the -DBUILD_SHARED_LIBS=ON option to the compile command.
        cmake .. -DBUILD_SHARED_LIBS=ON

        Generated dynamic libraries:

      • Compile the source code in debug mode. Add the -DCMAKE_BUILD_TYPE=DEBUG option to the compile command.
        cmake .. -DCMAKE_BUILD_TYPE=DEBUG