logdna / hyperscan Goto Github PK
View Code? Open in Web Editor NEWThis node module provides C bindings for Intel's Hyperscan library
License: BSD 3-Clause "New" or "Revised" License
This node module provides C bindings for Intel's Hyperscan library
License: BSD 3-Clause "New" or "Revised" License
While I was just starting to play with the Hyperscan for Node.JS, I noticed a strange behavior.
When I start to run the the following code (slightly changed from the original index.js
const addon = require('./build/Release/hyperscan');
module.exports.HyperscanDatabase = addon.HyperscanDatabase;
let db = new addon.HyperscanDatabase(['stuf.?'], [{
HS_FLAG_SOM_LEFTMOST: true
, singleMatch: true
}]);
console.log(db.scan('some stuff over here test anything goes here and stuf'));
I got the following output:
[ { patternId: 0, offsetStart: 0, offsetEnd: 9 },
{ patternId: 0, offsetStart: 0, offsetEnd: 10 },
{ patternId: 0, offsetStart: 0, offsetEnd: 53 } ]
However testing the same regex pattern on the same test string I got the following output as shown in the screenshot below:
Can anyone explain what's going on?
macOS High Sierra 10.13.6
ragel: stable 6.10 (bottled)
State machine compiler
https://www.colm.net/open-source/ragel/
/usr/local/Cellar/ragel/6.10 (12 files, 2.4MB) *
Poured from bottle on 2019-01-04 at 11:33:15
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ragel.rb
==> Analytics
install: 808 (30 days), 1,883 (90 days), 5,410 (365 days)
install_on_request: 779 (30 days), 1,794 (90 days), 4,891 (365 days)
build_error: 0 (30 days)
boost: stable 1.68.0 (bottled), HEAD
Collection of portable C++ source libraries
https://www.boost.org/
/usr/local/Cellar/boost/1.68.0 (13,712 files, 460.2MB) *
Poured from bottle on 2019-01-04 at 11:31:39
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/boost.rb
==> Dependencies
Optional: icu4c ✘
==> Options
--with-icu4c
Build regexp engine with icu support
--without-single
Disable building single-threading variant
--without-static
Disable building static library variant
--HEAD
Install HEAD version
==> Analytics
install: 41,684 (30 days), 164,314 (90 days), 636,052 (365 days)
install_on_request: 12,995 (30 days), 47,737 (90 days), 188,811 (365 days)
build_error: 0 (30 days)
cmake: stable 3.13.2 (bottled), HEAD
Cross-platform make
https://www.cmake.org/
/usr/local/Cellar/cmake/3.13.2 (5,542 files, 50.6MB) *
Poured from bottle on 2019-01-04 at 11:29:17
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/cmake.rb
==> Dependencies
Build: sphinx-doc ✘
==> Options
--HEAD
Install HEAD version
==> Caveats
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/cmake
==> Analytics
install: 118,211 (30 days), 396,636 (90 days), 1,549,081 (365 days)
install_on_request: 69,187 (30 days), 230,293 (90 days), 913,604 (365 days)
build_error: 0 (30 days)
> [email protected] install /Users/nishant/Desktop/blade-detection-service/node_modules/hyperscan
> mkdir ./vendor/build; cd ./vendor/build; cmake -G "Unix Makefiles" ../; cmake --build .; cd ../../; node-gyp rebuild;
-- The C compiler identification is AppleClang 10.0.0.10001044
-- The CXX compiler identification is AppleClang 10.0.0.10001044
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test ARCH_64_BIT
-- Performing Test ARCH_64_BIT - Success
-- Performing Test ARCH_32_BIT
-- Performing Test ARCH_32_BIT - Failed
-- Default build type 'Release with debug info'
-- Boost version: 1.68.0
-- Found PythonInterp: /usr/local/bin/python (found version "2.7.15")
-- Build date: 2019-01-04
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Looking for include file intrin.h
-- Looking for include file intrin.h - not found
-- Looking for C++ include intrin.h
-- Looking for C++ include intrin.h - not found
-- Looking for include file x86intrin.h
-- Looking for include file x86intrin.h - found
-- Looking for C++ include x86intrin.h
-- Looking for C++ include x86intrin.h - found
-- Looking for posix_memalign
-- Looking for posix_memalign - found
-- Looking for _aligned_malloc
-- Looking for _aligned_malloc - not found
-- Performing Test HAS_C_HIDDEN
-- Performing Test HAS_C_HIDDEN - Success
-- Performing Test HAS_CXX_HIDDEN
-- Performing Test HAS_CXX_HIDDEN - Success
-- Looking for _LIBCPP_VERSION
-- Looking for _LIBCPP_VERSION - found
-- Performing Test HAVE_SSSE3
-- Performing Test HAVE_SSSE3 - Success
-- Performing Test HAVE_AVX2
-- Performing Test HAVE_AVX2 - Success
-- Performing Test HAVE_AVX512
-- Performing Test HAVE_AVX512 - Failed
-- Building without AVX512 support
-- Performing Test HAVE_CC_BUILTIN_ASSUME_ALIGNED
-- Performing Test HAVE_CC_BUILTIN_ASSUME_ALIGNED - Success
-- Performing Test HAVE_CXX_BUILTIN_ASSUME_ALIGNED
-- Performing Test HAVE_CXX_BUILTIN_ASSUME_ALIGNED - Success
-- Performing Test HAVE__BUILTIN_CONSTANT_P
-- Performing Test HAVE__BUILTIN_CONSTANT_P - Success
-- Performing Test C_FLAG_Wvla
-- Performing Test C_FLAG_Wvla - Success
-- Performing Test C_FLAG_Wpointer_arith
-- Performing Test C_FLAG_Wpointer_arith - Success
-- Performing Test C_FLAG_Wstrict_prototypes
-- Performing Test C_FLAG_Wstrict_prototypes - Success
-- Performing Test C_FLAG_Wmissing_prototypes
-- Performing Test C_FLAG_Wmissing_prototypes - Success
-- Performing Test CXX_FLAG_Wvla
-- Performing Test CXX_FLAG_Wvla - Success
-- Performing Test CXX_FLAG_Wpointer_arith
-- Performing Test CXX_FLAG_Wpointer_arith - Success
-- Performing Test CC_SELF_ASSIGN
-- Performing Test CC_SELF_ASSIGN - Success
-- Performing Test CXX_SELF_ASSIGN
-- Performing Test CXX_SELF_ASSIGN - Success
-- Performing Test CC_PAREN_EQUALITY
-- Performing Test CC_PAREN_EQUALITY - Success
-- Performing Test CXX_UNUSED_CONST_VAR
-- Performing Test CXX_UNUSED_CONST_VAR - Success
-- Performing Test CXX_IGNORED_ATTR
-- Performing Test CXX_IGNORED_ATTR - Success
-- Performing Test CXX_WEAK_VTABLES
-- Performing Test CXX_WEAK_VTABLES - Success
-- Performing Test CXX_MISSING_DECLARATIONS
-- Performing Test CXX_MISSING_DECLARATIONS - Success
-- Performing Test CXX_UNUSED_LOCAL_TYPEDEFS
-- Performing Test CXX_UNUSED_LOCAL_TYPEDEFS - Success
-- Performing Test CXX_WUNUSED_VARIABLE
-- Performing Test CXX_WUNUSED_VARIABLE - Success
-- Building for current host CPU: -march=native -mtune=native
-- Looking for mmap
-- Looking for mmap - found
-- Doxygen not found, unable to generate API reference
-- Sphinx not found, unable to generate developer reference
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Checking for module 'sqlite3'
-- Found sqlite3, version 3.19.3
-- Performing Test SQLITE_VERSION_OK
-- Performing Test SQLITE_VERSION_OK - Success
-- Looking for sqlite3_open_v2
-- Looking for sqlite3_open_v2 - found
-- Looking for C++ include pthread_np.h
-- Looking for C++ include pthread_np.h - not found
-- Looking for pthread_setaffinity_np
-- Looking for pthread_setaffinity_np - not found
-- Looking for malloc_info
-- Looking for malloc_info - not found
-- Looking for shmget
-- Looking for shmget - found
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2")
-- Checking for module 'libpcre=8.41'
-- Requested 'libpcre = 8.41' but version of libpcre is 8.42
-- PCRE version 8.41 not found
-- PCRE 8.41 not found, not building hscollider
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/nishant/Desktop/blade-detection-service/node_modules/hyperscan/vendor/build
Scanning dependencies of target hs_exec
[ 0%] Building C object CMakeFiles/hs_exec.dir/src/crc32.c.o
[ 0%] Building C object CMakeFiles/hs_exec.dir/src/runtime.c.o
[ 1%] Building C object CMakeFiles/hs_exec.dir/src/stream_compress.c.o
[ 1%] Building C object CMakeFiles/hs_exec.dir/src/fdr/fdr.c.o
[ 1%] Building C object CMakeFiles/hs_exec.dir/src/fdr/teddy.c.o
[ 2%] Building C object CMakeFiles/hs_exec.dir/src/hwlm/hwlm.c.o
[ 2%] Building C object CMakeFiles/hs_exec.dir/src/hwlm/noodle_engine.c.o
[ 3%] Building C object CMakeFiles/hs_exec.dir/src/nfa/accel.c.o
[ 3%] Building C object CMakeFiles/hs_exec.dir/src/nfa/castle.c.o
[ 3%] Building C object CMakeFiles/hs_exec.dir/src/nfa/gough.c.o
[ 4%] Building C object CMakeFiles/hs_exec.dir/src/nfa/lbr.c.o
[ 4%] Building C object CMakeFiles/hs_exec.dir/src/nfa/limex_accel.c.o
[ 5%] Building C object CMakeFiles/hs_exec.dir/src/nfa/limex_native.c.o
[ 5%] Building C object CMakeFiles/hs_exec.dir/src/nfa/limex_64.c.o
[ 5%] Building C object CMakeFiles/hs_exec.dir/src/nfa/limex_simd128.c.o
[ 6%] Building C object CMakeFiles/hs_exec.dir/src/nfa/limex_simd256.c.o
[ 6%] Building C object CMakeFiles/hs_exec.dir/src/nfa/limex_simd384.c.o
[ 6%] Building C object CMakeFiles/hs_exec.dir/src/nfa/limex_simd512.c.o
[ 7%] Building C object CMakeFiles/hs_exec.dir/src/nfa/mcclellan.c.o
[ 7%] Building C object CMakeFiles/hs_exec.dir/src/nfa/mcsheng.c.o
[ 8%] Building C object CMakeFiles/hs_exec.dir/src/nfa/mcsheng_data.c.o
[ 8%] Building C object CMakeFiles/hs_exec.dir/src/nfa/mpv.c.o
[ 8%] Building C object CMakeFiles/hs_exec.dir/src/nfa/nfa_api_dispatch.c.o
[ 9%] Building C object CMakeFiles/hs_exec.dir/src/nfa/repeat.c.o
[ 9%] Building C object CMakeFiles/hs_exec.dir/src/nfa/sheng.c.o
[ 10%] Building C object CMakeFiles/hs_exec.dir/src/nfa/shufti.c.o
[ 10%] Building C object CMakeFiles/hs_exec.dir/src/nfa/tamarama.c.o
[ 10%] Building C object CMakeFiles/hs_exec.dir/src/nfa/truffle.c.o
[ 11%] Building C object CMakeFiles/hs_exec.dir/src/som/som_runtime.c.o
[ 11%] Building C object CMakeFiles/hs_exec.dir/src/som/som_stream.c.o
[ 11%] Building C object CMakeFiles/hs_exec.dir/src/rose/block.c.o
[ 12%] Building C object CMakeFiles/hs_exec.dir/src/rose/catchup.c.o
[ 12%] Building C object CMakeFiles/hs_exec.dir/src/rose/init.c.o
[ 13%] Building C object CMakeFiles/hs_exec.dir/src/rose/stream.c.o
[ 13%] Building C object CMakeFiles/hs_exec.dir/src/rose/match.c.o
[ 13%] Building C object CMakeFiles/hs_exec.dir/src/rose/program_runtime.c.o
[ 14%] Building C object CMakeFiles/hs_exec.dir/src/util/multibit.c.o
[ 14%] Building C object CMakeFiles/hs_exec.dir/src/util/simd_utils.c.o
[ 14%] Building C object CMakeFiles/hs_exec.dir/src/util/state_compress.c.o
[ 15%] Building C object CMakeFiles/hs_exec.dir/src/database.c.o
[ 15%] Building C object CMakeFiles/hs_exec.dir/src/alloc.c.o
[ 16%] Building C object CMakeFiles/hs_exec.dir/src/scratch.c.o
[ 16%] Building C object CMakeFiles/hs_exec.dir/src/util/cpuid_flags.c.o
[ 16%] Building C object CMakeFiles/hs_exec.dir/src/fdr/teddy_avx2.c.o
[ 17%] Building C object CMakeFiles/hs_exec.dir/src/util/masked_move.c.o
[ 17%] Built target hs_exec
Scanning dependencies of target hs_runtime
[ 17%] Building C object CMakeFiles/hs_runtime.dir/src/hs_version.c.o
[ 18%] Building C object CMakeFiles/hs_runtime.dir/src/hs_valid_platform.c.o
[ 18%] Linking C static library lib/libhs_runtime.a
[ 18%] Built target hs_runtime
[ 18%] Generating src/parser/control_verbs.cpp
[ 18%] Generating src/parser/Parser.cpp
Scanning dependencies of target hs_compile
[ 19%] Building CXX object CMakeFiles/hs_compile.dir/src/grey.cpp.o
[ 19%] Building CXX object CMakeFiles/hs_compile.dir/src/hs.cpp.o
[ 20%] Building CXX object CMakeFiles/hs_compile.dir/src/compiler/asserts.cpp.o
[ 20%] Building CXX object CMakeFiles/hs_compile.dir/src/compiler/compiler.cpp.o
[ 20%] Building CXX object CMakeFiles/hs_compile.dir/src/compiler/error.cpp.o
[ 21%] Building CXX object CMakeFiles/hs_compile.dir/src/fdr/engine_description.cpp.o
[ 21%] Building CXX object CMakeFiles/hs_compile.dir/src/fdr/fdr_compile.cpp.o
[ 21%] Building CXX object CMakeFiles/hs_compile.dir/src/fdr/fdr_compile_util.cpp.o
[ 22%] Building CXX object CMakeFiles/hs_compile.dir/src/fdr/fdr_confirm_compile.cpp.o
[ 22%] Building CXX object CMakeFiles/hs_compile.dir/src/fdr/fdr_engine_description.cpp.o
[ 23%] Building CXX object CMakeFiles/hs_compile.dir/src/fdr/flood_compile.cpp.o
[ 23%] Building CXX object CMakeFiles/hs_compile.dir/src/fdr/teddy_compile.cpp.o
[ 23%] Building CXX object CMakeFiles/hs_compile.dir/src/fdr/teddy_engine_description.cpp.o
[ 24%] Building CXX object CMakeFiles/hs_compile.dir/src/hwlm/hwlm_build.cpp.o
[ 24%] Building CXX object CMakeFiles/hs_compile.dir/src/hwlm/hwlm_literal.cpp.o
[ 25%] Building CXX object CMakeFiles/hs_compile.dir/src/hwlm/noodle_build.cpp.o
[ 25%] Building CXX object CMakeFiles/hs_compile.dir/src/nfa/accel_dfa_build_strat.cpp.o
[ 25%] Building CXX object CMakeFiles/hs_compile.dir/src/nfa/accelcompile.cpp.o
[ 26%] Building CXX object CMakeFiles/hs_compile.dir/src/nfa/castlecompile.cpp.o
[ 26%] Building CXX object CMakeFiles/hs_compile.dir/src/nfa/dfa_build_strat.cpp.o
[ 26%] Building CXX object CMakeFiles/hs_compile.dir/src/nfa/dfa_min.cpp.o
[ 27%] Building CXX object CMakeFiles/hs_compile.dir/src/nfa/goughcompile.cpp.o
[ 27%] Building CXX object CMakeFiles/hs_compile.dir/src/nfa/goughcompile_accel.cpp.o
[ 28%] Building CXX object CMakeFiles/hs_compile.dir/src/nfa/goughcompile_reg.cpp.o
[ 28%] Building CXX object CMakeFiles/hs_compile.dir/src/nfa/mcclellancompile.cpp.o
[ 28%] Building CXX object CMakeFiles/hs_compile.dir/src/nfa/mcclellancompile_util.cpp.o
[ 29%] Building CXX object CMakeFiles/hs_compile.dir/src/nfa/mcsheng_compile.cpp.o
[ 29%] Building CXX object CMakeFiles/hs_compile.dir/src/nfa/limex_compile.cpp.o
/Users/nishant/Desktop/blade-detection-service/node_modules/hyperscan/vendor/src/nfa/limex_compile.cpp:983:27: error: call to 'distance' is ambiguous
return verify_u32(distance(squash.begin(), it));
^~~~~~~~
/Library/Developer/CommandLineTools/usr/include/c++/v1/iterator:590:1: note: candidate function [with _InputIter = std::__1::__wrap_iter<boost::dynamic_bitset<unsigned long, std::__1::allocator<unsigned long> >
*>]
distance(_InputIter __first, _InputIter __last)
^
/usr/local/include/boost/iterator/distance.hpp:49:9: note: candidate function [with SinglePassIterator = std::__1::__wrap_iter<boost::dynamic_bitset<unsigned long, std::__1::allocator<unsigned long> > *>]
distance(SinglePassIterator first, SinglePassIterator last)
^
1 error generated.
make[2]: *** [CMakeFiles/hs_compile.dir/src/nfa/limex_compile.cpp.o] Error 1
make[1]: *** [CMakeFiles/hs_compile.dir/all] Error 2
make: *** [all] Error 2
CXX(target) Release/obj.target/hyperscan/src/binding.o
CXX(target) Release/obj.target/hyperscan/src/hyperscan_database.o
SOLINK_MODULE(target) Release/hyperscan.node
clang: error: no such file or directory: '../vendor/build/lib/libhs.a'
make: *** [Release/hyperscan.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
Can anyone please help me know what could be the issue?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.