hyperscan 安裝

2019-01-17 11:38 更新

1. 前言

   本文在 Debian8 中安裝 hyperscan 5.0.0

   內(nèi)存至少 2 G,不然編譯慢而且失敗

2. 依賴

2.1 C/C++編譯器

hyperscan使用C++開發(fā),且需要C99和C++11支持,目前支持的編譯器有

  • GCC, v4.8.1 or higher
  • Clang, v3.4 or higher (with libstdc++ or libc++)
  • Intel C++ Compiler v15 or higher

2.2 第三方依賴庫

    依賴項       版本         說明
    -------------------------------------------------
    CMake       >=2.8.11     
    Ragel       6.9  
    Python      2.7  
    Boost       >=1.57      僅需要頭文件,無需編譯
    Pcap        >=0.8       Optional: 僅用于示例程序

注1: Ragel 最好用 6.9 版本,7.0 版本可能會報錯

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

注2:boost不需要編譯安裝,如果通過系統(tǒng)包管理工具(yum/apt-get)安裝的版本無法滿足版本需要,只需要解壓源碼包

wget -c https://sourceforge.net/projects/boost/files/boost/1.68.0/boost_1_68_0.tar.gz/download

注3:pcap庫會依賴flex和bison

3. 編譯 hyperscan

ln -s /soft/boost_1_68_0/boost /soft/hyperscan-5.0.0/include/boost
cd /soft/hyperscan-5.0.0
mkdir build
cd build
cmake ../
cmake --build .  (別忘了最后有個點,編譯時間較長)     
make install

hyperscan 還通過 cmake 支持一些編譯選項,如 debug/release, static/shared 等,如
  • -DCMAKE_BUILD_TYPE=Release 編譯為Release版本,不帶調(diào)試信息,默認是RelWithDebInfo
  • -DBUILD_SHARED_LIBS=on 編譯為動態(tài)庫,默認是靜態(tài)庫
等。

4. BUG

安裝過程中,提示如下錯誤:

hyperscan-5.0.0/src/nfa/limex_compile.cpp:983:54: error: call of overloaded ‘distance(std::vector<boost::dynamic_bitset<> >::iterator, __gnu_cxx::__normal_iterator<boost::dynamic_bitset<>, std::vector<boost::dynamic_bitset<> > >&)’ is ambiguous
return verify_u32(distance(squash.begin(), it));
^

可在 github 的 issues 中找到解決方案 https://github.com/intel/hyperscan/issues/104

作者給出的解釋和解決方案如下:


只需將這兩行的,distance 改為 std::distance 即可


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號