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.
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.
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
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>
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.)
Figure 2. Download Microsoft Visual Studio Build Tools 2017.
First, download Hyperscan.
$ git clone https://github.com/intel/hyperscan.git/pre>
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:
Figure 4. Install Boost, PCRE, and SQLite to Hyperscan directory.
- 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/..
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).
Figure 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.
Figure 7: Confirm that the executables have been built.
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.
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.