Skip to content

Commit

Permalink
Work around x64-mingw-ucrt build failures in abseil-cpp
Browse files Browse the repository at this point in the history
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
abseil/abseil-cpp#1510 (comment),
work around the issue by explicitly defining
`-DABSL_FORCE_WAITER_MODE=4` (4 = `ABSL_WAITER_MODE_STDCPP`).
  • Loading branch information
stanhu authored and mudge committed Sep 24, 2023
1 parent fad5c92 commit 0c23084
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ext/re2/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,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|
Expand Down

0 comments on commit 0c23084

Please sign in to comment.