-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix compilation with re2 2023-07-01 #65
Conversation
https://code-review.googlesource.com/c/re2/+/61250 made re2 depend directly on abseil. The latest version of abseil now requires C++14 (abseil/abseil-cpp#1127). However, it seems that supplying `-std=c++14` isn't enough (abseil/abseil-cpp#1431). `-std=c++17` needs to be used at least. This commit fixes the compilation by trying C++20 and C++17 if the initial compilation fails. This fixes build issues on macOS.
a97200c
to
a6b007f
Compare
It seems https://code-review.googlesource.com/c/re2/+/61270 updated the |
ext/re2/extconf.rb
Outdated
# https://github.com/abseil/abseil-cpp/issues/1431). However, the | ||
# `std=c++14` flag doesn't appear to suffice; we need at least | ||
# `std=c++17`. | ||
checking_for("re2 requires a C++14 compiler") do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way for us to print the relevant message as we check for a C++17 compiler separately from checking for a C++11 compiler (for versions of re2 prior to release 2023-07-01)?
It's also worth noting that the return value of the block is used to determine whether it will print yes
or no
when compiling, e.g. when I tried this on my machine with the latest release, I see:
checking for re2 requires a C++14 compiler... no
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mudge Good point, I've improved the messages.
This commit will now display a "checking for" message for each C++ version attempted. For example: ``` checking for -lstdc++... yes checking for stdint.h... yes checking for rb_str_sublen()... yes checking for -lre2... yes checking for re2 requires explicit C++ version flag... yes checking for re2 compiles with -std=c++20... no checking for re2 compiles with -std=c++17... yes checking for RE2::Match() with endpos argument... yes checking for RE2::Set::Match() with error information... yes creating Makefile ```
98e910b
to
7e927e9
Compare
Have you had any luck compiling the latest re2 from scratch on Ubuntu 20.04? |
@mudge Yes, but only by installing a PPA with
|
GitHub: mudge/re2#65 From release 2023-07-01, re2 now requires Abseil (libabsl-dev) which is only available by default on Ubuntu 22.04. As older versions of re2 compiled on Ubuntu 20.04 should continue to work, we'll continue to use those even on newer GitHub Actions runners.
I hoped I could bump the more recent Ruby builds to Ubuntu 22.04 so we could use |
GitHub: mudge#65 In order to test against re2 2023-07-01, we need libabsl available on the GitHub Actions runner.
@mudge Is there a reason these older Ruby versions still need to be supported? Even Ruby 2.7 reached end-of-life 3 months ago. |
It's not a popular opinion but until it becomes extraordinarily painful (which might not be too far away), I don't want to break compatibility for anyone who can already run the gem. In this case, I've added the PPA you mentioned to the existing 20.04 build (and I've packaged up a |
OK, I've fixed the build ( |
https://code-review.googlesource.com/c/re2/+/61250 made re2 depend directly on abseil. The latest version of abseil now requires C++14 (abseil/abseil-cpp#1127). However, it seems that supplying
-std=c++14
isn't enough (abseil/abseil-cpp#1431).-std=c++17
needs to be used at least.This commit fixes the compilation by trying C++20 and C++17 if the initial compilation fails. This fixes build issues on macOS.