mudge / re2

Ruby bindings to RE2, a "fast, safe, thread-friendly alternative to backtracking regular expression engines like those used in PCRE, Perl, and Python".
http://mudge.name/re2/
BSD 3-Clause "New" or "Revised" License
129 stars 13 forks source link

Add Ruby 2.6 support for native gems #94

Closed mudge closed 1 year ago

mudge commented 1 year ago

As the default system Ruby on macOS Monterey is 2.6 and MiniPortile2 supports back to 2.3, restore support for that Ruby and compile the C extension for it in the native gems.

The trade-off here is that we increase the size of the native gem in order to support more Ruby versions. While 2.6 is technically EOL, the rubygems.org stats still show usage of it in the past month: https://ui.honeycomb.io/ruby-together/datasets/rubygems.org/result/HBSqTboW1yi

(Curiously, those stats show Ruby 2.5 having much higher usage than 2.6 but I think it’s worth making the gem work out of the box on Intel Macs stuck on Monterey.)

mudge commented 1 year ago

This seems to be failing with Cannot compile re2 with your compiler: recent versions require C++14 support. even though the underlying runner should be the same as the other Ruby versions?

stanhu commented 1 year ago

It looks like C extensions and Ruby 2.6 don't build with a C++17 compiler:

"clang -I/Users/stanhu/.asdf/installs/ruby/2.6.10/include/ruby-2.6.0/arm64-darwin22 -I/Users/stanhu/.asdf/installs/ruby/2.6.10/include/ruby-2.6.0/ruby/backward -I/Users/stanhu/.asdf/installs/ruby/2.6.10/include/ruby-2.6.0 -I../../../../ext/re2 -I/Users/stanhu/github/re2/ports/aarch64-apple-darwin22.6.0/abseil/20230125.3/include -I/Users/stanhu/github/re2/ports/aarch64-apple-darwin22.6.0/libre2/2023-07-01/include -I/Users/stanhu/.asdf/installs/ruby/2.6.10/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens  -fno-common -pipe -Wall -Wextra -funroll-loops  -x c++ -std=c++17 -c conftest.c"
In file included from conftest.c:1:
In file included from /Users/stanhu/.asdf/installs/ruby/2.6.10/include/ruby-2.6.0/ruby.h:33:
In file included from /Users/stanhu/.asdf/installs/ruby/2.6.10/include/ruby-2.6.0/ruby/ruby.h:2111:
/Users/stanhu/.asdf/installs/ruby/2.6.10/include/ruby-2.6.0/ruby/intern.h:56:19: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
void rb_mem_clear(register VALUE*, register long);
                  ^~~~~~~~~
/Users/stanhu/.asdf/installs/ruby/2.6.10/include/ruby-2.6.0/ruby/intern.h:56:36: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
void rb_mem_clear(register VALUE*, register long);
                                   ^~~~~~~~~
mudge commented 1 year ago

Maybe it’s not worth the hassle then.