Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure different Windows flavors build their own abseil library
Previously if you ran: ``` bundle exec rake gem:x64-mingw-ucrt bundle exec rake gem:x64-mingw32 ``` The latter would fail with undefined symbols: ``` 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.
- Loading branch information