hyperscan icon indicating copy to clipboard operation
hyperscan copied to clipboard

Build hscollider failed when using pcre

Open JackBoosY opened this issue 1 year ago • 0 comments

Hi guys,

I'm trying to fix hyperscan's dependency pcre in vcpkg (https://github.com/microsoft/vcpkg/pull/26028) but got some link issues:

4>GroundTruth.obj : error LNK2019: unresolved external symbol __imp_pcre_compile2@@24 referenced in function "public: class std::unique_ptr<class CompiledPcre,struct std::default_delete<class CompiledPcre> > __thiscall GroundTruth::compile(unsigned int,bool)" (?compile@GroundTruth@@QAE?AV?$unique_ptr@VCompiledPcre@@U?$default_delete@VCompiledPcre@@@std@@@std@@I_N@Z)
4>GroundTruth.obj : error LNK2019: unresolved external symbol __imp_pcre_exec@@32 referenced in function __catch$?addCallout@@YQXAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z$0
4>GroundTruth.obj : error LNK2019: unresolved external symbol __imp_pcre_fullinfo@@16 referenced in function "public: class std::unique_ptr<class CompiledPcre,struct std::default_delete<class CompiledPcre> > __thiscall GroundTruth::compile(unsigned int,bool)" (?compile@GroundTruth@@QAE?AV?$unique_ptr@VCompiledPcre@@U?$default_delete@VCompiledPcre@@@std@@@std@@I_N@Z)
4>GroundTruth.obj : error LNK2019: unresolved external symbol __imp_pcre_study@@12 referenced in function "public: class std::unique_ptr<class CompiledPcre,struct std::default_delete<class CompiledPcre> > __thiscall GroundTruth::compile(unsigned int,bool)" (?compile@GroundTruth@@QAE?AV?$unique_ptr@VCompiledPcre@@U?$default_delete@VCompiledPcre@@@std@@@std@@I_N@Z)
4>F:\vcpkg\buildtrees\hyperscan\x86-windows-dbg\bin\hscollider.exe : fatal error LNK1120: 4 unresolved externals

Then I checked the symbols in pcred.lib:

__imp__pcre_compile2
__imp__pcre_exec
__imp__pcre_fullinfo
__imp__pcre_study

And I checked the pcre build log, the fact is that pcred.lib was built as a C library, not a CPP library. But in pcre public header, there is no extern "C" there. And hscollider is built as a CPP library, which caused this issue.

I need to know that how to fix this issue?

Related info: OS: Windows 10 Compiler: Visual Studio 2017 hyperscan version: 5.4.0 pcre version: 8.45

Thanks.

JackBoosY avatar Jul 29 '22 06:07 JackBoosY