Hyperscan 安装

源码下载

Ragel :http://www.colm.net/files/ragel/ragel-6.9.tar.gz

boost :http://downloads.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0.tar.gz

hyperscan : https://download.csdn.net/download/u014608280/12745509

 

第3方依赖库¶

依赖项 版本 说明
CMake >=2.8.11  
Ragel 6.9  
Python 2.7  
Boost >=1.57 仅需要头文件,无需编译
Pcap >=0.8 Optional: 仅用于示例程序
SQLite ? Optional: 用于编译hsbench
g++、gcc >v4.8.1  

 

 一、Ragel 安装

1、tar -xvf ragel-6.10.tar.gz
2、cd ragel-6.10
3、./configure 
4、 make -j
5、 make install 

二、boost

boost不需要编译安装 ,如果通过系统包管理工具(yum/apt-get)安装的 版本无法满足版本需要,

解压后执行类似 ln -s /home/boost_1_59_0/boost hyperscan-4.6.0/include/boost-patched 的命令创建符号链接,注意boost路径需要是绝对路径,否则可能找不到。或者使用下文描述的BOOST_ROOT选项.(个人尝试ln方法不行, BOOST_ROOT 方法可以

三、hyperscan 安装

在 hyperscan 源码的平级目录

1、mkdir hs_build
2、cd hs_build
3、cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=on -DDEBUG_OUTPUT=on -DBOOST_ROOT=/home/boost_1_59_0 ../hyperscan
4、make- j
5、make install
6、cmake –build .

其中  BOOST_ROOT 是指定boost路径,DDEBUG_OUTPUT 是hyperscan的调试信息 on是打开,会有很多信息输出。

参数 描述
CMAKE_C_COMPILER C compiler to use. Default is /usr/bin/cc.
CMAKE_CXX_COMPILER C++ compiler to use. Default is /usr/bin/c++.
CMAKE_INSTALL_PREFIX Install directory for install target
CMAKE_BUILD_TYPE Define which kind of build to generate. Valid options are Debug, Release, RelWithDebInfo, and MinSizeRel. Default is RelWithDebInfo.
BUILD_SHARED_LIBS Build Hyperscan as a shared library instead of the default static library.
BUILD_STATIC_AND_SHARED Build both static and shared Hyperscan libs. Default off.
BOOST_ROOT Location of Boost source tree.
DEBUG_OUTPUT Enable very verbose debug output. Default off.
FAT_RUNTIME Build the fat runtime. Default true on Linux, not available elsewhere.
OPTIMISE Turns off compiler optimizations(默认TRUE)

 

我的编译过程

Hyperscan 安装_第1张图片

如果遇到如下错误说明g++版本太低,需要升级Hyperscan 安装_第2张图片

查看g++动态库

Hyperscan 安装_第3张图片

升级参考这个文章https://blog.csdn.net/u014608280/article/details/80569328

编译example程序

gcc -o simplegrep simplegrep.c -lhs -lstdc++ -lm

对比结果

Hyperscan 安装_第4张图片

你可能感兴趣的:(linux)