How to build bottle for git formula?

I am trying to build a bottle for git from scratch on ppc64le arch:

[tle@localhost build]$ brew install --build-bottle git
==> Downloading https://www.kernel.org/pub/software/scm/git/git-2.26.2.tar.xz
Updating Homebrew...
Already downloaded: /home/tle/.cache/Homebrew/downloads/8c7f7d2a6f2ccbf5a56d04b86b688c13f90f8919cf93e7c292a3b0bff5a785cc--git-2.26.2.tar.xz
==> Downloading https://github.com/agrn/git/commit/058d9c128c63b0a4849b384b358cca9bb19c56db.patch?full_index=1
Already downloaded: /home/tle/.cache/Homebrew/downloads/0e9058a6c87238906176fc4a24ac5f4c4246a6a83d3b0d0364dd1e1d795202dc--058d9c128c63b0a4849b384b358cca9bb19c56db.patch
==> Patching
==> Applying 058d9c128c63b0a4849b384b358cca9bb19c56db.patch
patching file sequencer.c
Hunk #1 succeeded at 1564 (offset -14 lines).
Hunk #2 succeeded at 4947 (offset -16 lines).
Hunk #3 succeeded at 4957 (offset -16 lines).
==> make install prefix=/home/linuxbrew/.linuxbrew/Cellar/git/2.26.2_1 sysconfdir=/home/linuxbrew/.linuxbrew/etc CC=gcc-5 CFLAGS= LDFLAGS= NO_TCLTK=1 NO_APPLE_COMMON_CRYPTO=
==> make
==> make test
==> make CC=gcc-5 CFLAGS= LDFLAGS=
==> Downloading https://www.kernel.org/pub/software/scm/git/git-manpages-2.26.2.tar.xz
Already downloaded: /home/tle/.cache/Homebrew/downloads/a55270b63c08f16de9ebdb33fe8a598a92af1e5a019a5bf8c8cecc8813bb1b7b--git-manpages-2.26.2.tar.xz
==> Downloading https://www.kernel.org/pub/software/scm/git/git-htmldocs-2.26.2.tar.xz
Already downloaded: /home/tle/.cache/Homebrew/downloads/547fc7968481a76e0395d3aa1a641981ba3411cda3623d94bbe49df5f9d3031a--git-htmldocs-2.26.2.tar.xz
==> Downloading https://cpan.metacpan.org/authors/id/R/RJ/RJBS/Net-SMTP-SSL-1.04.tar.gz
Already downloaded: /home/tle/.cache/Homebrew/downloads/0726c68dac390b617cefcc880f076b50795463c1fba286d46a53082ebed2bc9d--Net-SMTP-SSL-1.04.tar.gz
==> Caveats
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.

Bash completion has been installed to:
  /home/linuxbrew/.linuxbrew/etc/bash_completion.d

Emacs Lisp files have been installed to:
  /home/linuxbrew/.linuxbrew/share/emacs/site-lisp/git
==> Summary
🍺  /home/linuxbrew/.linuxbrew/Cellar/git/2.26.2_1: 1,469 files, 54.1MB, built in 40 seconds
Warning: git 2.26.2_1 is already installed and up-to-date
To reinstall 2.26.2_1, run `brew reinstall git`


[tle@localhost build]$ brew bottle --no-rebuild git
Error: Formula was not installed with --build-bottle: git

as you could see above that I am unable to bottle it. I would like to ask if there is anything that I have missed?

Many thanks

You’ll have to uninstall the git formula first, otherwise it will always error on:

Warning: git 2.26.2_1 is already installed and up-to-date
To reinstall 2.26.2_1, run `brew reinstall git`

Yes I have uninstalled git. If not, the brew install --build-bottle git would fail

It does, at the end. With the message I posted.

I did attempt to uninstall git first, please see my output:

[tle@localhost ~]$ brew uninstall git
Uninstalling /home/linuxbrew/.linuxbrew/Cellar/git/2.26.2_1... (1,469 files, 54.1MB)
[tle@localhost ~]$ brew install --build-bottle git
==> Downloading https://www.kernel.org/pub/software/scm/git/git-2.26.2.tar.xz
Updating Homebrew...
Already downloaded: /home/tle/.cache/Homebrew/downloads/8c7f7d2a6f2ccbf5a56d04b86b688c13f90f8919cf93e7c292a3b0bff5a785cc--git-2.26.2.tar.xz
==> Downloading https://github.com/agrn/git/commit/058d9c128c63b0a4849b384b358cca9bb19c56db.patch?full_index=1
Already downloaded: /home/tle/.cache/Homebrew/downloads/0e9058a6c87238906176fc4a24ac5f4c4246a6a83d3b0d0364dd1e1d795202dc--058d9c128c63b0a4849b384b358cca9bb19c56db.patch
==> Patching
==> Applying 058d9c128c63b0a4849b384b358cca9bb19c56db.patch
patching file sequencer.c
Hunk #1 succeeded at 1564 (offset -14 lines).
Hunk #2 succeeded at 4947 (offset -16 lines).
Hunk #3 succeeded at 4957 (offset -16 lines).
==> make install prefix=/home/linuxbrew/.linuxbrew/Cellar/git/2.26.2_1 sysconfdir=/home/linuxbrew/.linuxbrew/etc CC=gcc-5 CFLAGS= LDFLAGS= NO_TCLTK=1 NO_APPLE_COMMON_CRYPTO=
==> make
==> make test
==> make CC=gcc-5 CFLAGS= LDFLAGS=
==> Downloading https://www.kernel.org/pub/software/scm/git/git-manpages-2.26.2.tar.xz
Already downloaded: /home/tle/.cache/Homebrew/downloads/a55270b63c08f16de9ebdb33fe8a598a92af1e5a019a5bf8c8cecc8813bb1b7b--git-manpages-2.26.2.tar.xz
==> Downloading https://www.kernel.org/pub/software/scm/git/git-htmldocs-2.26.2.tar.xz
Already downloaded: /home/tle/.cache/Homebrew/downloads/547fc7968481a76e0395d3aa1a641981ba3411cda3623d94bbe49df5f9d3031a--git-htmldocs-2.26.2.tar.xz
==> Downloading https://cpan.metacpan.org/authors/id/R/RJ/RJBS/Net-SMTP-SSL-1.04.tar.gz
Already downloaded: /home/tle/.cache/Homebrew/downloads/0726c68dac390b617cefcc880f076b50795463c1fba286d46a53082ebed2bc9d--Net-SMTP-SSL-1.04.tar.gz
==> Caveats
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.

Bash completion has been installed to:
  /home/linuxbrew/.linuxbrew/etc/bash_completion.d

Emacs Lisp files have been installed to:
  /home/linuxbrew/.linuxbrew/share/emacs/site-lisp/git
==> Summary
🍺  /home/linuxbrew/.linuxbrew/Cellar/git/2.26.2_1: 1,469 files, 54.1MB, built in 39 seconds
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes to formulae.

Warning: git 2.26.2_1 is already installed and up-to-date
To reinstall 2.26.2_1, run `brew reinstall git`
[tle@localhost ~]$ brew bottle git
Error: Formula was not installed with --build-bottle: git

I have figured out why. It is because my system git and curl version are older than the minimum required version thus git and curl would always get install when invoking brew. I have work-around the issue by manually edit the brew.sh and remove all logic related to minimum version.

1 Like

That is definitely an edge case. Thanks for posting your solution.