Kode / Kha

Ultra-portable, high performance, open source multimedia framework.
http://kha.tech
zlib License
1.48k stars 171 forks source link

Troubles with pcre2 and HX_SMART_STRINGS #1461

Closed posxposy closed 9 months ago

posxposy commented 1 year ago

Describe the bug Hey! Looks like hxcpp smart strings are broken in Kha. Not sure what happened, but after updating Kha, the code like trace('живопліт') will not be compiled with an error on that line:

Error   C2440   '<function-style-cast>': cannot convert from 'initializer list' to 'String'

At the same time, a regular empty Haxe project will compile it just fine.

To Reproduce Just do trace('живопліт') at any place in empty Kha project.

Execution Environment:

Additional context Looks like hxcpp-smart-strings define is disabled in Kha projects. Just adding it to khafile.js will not help, it ignores it. But project.addCDefine('HX_SMART_STRINGS'); will do the trick and the error with string conversion will disappear.

But then I got a new error with pcre2 lib:

unresolved external symbol pcre2_match_16unresolved external symbol pcre2_match_data_free_16
unresolved external symbol pcre2_match_data_create_from_pattern_16
unresolved external symbol pcre2_compile_16
unresolved external symbol pcre2_code_free_16
unresolved external symbol pcre2_get_ovector_pointer_16
unresolved external symbol pcre2_pattern_info_16

I tried to change PCRE2_CODE_UNIT_WIDTH define from 8 to 16, but without luck. Also tried 0, as the documentation says: Use 0 for a multi-width application, but got even more weird C++ errors, and looks like 0 is the correct value, but it wants some additional setup for prce2 lib.

I'm not really a C++ guy, so not sure how to fix it myself, sorry.

RobDangerous commented 1 year ago

Yes, hxcpp has a weird setup where pcre gets compiled twice with different options, we have to replicate that to re-enable smart-strings.

RblSb commented 9 months ago

I'm still getting "Regexp compilation error : this version of PCRE2 does not have Unicode support in (Name|Description|Size|names)$", something else is needed? regextest.zip

RobDangerous commented 9 months ago

Different problem. Also fixed.