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

Homebrew ugrep formula for MacOS and Linux #21

Closed
genivia-inc opened this issue Mar 12, 2020 · 12 comments
Closed

Homebrew ugrep formula for MacOS and Linux #21

genivia-inc opened this issue Mar 12, 2020 · 12 comments
Labels
help wanted Extra attention is needed

Comments

@genivia-inc
Copy link
Member

genivia-inc commented Mar 12, 2020

EDIT: The repo includes a Homebrew formula to install the latest version of ugrep, fully-featured and AVX/SSE2 optimized:

$ brew install https://raw.githubusercontent.com/Genivia/ugrep/master/Formula/ugrep.rb

Still, it would be nice to have an official homebrew formula for ugrep. The problem is that I am stuck with brew audit reporting "GitHub repository not notable enough (<30 forks, <30 watchers and <75 stars)".

  1. If you're happy with ugrep, please ⭐️ the project.

  2. If you want easy installation with homebrew and other installers, please ⭐️ the project.

  3. If you want more features in ugrep, please let us know what you want and don't forget to ⭐️ the project when you are happy with the ugrep updates.

But if you are somehow unhappy and have problems with ugrep, please submit your issue with technical details so we can improve ugrep.

@genivia-inc genivia-inc added the help wanted Extra attention is needed label Mar 12, 2020
@shmidt
Copy link

shmidt commented Apr 13, 2020

Thank you for the amazing tool!
It seems to me, that it would be better to place this info in readme, since mac users will search for brew info there and might not visit issues page.

@genivia-inc
Copy link
Member Author

Thank you and sorry for the delayed response. I've been busy working on ugrep 2.0 that is now released today.

It seems to me, that it would be better to place this info in readme, since mac users will search for brew info there and might not visit issues page.

Agreed. This "issue" isn't entirely the right way to ask for help. I hope to close it soon.

More important to me is to continue to add feature enhancements to ugrep such as the new query UI option -Q released with 2.0.

I am considering creating a Linux rpm package, in addition to Homebrew formulas.

@shmidt
Copy link

shmidt commented Apr 14, 2020

Thank you so much for your work!

@EnricoMonese
Copy link

In the meantime a Tap could be made, it's basically the same thing but not in the official repo.

@moonfruit
Copy link

@genivia-inc @EnricoMonese It would be great if there is a Tap for now!

@genivia-inc
Copy link
Member Author

According to homebrew, you should be able to run brew tap https://github.com/Genivia/ugrep to clone ugrep on MacOS, assuming you have homebrew installed. Then run brew install ugrep to install ugrep and you can use the usual brew commands to update.

@EnricoMonese
Copy link

I believe that won't be enough, since homebrew would not know how to compile and install. Here are more info.
Homebrew needs a "formula", a file that has all the the metadata and build/install instructions.
Basically what you need is a file like any one of these and then host it somewhere, in either this repo or a separate repo or even a website may work

@shmidt
Copy link

shmidt commented Apr 28, 2020 via email

@genivia-inc
Copy link
Member Author

OK, that makes more sense. I was not familiar with the way Tap works. I already had a formula, which I updated to the latest v2.0.6 and committed to the master branch:

https://github.com/Genivia/ugrep/tree/master/Formula

@EnricoMonese
Copy link

That does work, with running

brew install https://raw.githubusercontent.com/Genivia/ugrep/master/Formula/ugrep.rb

It does however fail at the make install step

Error log
==> make install
Last 15 lines from /Users/enrico/Library/Logs/Homebrew/ugrep/02.make:
          __m256i vlcpeq = _mm256_cmpeq_epi8(vlcp, vlcpm);
                           ^
matcher.cpp:504:28: error: always_inline function '_mm256_cmpeq_epi8' requires target feature 'avx2', but would be inlined into function 'advance' that is compiled without support for 'avx2'
          __m256i vlcseq = _mm256_cmpeq_epi8(vlcs, vlcsm);
                           ^
matcher.cpp:505:27: error: always_inline function '_mm256_movemask_epi8' requires target feature 'avx2', but would be inlined into function 'advance' that is compiled without support for 'avx2'
          uint32_t mask = _mm256_movemask_epi8(_mm256_and_si256(vlcpeq, vlcseq));
                          ^
matcher.cpp:505:48: error: always_inline function '_mm256_and_si256' requires target feature 'avx2', but would be inlined into function 'advance' that is compiled without support for 'avx2'
          uint32_t mask = _mm256_movemask_epi8(_mm256_and_si256(vlcpeq, vlcseq));
                                               ^
4 errors generated.
make[1]: *** [libreflex_a-matcher.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [install-recursive] Error 1

@genivia-inc
Copy link
Member Author

Well, this is interesting. Homebrew screws up the build process by removing the essential option -march=native as you can see here in the ~/Library/Logs/Homebrew/ugrep/02.make.cc log (superenv removed: -march=native):

clang++ called with: -std=gnu++11 -DHAVE_CONFIG_H -I. -I.. -I../include -march=native -mavx -DHAVE_AVX -I/usr/local/include -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/local/include -I/usr/local/include -Wall -Wextra -Wunused -O2 -c -o libreflex_a-matcher.o matcher.cpp
superenv removed:  -march=native -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -Wall -Wextra -Wunused -O2
superenv added:    -pipe -w -Os -march=core2 -isystem/usr/local/include -isystem/usr/include/libxml2 -isystem/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
superenv executed: clang++ -pipe -w -Os -march=core2 -std=gnu++11 -DHAVE_CONFIG_H -I. -I.. -I../include -mavx -DHAVE_AVX -I/usr/include -c -o libreflex_a-matcher.o matcher.cpp -isystem/usr/local/include -isystem/usr/include/libxml2 -isystem/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers

It replaces this option with -march=core2.

So I made a few changes to the formula:

class Ugrep < Formula
  env :std
  ...
  def install
    ENV.O2
    ENV.deparallelize
    ENV.delete('CFLAGS')
    ENV.delete('CXXFLAGS')
    system "./configure", "--enable-color",
                          "--disable-dependency-tracking",
                          "--disable-silent-rules",
                          "--prefix=#{prefix}"
    system "make"
    system "make", "install"

It works now to install ugrep as follows:

brew install https://raw.githubusercontent.com/Genivia/ugrep/master/Formula/ugrep.rb

@EnricoMonese
Copy link

Can confirm, it works now

@genivia-inc genivia-inc changed the title Homebrew ugrep formula for MacOS and Linux requires 75 stars Homebrew ugrep formula for MacOS and Linux May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants