Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
40.14k stars 9.41k forks source link

Inconsistent Behavior In `brew upgrade --build-from-source` #1656

Closed RandomDSdevel closed 7 years ago

RandomDSdevel commented 7 years ago

Please follow the general troubleshooting steps first:

Bug reports:

     Lately I've been seeing an intermittent issue with Homebrew where it, specifically its brew upgrade sub-command, seems to spazfreak out and not respect the fact that I've passed --build-from-source to it, just like I always do. (How can I tell? I also like to pass -vd to all my Homebrew process runs to see all the extra info those switches provide me because I like to peruse it at times, though I'm not entirely sure if the details shown by doing that would tell me whether my packages are getting built from source successfully or not. Heck, using -v alone might tip me off to this, but I haven't experimented enough to figure that out yet.) (I'd set the HOMEBREW_BUILD_FROM_SOURCE environment variable per personal preference, but man brew says in its description of said setting that, "If set, [this] instructs Homebrew to compile from source even when a formula provides a bottle. This environment variable is intended for use by Homebrew developers. Please do not file issues if you encounter errors when using this environment variable.", so I haven't since I don't typically work with brew's core internals themselves myself. I'm assuming that this means I can still file an issue about this since I'm using the --build-from-source run-time option instead.)
     Anyway, I think this started happening to me some time around when brew v1.1.0 was released, IIRC, though that's only a very rough estimate on my part and might even be way off. In addition, I've gone through this with multiple formulas' packages; here's a partial list based on both some runs of brew info and what I've remembered to keep track of in my personal install logs:

It looks a bit suspicious that a lot of these problems manifested themselves on Tuesdays, but I'm betting that's just a coincidence. In any case, I'll also attach the results of running brew info on all of those formulae below along with the normally requested readouts of the results of running brew config and brew doctor. Note that none of my older installations of from-source builds of these formulas' packages are present in any of these readouts since I frequently run brew cleanup manually.


Output of brew info jasper:

jasper: stable 2.0.8 (bottled)
Library for manipulating JPEG-2000 images
https://www.ece.uvic.ca/~frodo/jasper/
/usr/local/Cellar/jasper/2.0.8 (180 files, 3M) *
  Built from source on 2016-12-12 at 14:19:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/jasper.rb
==> Dependencies
Build: cmake ✔
Required: jpeg ✔
==> Options
--universal
    Build a universal binary

Output of brew info imagemagick:

imagemagick: stable 6.9.6-8 (bottled), HEAD
Tools and libraries to manipulate images in many formats
https://www.imagemagick.org/
/usr/local/Cellar/imagemagick/6.9.6-8 (1,483 files, 26.2M) *
  Built from source on 2016-12-12 at 14:38:30 with: --with-fftw --with-hdri --with-opencl --with-openmp --with-perl --with-x11 --with-fontconfig --with-little-cms --with-little-cms2 --with-libwmf --with-librsvg --with-liblqr --with-openexr --with-ghostscript --with-webp --with-openjpeg --with-pango
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/imagemagick.rb
==> Dependencies
Build: pkg-config ✔
Required: libtool ✔, xz ✔
Recommended: jpeg ✔, libpng ✔, libtiff ✔, freetype ✔
Optional: fontconfig ✔, little-cms ✔, little-cms2 ✔, libwmf ✔, librsvg ✔, liblqr ✔, openexr ✔, ghostscript ✔, webp ✔, openjpeg ✔, fftw ✔, pango ✔
==> Requirements
Optional: x11 ✔, perl >= 5.5 ✔
==> Options
--with-fftw
    Compile with FFTW support
--with-fontconfig
    Build with fontconfig support
--with-ghostscript
    Build with ghostscript support
--with-hdri
    Compile with HDRI support
--with-liblqr
    Build with liblqr support
--with-librsvg
    Build with librsvg support
--with-libwmf
    Build with libwmf support
--with-little-cms
    Build with little-cms support
--with-little-cms2
    Build with little-cms2 support
--with-opencl
    Compile with OpenCL support
--with-openexr
    Build with openexr support
--with-openjpeg
    Build with openjpeg support
--with-openmp
    Compile with OpenMP support
--with-pango
    Build with pango support
--with-perl
    Compile with PerlMagick
--with-quantum-depth-16
    Compile with a quantum depth of 16 bit
--with-quantum-depth-32
    Compile with a quantum depth of 32 bit
--with-quantum-depth-8
    Compile with a quantum depth of 8 bit
--with-webp
    Build with webp support
--with-x11
    Build with x11 support
--with-zero-configuration
    Disables depending on XML configuration files
--without-freetype
    Build without freetype support
--without-jpeg
    Build without jpeg support
--without-libpng
    Build without libpng support
--without-libtiff
    Build without libtiff support
--without-magick-plus-plus
    disable build/install of Magick++
--without-modules
    Disable support for dynamically loadable modules
--without-threads
    Disable threads support
--HEAD
    Install HEAD version
==> Caveats
For full Perl support you may need to adjust your PERL5LIB variable:
  export PERL5LIB="/usr/local/lib/perl5/site_perl":$PERL5LIB

Output of brew info ocaml:

ocaml: stable 4.04.0 (bottled), HEAD
General purpose programming language in the ML family
https://ocaml.org/
/usr/local/Cellar/ocaml/4.04.0 (1,742 files, 242M) *
  Built from source on 2016-12-01 at 17:40:27 with: --with-x11 --with-flambda
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ocaml.rb
==> Requirements
Optional: x11 ✔
==> Options
--with-flambda
    Install with flambda support
--with-x11
    Install with the Graphics module
--HEAD
    Install HEAD version

Output of brew info shared-mime-info:

shared-mime-info: stable 1.8 (bottled), HEAD
Database of common MIME types
https://wiki.freedesktop.org/www/Software/shared-mime-info
/usr/local/Cellar/shared-mime-info/1.8 (844 files, 6.8M) *
  Built from source on 2016-12-06 at 15:17:46
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/shared-mime-info.rb
==> Dependencies
Build: pkg-config ✔, intltool ✔
Required: gettext ✔, glib ✔

Output of brew config:

HOMEBREW_VERSION: 1.1.2
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 0f529dae1043639058130092cf35e68d18907cb8
Last commit: 2 weeks ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 5708f52c1c1c342b92e5770d3452943d7957b8a5
Core tap last commit: 3 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: dual-core 64-bit core2
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.11.0 => /usr/local/bin/git
Perl: /usr/local/bin/perl => /usr/local/Cellar/perl/5.24.0_1/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/local/bin/ruby => /usr/local/Cellar/ruby/2.3.3/bin/ruby
Java: 1.8.0_112, 1.8.0_111
macOS: 10.11.6-x86_64
Xcode: 8.1
CLT: 7.3.1.0.1.1461711523
X11: 2.7.11 => /opt/X11

Output of brew doctor:

Your system is ready to brew.
amckinlay commented 7 years ago

I specified command line options when upgrading a formula already installed as a bottle, e.g., brew upgrade --with-texi2html --with-unicode9 zsh, but Homebrew simply poured the newer version as a bottle.

RandomDSdevel commented 7 years ago

Huh, interesting to know that you've seen a similar yet still distinct related issue, @amckinlay. Any thoughts on this issue yet, @Homebrew/maintainers?

P. S.: I haven't yet confirmed that this issue still occurs with Xcode 8.2 and its command-line tools suite as well.

P. P. S.: Hmm, saying '@Homebrew/maintainers' doesn't seem to be producing a team mention…; I wonder why that is…?

RandomDSdevel commented 7 years ago

Just confirmed that this issue still exists with the following brew config:

HOMEBREW_VERSION: 1.1.5
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 9cd5a21b473f0271b162bbe7f77f7d1468c0cfa1
Last commit: 3 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 0ed5589266ab174836e16983a9a4529cd1780f06
Core tap last commit: 2 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: dual-core 64-bit core2
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.11.0 => /usr/local/bin/git
Perl: /usr/local/bin/perl => /usr/local/Cellar/perl/5.24.0_1/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/local/bin/ruby => /usr/local/Cellar/ruby/2.3.3/bin/ruby
Java: 1.8.0_112, 1.8.0_111
macOS: 10.11.6-x86_64
Xcode: 8.2
CLT: 8.2.0.0.1.1480973914
X11: 2.7.11 => /opt/X11

To be absolutely clear, this time I saw this issue happen when brew upgrade -vd --build-from-source got to Mailutils v3.1.1.

P. S. again: Add Unbound to the list, as Homebrew also freaked out on me when I tried to update it to v1.6.0 since it's a dependency of GNU TLS, which, in turn, is a dependency of Mailutils, which caused Unbound to have its update installed from a bottle for a time as well in an event I must have missed seeing during my previous analysis of today's hiccup as it flashed by… Everything's fixed again here down on my end, but, blast, this is starting to get annoying! It'll probably happen again, too, confound it all…

P. P. S.: Mailutils has no options, so I'm not sure why this issue is affecting it. I installed Unbound using --with-python, though, so maybe it's being affected by that since its an indirect dependency of the first piece of software…? Unfortunately for me, I'm not really that knowledgeable about Homebrew's internals, so I will not, I am sorry to say, be much help in debugging this beyond providing incident reports.

MikeMcQuaid commented 7 years ago

seems to spaz out

Just a gentle request to not use the phrase "spaz out" as I find it offensive, thanks.

not respect the fact that I've passed --build-from-source to it, just like I always do

Note that --build-from-source intentionally doesn't build dependencies from source whereas HOMEBREW_BUILD_FROM_SOURCE does.

There's a bit too much verbosity here for me to figure out what is going on here.

@RandomDSdevel To help us debug this issue can you explain:

MikeMcQuaid commented 7 years ago

@amckinlay That may have been a historic issue that was fixed recently. If you can still reproduce this with 1.1.5 can you let me know. Similarly, step-by-step reproduction instructions (with as minimal input data as possible) would be really useful, thanks.

amckinlay commented 7 years ago

@MikeMcQuaid I don't have the older version anymore. I'm pretty sure this occurred on 1.1.5. Can I just checkout an older version of homebrew-core to reinstall the older version in order to reproduce? I don't want to mess anything up.

MikeMcQuaid commented 7 years ago

Can I just checkout an older version of homebrew-core to reinstall the older version in order to reproduce? I don't want to mess anything up.

@amckinlay Yep, that'd be perfect, thanks 👍

RandomDSdevel commented 7 years ago

@MikeMcQuaid:

…seems to spaz out…

Just a gentle request to not use the phrase "spaz out" as I find it offensive, thanks.

Sorry; duly noted. Would you like me to edit my OP to this effect?

…not respect the fact that I've passed --build-from-source to it, just like I always do…

Note that --build-from-source intentionally doesn't build dependencies from source whereas HOMEBREW_BUILD_FROM_SOURCE does.

What if said dependencies were previously installed from source? And I thought I remembered the --build-from-source option applying for the entire duration of a brew sub-conmand's run, but perhaps that was simply a mistaken assumption on my part…?

There's a bit too much verbosity here for me to figure out what is going on here.

Whoops, sorry for rambling on there all the way back up in my OP!

@RandomDSdevel To help us debug this issue can you explain:

  • What you were trying to do (and why)
  • What happened
  • What you expected to happen
  • Step-by-step reproduction instructions (with as minimal input data as possible)

Okay, I'll do my best:

That being said, I would again like to stress that this is an intermittent issue. I'll let you know2 if I see it crop up any more times, though.


1Note that this bullet item presumes that Homebrew has been installed and in use for a while, with the end user (me, in this case) always passing --build-from-source to its sub-commands.
2Actually, I saw Homebrew using a Bintray link again today when running an ImageMagick update, but I'm pretty sure that's just due to the changes introduced to $(brew --repository homebrew/homebrew-core)/Formula/imagemagick.rb's url stanza in this commit. (Note to self: I should probably go leave some kind of comment on that PR…) Speaking of Homebrew Core, …3 3…perhaps I should have just filed this issue there instead? Now that I think about it, I believe this may only be affecting formulas from there, not every single one from all Homebrew taps like I first supposed — that's why I posted this issue here in the first place, you see…; maybe we should move it…?

MikeMcQuaid commented 7 years ago

Sorry; duly noted. Would you like me to edit my OP to this effect?

That's fine, thanks for the apology.

What if said dependencies were previously installed from source? And I thought I remembered the --build-from-source option applying for the entire duration of a brew sub-conmand's run, but perhaps that was simply a mistaken assumption on my part…?

If they were installed with options different to the bottle: they should be rebuilt with the same options. We don't rebuild things from source because there's almost no difference between the bottle and provide an environment variable if you always want to build everything from source.

Whoops, sorry for rambling on there all the way back up in my OP!

That's OK. Try to remember that time Homebrew maintainers spend reading is time they can't spend fixing 😉

What I was trying to do: A routine (for me, anyway) brew update -vd --build-from-source.

Do you mean upgrade?

Some formulas' associated software packages were intermittently poured from bottles hosted in Homebrew's Bintray repository instead of built from source tarballs fetched from said packages' official web sites.

Any upgraded dependencies this will be done intentionally. It sounds like you want HOMEBREW_BUILD_FROM_SOURCE but you're scared off by the warning. Really, you should be similarly scared off by --build-from-source. Can I ask why you wish to build these all from source?

— that's why I posted this issue here in the first place, you see…; maybe we should move it…?

No, we only want issues there that affect some formulae but not others.

RandomDSdevel commented 7 years ago

Sorry; duly noted. Would you like me to edit my OP to this effect?

That's fine, thanks for the apology.

You're welcome.

What if said dependencies were previously installed from source? And I thought I remembered the --build-from-source option applying for the entire duration of a brew sub-conmand's run, but perhaps that was simply a mistaken assumption on my part…?

If they were installed with options different to the bottle: they should be rebuilt with the same options. We don't rebuild things from source because there's almost no difference between the bottle and provide an environment variable if you always want to build everything from source.

Well, I usually use non-standard option configurations, so that's why I was wondering what the heck Homebrew was thinking pouring bottles every so often.

Whoops, sorry for rambling on there all the way back up in my OP!

That's OK. Try to remember that time Homebrew maintainers spend reading is time they can't spend fixing 😉

I'd better tie my hands behind my back, then, 'cause I sometimes tend to ramble when I type… 😆

What I was trying to do: A routine (for me, anyway) brew update -vd --build-from-source.

Do you mean upgrade?

Whoops, slip of the brain and fingers. I'd better go back and correct that…

Some formulas' associated software packages were intermittently poured from bottles hosted in Homebrew's Bintray repository instead of built from source tarballs fetched from said packages' official web sites.

Any upgraded dependencies this will be done intentionally. It sounds like you want HOMEBREW_BUILD_FROM_SOURCE but you're scared off by the warning. Really, you should be similarly scared off by --build-from-source. Can I ask why you wish to build these all from source?

I guess I just kind of like and agree with some of the sentiment expressed here. Plus, like I mentioned above, I tend to like using non-standard options to enable more functionality.

— that's why I posted this issue here in the first place, you see…; maybe we should move it…?

No, we only want issues there that affect some formulae but not others.

Cool, that's exactly what I thought.

MikeMcQuaid commented 7 years ago

Well, I usually use non-standard option configurations, so that's why I was wondering what the heck Homebrew was thinking pouring bottles every so often.

I guess I just kind of like and agree with some of the sentiment expressed here.

That's a really bad fit for Homebrew, for what it's worth. We know building from source often exposes many more problems which is why we don't support it. This should probably be extended wider to not "supporting" options either as CI cannot test them currently.

amckinlay commented 7 years ago

@MikeMcQuaid Seems brew upgrade --with-texi2html --with-unicode9 zsh ignoring build options is not a bug, but designed behavior. See #1699.

RandomDSdevel commented 7 years ago

@MikeMcQuaid:

… [(snipped)]

That's a really bad fit for Homebrew, for what it's worth. We know building from source often exposes many more problems which is why we don't support it. This should probably be extended wider to not "supporting" options either as CI cannot test them currently.

{soapbox}      Face With One Eyebrow Raised Despite not being involved with Homebrew from the beginning, the general atmosphere around it leads me to suspect that the project's ability to build packages directly from source was, at least initially, one of its core pieces of functionality and remains so in most end users' opinions to this day, so I'm not sure how viable your position that it should get removed is. Then again, as I haven't been around since the early days of brew, I could have gotten the wrong impression from some vocal minority on the subject. Having said that, I, as a relatively uninvolved end-user, cannot and will not stand in your way if you, as a Homebrew maintainer, decide to pursue your line of thought on this matter in a separate issue, as it already seems to have started derailing this thread from its original purpose, despite not foreseeing such an effort going very well for you from where I'm standing, especially if said 'vocal minority' involves itself in discussions toward that end. One possible outcome I could see you regretting is causing a mass exodus to MacPorts or Fink, which, in my opinion, remain inferior projects since, AFAICR, still require frequent usage of sudo to perform routine tasks. Perhaps a better alternative would be to let end users like myself set Homebrew up to automatically submit CI-style profiling information beyond the scope of and in addition to the pre-existing analytics data up to the CI servers? I'm willing to open an issue requesting such a feature. I don't know how far that would get, either, but it's worth a try, I suppose…
{/soapbox}

MikeMcQuaid commented 7 years ago

the project's ability to build packages directly from source was, at least initially, one of its core pieces of functionality and remains so in most end users' opinions to this day, so I'm not sure how viable your position that it should get removed is.

I'm not proposing it be removed because it's needed to build binary packages. I'm saying that if someone chooses to build from source instead of using a working binary package then they are making it harder for us to run this project by adding to the support burden for no good reason. If you're able to fix problems you run into yourself: that's fine but otherwise it's really not worth doing.

RandomDSdevel commented 7 years ago

…the project's ability to build packages directly from source was, at least initially, one of its core pieces of functionality and remains so in most end users' opinions to this day, so I'm not sure how viable your position that it should get removed is. …

I'm not proposing it be removed because it's needed to build binary packages. …

Phew! Well, that's a relief.

…I'm saying that if someone chooses to build from source instead of using a working binary package then they are making it harder for us to run this project by adding to the support burden for no good reason. …

I take it that you've seen analytics data demonstrating that not many people use either --build-from-source or HOMEBREW_BUILD_FROM_SOURCE, then? You wouldn't mind pointing me in the analytics dashboard's general direction, would you? For the life of me, I can't seem to find it again (if it's even publicly viewable at all, that is, though I think remember seeing a page on it linked from an issue or PR…shrugs.) That aside, now I see where you're coming from on this and will thus defer to your better judgement.

…If you're able to fix problems you run into yourself: that's fine but otherwise it's really not worth doing.

That's perfectly fine by me, so I'll go ahead and return to simply doing just that as I have before, though I've had help from fellow contributors (and sometimes even project maintainers) even then. Like you said, you (personally, at the very least) have enough work on your hands, what with helping to run things here in your spare time and all. Again, it's probably high time I bowed out of this thread unless and until I see this issue crop up again, though it seems to have disappeared, so I don't know if I'll be back.

MikeMcQuaid commented 7 years ago

I take it that you've seen analytics data demonstrating that not many people use either --build-from-source or HOMEBREW_BUILD_FROM_SOURCE, then?

No, I'm saying that it's (literally) a waste of (your and our) time to run it and report issues that could be avoided by not using it.

You wouldn't mind pointing me in the analytics dashboard's general direction, would you?

It's not public (yet).

Again, it's probably high time I bowed out of this thread unless and until I see this issue crop up again, though it seems to have disappeared, so I don't know if I'll be back.

Thanks for the write-up. Just try to remember for future to try to be as concise as possible and that, although lovely, the issue tracker isn't great for chatter.

RandomDSdevel commented 7 years ago

…I take it that you've seen analytics data demonstrating that not many people use either --build-from-source or HOMEBREW_BUILD_FROM_SOURCE, then? …

No, I'm saying that it's (literally) a waste of (your and our) time to run it and report issues that could be avoided by not using it.

     I agree that building from source can test one's patience considerably, but I didn't realize just how nettled it has caused some of you maintainers — yourself in particular, @MikeMcQuaid — to become. I hope that you will forgive me for poking the proverbial hornet's nest by committing myself to building all of my Homebrew formulas' associated packages from source in the first place. I'm not entirely certain if I have yet come to weigh the costs and benefits of doing so in quite the same way you do, as my experience with building packages from source has generally remained relatively painless and gratifying aside from a handful of gnarly edge cases, but I can now understand where your anxiety comes from.
     The fact remains, however, that issues related to the usage patterns I have likely come to share with some few others in the Homebrew end-user community will still exist whether anybody, myself included, reports them as issues or not. I'd rather have a means of collaborating on resolving such problems nicely for everybody involved even if you and the majority of the Homebrew user/contributor/maintainer community don't wish to participate in the process of doing that than not at all, so where should that happen? I get that unimportant issues should not gain undue priority, but your implication that discussion of them should move to another venue risks fragmenting the Homebrew community, and I don't think either of us want to see anything of the sort happen, especially since so much effort has gone into unifying work between all of the different official and close-to-official taps lately. That being said, see my reply to the last point you made in your previous reply to this thread at the end of this post.

…You wouldn't mind pointing me in the analytics dashboard's general direction, would you? …

It's not public (yet).

I'll look forward to seeing it become so, then, as I would gladly join others in welcoming useful tools like the analytics dashboard into the open where all can see it.

…Again, it's probably high time I bowed out of this thread unless and until I see this issue crop up again, though it seems to have disappeared, so I don't know if I'll be back.

Thanks for the write-up. …

Once again, you're welcome.

…Just try to remember for future to try to be as concise as possible and that, although lovely, the issue tracker isn't great for chatter.

Yes, we should probably have continued the parts of this discussion not pertaining to resolving this issue itself to the mailing list or somewhere else similar external to GitHub. Next time I get myself embroiled in a topic of such large extent, I'll try to steer the conversation in that kind of direction.

MikeMcQuaid commented 7 years ago

I get that unimportant issues should not gain undue priority, but your implication that discussion of them should move to another venue risks fragmenting the Homebrew community, and I don't think either of us want to see anything of the sort happen, especially since so much effort has gone into unifying work between all of the different official and close-to-official taps lately. That being said, see my reply to the last point you made in your previous reply to this thread at the end of this post.

Yes, we should probably have continued the parts of this discussion not pertaining to resolving this issue itself to the mailing list or somewhere else similar external to GitHub. Next time I get myself embroiled in a topic of such large extent, I'll try to steer the conversation in that kind of direction.

My main issue is that every time a maintainer receives an email about an unimportant discussion or issue (i.e. one where there's nothing actionable) reading it reduces the time they can spend on other things on the project.

I'll look forward to seeing it become so, then, as I would gladly join others in welcoming useful tools like the analytics dashboard into the open where all can see it.

It's not that easy; I'm going to have to write a bunch of code to do so.

Locking this thread now just to gently stop a discussion that's gone pretty heavily off-topic.