Skip to content
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

Need correct install incantation for modern macOS/homebrew install #50

Closed
cabo opened this issue Mar 12, 2021 · 6 comments
Closed

Need correct install incantation for modern macOS/homebrew install #50

cabo opened this issue Mar 12, 2021 · 6 comments

Comments

@cabo
Copy link

cabo commented Mar 12, 2021

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
Copy link
Owner

mudge commented Mar 12, 2021

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
Copy link
Author

cabo commented Mar 12, 2021

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
Copy link
Author

cabo commented Mar 12, 2021

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

mudge added a commit that referenced this issue Mar 12, 2021
GitHub: #50

To make installation easier for users of Homebrew on Apple Silicon, add
/opt/homebrew to the default paths searched when trying to find the
underlying re2 library.  While doing so, add an extra fallback to /usr
(instead of only searching /usr/local).

Note we still search /usr/local first to avoid accidentally changing
behaviour for existing users (e.g. suddenly compiling against a
different version of re2 in /usr).
mudge added a commit that referenced this issue Mar 12, 2021
GitHub: #50

To make installation easier for users of Homebrew on Apple Silicon, add
/opt/homebrew to the default paths searched when trying to find the
underlying re2 library.  While doing so, add an extra fallback to /usr
(instead of only searching /usr/local).

Note we still search /usr/local first to avoid accidentally changing
behaviour for existing users (e.g. suddenly compiling against a
different version of re2 in /usr).
mudge added a commit that referenced this issue Mar 12, 2021
GitHub: #50

To make installation easier for users of Homebrew on Apple Silicon, add
/opt/homebrew to the default paths searched when trying to find the
underlying re2 library.  While doing so, add an extra fallback to /usr
(instead of only searching /usr/local).

Note we still search /usr/local first to avoid accidentally changing
behaviour for existing users (e.g. suddenly compiling against a
different version of re2 in /usr).
@mudge
Copy link
Owner

mudge commented Mar 12, 2021

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
Copy link
Owner

mudge commented Mar 12, 2021

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.

@mudge mudge closed this as completed Mar 12, 2021
@cabo
Copy link
Author

cabo commented Mar 12, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants