From 3e28c6699f76fdd2e920b05927d91b161e881493 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 9 Sep 2023 22:17:38 -0700 Subject: [PATCH] Work around x64-mingw-ucrt build failures in abseil-cpp Previously the build would fail with this error message: ``` [ 37%] Building CXX object absl/synchronization/CMakeFiles/synchronization.dir/internal/create_thread_identity.cc.obj In file included from /tmp/d20230909-93-l6kcab/tmp/x86_64-w64-mingw32/ports/abseil/20230802.0/abseil-cpp-20230802.0/absl/synchronization/internal/create_thread_identity.cc:21: /tmp/d20230909-93-l6kcab/tmp/x86_64-w64-mingw32/ports/abseil/20230802.0/abseil-cpp-20230802.0/absl/synchronization/internal/waiter.h:44:2: error: #error ABSL_WAITER_MODE is undefined 44 | #error ABSL_WAITER_MODE is undefined | ^~~~~ /tmp/d20230909-93-l6kcab/tmp/x86_64-w64-mingw32/ports/abseil/20230802.0/abseil-cpp-20230802.0/absl/synchronization/internal/waiter.h:51:5: warning: "ABSL_WAITER_MODE" is not defined, evaluates to 0 [-Wundef] 51 | #if ABSL_WAITER_MODE == ABSL_WAITER_MODE_FUTEX | ^~~~~~~~~~~~~~~~ In file included from /tmp/d20230909-93-l6kcab/tmp/x86_64-w64-mingw32/ports/abseil/20230802.0/abseil-cpp-20230802.0/absl/synchronization/internal/create_thread_identity.cc:21: /tmp/d20230909-93-l6kcab/tmp/x86_64-w64-mingw32/ports/abseil/20230802.0/abseil-cpp-20230802.0/absl/synchronization/internal/waiter.h:52:16: error: 'FutexWaiter' does not name a type 52 | using Waiter = FutexWaiter; | ^~~~~~~~~~~ make[2]: *** [absl/synchronization/CMakeFiles/synchronization.dir/build.make:92: absl/synchronization/CMakeFiles/synchronization.dir/internal/create_thread_identity.cc.obj] Error 1 ``` As mentioned in https://github.com/abseil/abseil-cpp/issues/1510#issuecomment-1694254348, work around the issue by explicitly defining `-DABSL_FORCE_WAITER_MODE=4` (4 = `ABSL_WAITER_MODE_STDCPP`). --- ext/re2/extconf.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/re2/extconf.rb b/ext/re2/extconf.rb index ad5151f..4990d20 100644 --- a/ext/re2/extconf.rb +++ b/ext/re2/extconf.rb @@ -344,6 +344,8 @@ def build_with_vendored_libraries process_recipe(abseil_recipe) do |recipe| recipe.configure_options += ['-DABSL_PROPAGATE_CXX_STD=ON', '-DCMAKE_CXX_VISIBILITY_PRESET=hidden'] + # Workaround for https://github.com/abseil/abseil-cpp/issues/1510 + recipe.configure_options += ['-DCMAKE_CXX_FLAGS=-DABSL_FORCE_WAITER_MODE=4'] if windows? end process_recipe(re2_recipe) do |recipe|