Ruby bindings to RE2, a "fast, safe, thread-friendly alternative to backtracking regular expression engines like those used in PCRE, Perl, and Python".
linking shared-object re2.so
/usr/bin/x86_64-w64-mingw32-ld: /tmp/re2/ports/x86_64-w64-mingw32/abseil/20230125.3/lib/libabsl_time_zone.a(time_zone_libc.cc.obj):time_zone_libc.cc:(.text+0x97): undefined reference to `__imp___timezone'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/re2/ports/x86_64-w64-mingw32/abseil/20230125.3/lib/libabsl_time_zone.a(time_zone_libc.cc.obj):time_zone_libc.cc:(.text+0xa8): undefined reference to `__imp___dstbias'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/re2/ports/x86_64-w64-mingw32/abseil/20230125.3/lib/libabsl_time_zone.a(time_zone_libc.cc.obj):time_zone_libc.cc:(.text+0xde): undefined reference to `__imp___tzname'
collect2: error: ld returned 1 exit status
make: *** [Makefile:262: re2.so] Error 1
The timezone, dstbias, and tzname symbols come from the Microsoft Runtime library.
This happened because the abseil C++ library would be installed for x64-mingw-ucrt and x64-mingw32 in the same directory based on the host value (x86_64-w64-mingw32). As a result, if x64-mingw-ucrt were built first, then the abseil libraries will link against the Universal C Runtime (UCRT). When rake gem:x64-mingw32 is attempted after rake gem:x64-mingw-ucrt, then it will fail to link those symbols because the abseil library in ports/x86_64-w64-mingw32 directory expects UCRT to be used.
To avoid this mess, append the RbConfig::CONFIG['arch'] to the mini_portile recipe to ensure x64-mingw-ucrt and x64-mingw32 builds use different library paths.
Previously if you ran:
The latter would fail with undefined symbols:
The
timezone
,dstbias
, andtzname
symbols come from the Microsoft Runtime library.This happened because the abseil C++ library would be installed for
x64-mingw-ucrt
andx64-mingw32
in the same directory based on thehost
value (x86_64-w64-mingw32
). As a result, ifx64-mingw-ucrt
were built first, then the abseil libraries will link against the Universal C Runtime (UCRT). Whenrake gem:x64-mingw32
is attempted afterrake gem:x64-mingw-ucrt
, then it will fail to link those symbols because the abseil library inports/x86_64-w64-mingw32
directory expects UCRT to be used.To avoid this mess, append the
RbConfig::CONFIG['arch']
to the mini_portile recipe to ensurex64-mingw-ucrt
andx64-mingw32
builds use different library paths.