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
130 stars 13 forks source link

building fails with latest re2 from GIT installed #40

Closed buzzdeee closed 4 years ago

buzzdeee commented 4 years ago

latest re2 removed deprecated interfaces, see GIT commit: https://code.googlesource.com/re2/+/ac65d4531798ffc9bf807d1f7c09efb0eec70480

so trying to install re2 gem fails building native extensions: make compiling re2.cc In file included from re2.cc:9: In file included from /usr/local/include/ruby-2.6/ruby.h:33: In file included from /usr/local/include/ruby-2.6/ruby/ruby.h:2111: /usr/local/include/ruby-2.6/ruby/intern.h:56:19: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register] void rb_mem_clear(register VALUE, register long); ^~~~~ /usr/local/include/ruby-2.6/ruby/intern.h:56:36: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register] void rb_mem_clear(register VALUE, register long); ^~~~~ re2.cc:261:37: error: no member named 'utf8' in 're2::RE2::Options' p->pattern->options().utf8() ? "UTF-8" : "ISO-8859-1"));


re2.cc:37:36: note: expanded from macro 'ENCODED_STR_NEW'
      int _enc = rb_enc_find_index(encoding); \
                                   ^~~~~~~~
re2.cc:459:35: error: no member named 'utf8' in 're2::RE2::Options'
            p->pattern->options().utf8() ? "UTF-8" : "ISO-8859-1"));

and quite more.

The utf8() member function was removed.
mudge commented 4 years ago

Hi @buzzdeee,

I've just published v1.2.0 which should hopefully fix this in a backward compatible way. I've switched from using the now-deprecated utf8 API and am using only encoding under the hood which has been in the library since its initial release in 2010.

I've tested it locally and have added the current (unreleased) version of re2 to the CI build matrix but please let me know if this resolves your issue.

buzzdeee commented 4 years ago

Hi @mudge

thanks for the quick fix, tested 1.2.0 against git checkout with and without the deprecated APIs, in both cases, it builds fine.