Get Started with Hyperscan on Windows*

ID 658280
Updated 9/21/2018
Version Latest
Public

author-image

By

Introduction

Hyperscan 5.0 provides complete support for Windows*. The Hyperscan library, along with its common utilities hsbench, hscheck, hscollider, and hsdump, can be compiled by the Intel® C++ Compiler or Microsoft Visual Studio* 2017 to run on Windows* 8 (64 bits/32 bits) and above. Using Microsoft Visual Studio* as an example, this tutorial walks you through the compilation details of Hyperscan on Windows.

For more information about Hyperscan, read Introduction to Hyperscan and visit Hyperscan.io.

Build Environment

Hyperscan uses the cross-platform tool CMake to compile, test, and package itself. CMake generates independent configuration files for building on all supported operating systems, for example, UNIX makefiles on Linux* and Microsoft Visual Studio Solution files on Windows. To do a build, Hyperscan uses:

  • The Ragel state machine compiler to generate the regular expression parser.
  • The Boost library to create the nondeterministic finite automaton (NFA) graph.
  • The Perl Compatible Regular Expressions (PCRE) library as a backup to provide complete grammar support for regular expressions.
  • SQLite to store the corpus.
  • Python* to record CMake build time.

Software Requirements

Here is the software you'll need, as of the date this article was published.

  • CMake - 2.8.11 or newer
  • Microsoft Visual Studio 2017 Build Tools
  • Python - 2.7
  • Ragel - 6.9
  • Boost - 1.57 or newer
  • PCRE - 8.41
  • SQLite - 3.0 or newer

Step-by-Step Instructions

Install Cygwin

Download Cygwin, and select make, gcc, and wget as additional installation components. Once the installation is complete, launch the Cygwin terminal, and now you are in the user's home directory.

Download and build Ragel

Type the following commands to download and compile Ragel.

$ wget  http://www.colm.net/files/ragel/ragel-6.10.tar.gz
$ tar xzvf ragel-6.10.tar.gz && rm ragel-6.10.tar.gz
$ cd ragel-6.10
$./configure
$ make
$ make install/pre>

Animated command prompt window
Figure 1. Install and compile Ragel.

Download build tools

  • Download CMake Windows Edition and Python.
  • Download Microsoft Visual Studio Build Tools 2017 (you may download the whole IDE, which comes with Build Tools; but if you only want to compile Hyperscan at the command line, downloading the Build Tools will be enough.)

screenshot of an Intel download page
Figure 2. Download Microsoft Visual Studio Build Tools 2017.

Prepare Hyperscan

First, download Hyperscan.

$ git clone https://github.com/intel/hyperscan.git/pre>

Command prompt window with command
Figure 3. Download Hyperscan.

Get dependent libraries

get the dependent libraries: Boost, PRCE, and SQLite.

$ cd hyperscan/pre>


   
   
   
   
   
   
   
  • Download Boost (version 1.57 and above), PCRE (version 8.41 and above), as well as SQLite-amalgamation zip.
  • Unzip downloaded files to the hyperscan folder
  • Rename the SQLite-amalgamation to SQLite3

    The final directory structure will look like this:
    Animated command prompt window
    Figure 4. Install Boost, PCRE, and SQLite to Hyperscan directory.

Generate configuration

  • Create a new folder named build, then execute CMake commands to generate the configuration.

    $ CMake -G "Visual Studio 15 2017 Win64" -D BOOST_ROOT=%cd%/../boost_1_66_0/..

    Command prompt window with command
    Figure 5. Use CMake commands to generate the configuration.

  • Execute CMake commands to build the solution file, or execute MSBuild.exe to build the project file (to use MsBuild.exe, you need to set up the environment variable “PATH” to make sure MSBuild.exe can be found by the system).

    Command prompt window with commandFigure 6: Build the solution file.

    $ export PATH=$PATH:"/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin/"
    $ MsBuild.exe ALL_BUILD.vcxproj /t:build
    	/pre>
    	
  • After compiling, the executables can be found in the bin directory.

    Command prompt window with command
    Figure 7: Confirm that the executables have been built.

Summary

You've successfully installed Hyperscan on Windows. You can use hsbench.exe to check and test your regex. For more information, read about hsbench.exe in the Tools section of the Hyperscan 5.0 Developer's Reference Guide.

Learn more about the new features in Hyperscan 5.0, including Chimera and pattern matching using logical combinations

Contact us on github if you have any questions or problems.

About the author

Lu Qi is an Intel Software Engineer and a Hyperscan developer.

References