mudge/re2

Need correct install incantation for modern macOS/homebrew install

Closed this issue · 6 comments

cabo commented

If you are using Mac OS X, I recommend installing re2 with Homebrew by running the following:
$ brew install re2

I'm running macOS on an M1 (arm64-darwin) but gem install re2 fails with

checking for re2 requires C++11 compiler... *** extconf.rb failed ***

Digging into the log shows

conftest.c:3:10: fatal error: 're2/re2.h' file not found
#include <re2/re2.h>
         ^~~~~~~~~~~
1 error generated.

So apparently I need one of the --with... options, but I don't know which and with which value.
(Homebrew is in /opt/homebrew.)

mudge commented

Hi @cabo,

If re2 is installed into /opt/homebrew, could you please try the following?

$ gem install re2 -- --with-re2-dir=/opt/homebrew

I tried to simulate this locally on my Intel Mac by manually compiling re2 into /opt/homebrew and it seemed to install successfully.

cabo commented

Thanks -- that actually works and probably should be indicated in the README.

(I thought I had tried that and it failed, but maybe I messed something up.)

cabo commented

(Even better would be to test the presence of this directory and use it if present, so it "just drops in".)

mudge commented

Hi @cabo,

I've just released 1.3.0 which adds /opt/homebrew as a default prefix to search when looking for the underlying re2 library.

Could you please try it out and see if it works for you without having to specify --with-re2-dir?

mudge commented

Thanks to @scottmatthewman who tested this out on an Apple Silicon machine for me and confirmed you can now run:

$ brew install re2
$ gem install re2

Without having to specify a location for re2 with --with-re2-dir.

Please let me know if you have any issues, @cabo.

cabo commented

I can confirm that it now works on my M1, too.
Thank you!