intel / hyperscan

High-performance regular expression matching library
https://www.hyperscan.io
Other
4.78k stars 710 forks source link

compile error with -lchimera #243

Open mtimebombm opened 4 years ago

mtimebombm commented 4 years ago

build and install with pcre-8.41,make install info: [root@825fdc02e7ed build]# make install [ 1%] Built target hs_exec_common [ 7%] Built target hs_exec_corei7 [ 13%] Built target hs_exec_core2 [ 19%] Built target hs_exec_avx2 [ 42%] Built target hs_compile [ 42%] Built target ragel_Parser [ 42%] Built target hs [ 66%] Built target hs_compile_shared [ 67%] Built target hs_exec_common_shared [ 73%] Built target hs_exec_shared_avx2 [ 79%] Built target hs_exec_shared_core2 [ 85%] Built target hs_exec_shared_corei7 [ 85%] Built target hs_runtime [ 85%] Built target hs_runtime_shared [ 85%] Built target hs_shared [ 86%] Built target corpusomatic [ 86%] Built target crosscompileutil [ 86%] Built target databaseutil [ 86%] Built target ragel_ExpressionParser [ 87%] Built target expressionutil [ 90%] Built target pcre [ 90%] Built target chimera [ 91%] Built target unit-chimera [ 94%] Built target unit-hyperscan [ 94%] Built target hscheck [ 94%] Built target ragel_ColliderCorporaParser [ 96%] Built target hscollider [ 98%] Built target hsbench [ 98%] Built target patbench [ 98%] Built target pcapscan [100%] Built target simplegrep Install the project... -- Install configuration: "RELWITHDEBINFO" -- Installing: /usr/local/lib64/pkgconfig/libhs.pc -- Up-to-date: /usr/local/include/hs/hs.h -- Up-to-date: /usr/local/include/hs/hs_common.h -- Up-to-date: /usr/local/include/hs/hs_compile.h -- Up-to-date: /usr/local/include/hs/hs_runtime.h -- Installing: /usr/local/lib64/libhs_runtime.a -- Installing: /usr/local/lib64/libhs_runtime.so.5.2.1 -- Installing: /usr/local/lib64/libhs_runtime.so.5 -- Installing: /usr/local/lib64/libhs_runtime.so -- Installing: /usr/local/lib64/libhs.a -- Installing: /usr/local/lib64/libhs.so.5.2.1 -- Installing: /usr/local/lib64/libhs.so.5 -- Installing: /usr/local/lib64/libhs.so -- Up-to-date: /usr/local/include/hs/ch.h -- Up-to-date: /usr/local/include/hs/ch_common.h -- Up-to-date: /usr/local/include/hs/ch_compile.h -- Up-to-date: /usr/local/include/hs/ch_runtime.h -- Installing: /usr/local/lib64/libchimera.a -- Installing: /usr/local/lib64/pkgconfig/libch.pc -- Up-to-date: /usr/local/share/doc/hyperscan/examples/simplegrep.c -- Up-to-date: /usr/local/share/doc/hyperscan/examples/pcapscan.cc -- Up-to-date: /usr/local/share/doc/hyperscan/examples/patbench.cc -- Up-to-date: /usr/local/share/doc/hyperscan/examples/README.md

but compile one code whith -lhs -lchimera -lstdc++ -lm [root@825fdc02e7ed ~]# gcc -g -O0 simplegrep_bychim.c -o simplegrep_bychim -I/usr/local/include/hs -lhs -lstdc++ -lchimera -lm /usr/local/lib64/libchimera.a(ch_compile.cpp.o): In function~PatternData': /home/yujie_ng_nbs_proj/modules/suricata/src/hyperscan-5.2.1/chimera/ch_compile.cpp:244: undefined reference to pcre_free' /home/yujie_ng_nbs_proj/modules/suricata/src/hyperscan-5.2.1/chimera/ch_compile.cpp:245: undefined reference topcre_free' /usr/local/lib64/libchimera.a(ch_compile.cpp.o): In function buildPcre': /home/yujie_ng_nbs_proj/modules/suricata/src/hyperscan-5.2.1/chimera/ch_compile.cpp:340: undefined reference topcre_compile' /home/yujie_ng_nbs_proj/modules/suricata/src/hyperscan-5.2.1/chimera/ch_compile.cpp:349: undefined reference to pcre_study' /home/yujie_ng_nbs_proj/modules/suricata/src/hyperscan-5.2.1/chimera/ch_compile.cpp:360: undefined reference topcre_fullinfo' /home/yujie_ng_nbs_proj/modules/suricata/src/hyperscan-5.2.1/chimera/ch_compile.cpp:367: undefined reference to pcre_fullinfo' /home/yujie_ng_nbs_proj/modules/suricata/src/hyperscan-5.2.1/chimera/ch_compile.cpp:372: undefined reference topcre_fullinfo' /home/yujie_ng_nbs_proj/modules/suricata/src/hyperscan-5.2.1/chimera/ch_compile.cpp:380: undefined reference to pcre_fullinfo' /usr/local/lib64/libchimera.a(ch_compile.cpp.o): In function~PatternData':`

compile success with: gcc -g -O0 simplegrep_bychim.c -o simplegrep_bychim -I/usr/local/include/hs ../hyperscan-5.2.1/build/lib/libchimera.a ../hyperscan-5.2.1/build/lib/libhs.a ../hyperscan-5.2.1/build/lib/libpcre.a -lm -lstdc++

why not use the -lhs and -lchimera to compile?

mhkndo commented 3 years ago

Hi @mtimebombm, @xiangwang1,

I've faced the same problem have you found any solution?

chimera build and install with pcre 8.41 is perfectly fine. But whenever I try to link my code with -lhs -lchimera -lstdc++ -lm I'm facing undefined reference errors.