Design Decisions With Respect To Non-Propogation of The `--build-from-source` Flag to Dependencies By `brew install`


(Bryce Glover) #1

OP’s Note: Since this question is more informal than what might be asked under the framework of Homebrew’s GitHub issue template, I posted it here first for either dismissal or further triage.


     In man brew, I just recently noticed that it states the following as part of its description of how to invoke brew install under said man page’s ‘COMMANDS’ section:

⋮

              If  --build-from-source (or -s) is passed, compile the specified formula from source even if a
              bottle is provided. Dependencies will still be installed from bottles if they are available.

⋮

Though this reflects the fact that Homebrew is either in the process of transitioning from being a from-source package manager to being a binary package manager or has already completed that transition, it may not, however, necessarily be the behavior that this individuals who, like myself, would like to continue using Homebrew as a from-source package manager, for better or for worse. (Discussing the benefits and drawbacks of such an approach within this Discourse thread seems like it would introduce extreme bloat to it, so I feel it would be best if that could be deferred to a future thread — here on Discourse or elsewhere — for now.)
     The relevant man page does, I should note, continue on by describing a workaround that end users may rely upon to circumvent this…interesting behavior:

⋮

              If HOMEBREW_BUILD_FROM_SOURCE is set, regardless of whether  --build-from-source  was  passed,
              then both formula and the dependencies installed as part of this process are built from source
              even if bottles are available.

⋮

Setting this environment variable would produce the desired behavior, but Homebrew’s man page later states in its ‘ENVIRONMENT’ section that usage of it is meant to be developer-/maintainer-internal only, at least with regard to tap creators and bottle distributors:

⋮

       HOMEBREW_BUILD_FROM_SOURCE
              If  set, 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.

⋮

Given all of this, might there be interest in making it so that brew install can optionally pass --build-from-source down to/through recursive invocations of either itself or related commands on members of a requested package’s dependency tree?


(Mike McQuaid) #2

Whether or not there is interest we’re not be changing the behaviour, I’m afraid. There simply very, very little advantage from the user for building everything from source (other than wasting energy and destroying the environment) and there’s a much, much higher support overhead for Homebrew maintainers because there’s many, many more things that can go wrong.


(Bryce Glover) #3

     The default behavior doesn’t have to change. I might not have been explicit enough, but basically what I’m wondering here is if it might be worth not distancing Homebrew from its origins as a from-source package manager while still moving towards presenting safe defaults to users who don’t know much, if anything, about building software from source, to implement a new flag that, when supplied, requests the more involved semantics — maybe expressed something like one of these suggestions:

  • --build-all-from-source
  • --recursive-build-from-source
  • --build-from-source-recursively
  • --build-from-source=recursive
  • --build-from-source-strategy=recursive
  • --build-strategy="from-source, recursive"
  • --build-strategy="from-source+recursive"
  • --build-from-source-style=recursive

Most users wouldn’t even have to know that a flag like this existed, but power users could scour Homebrew’s man page and see that it existed.
     As for addressing your concerned assertion that the costs of building all software from source outweigh the benefits of doing so for most users, I can agree with you on this to a certain extent. Building from source does take time and energy and is also harder to debug, so removing the burden of doing so from end users constitutes a laudable goal at least in part even though one may assume that most Homebrew users are comfortable with using the command line since brew is a command-line tool. I continue to feel, however, that this should not preclude users who see advantages to building all of their software from source from doing so if they wish. All builds would still remain automated by Homebrew, and their steps are documented in code as formulae and should thus not be overwhelmingly difficult to diagnose if they fail. If at least some maintainers like yourselves would prefer not to debug any problems which might result from such a workflow, then they could start presenting themselves as even more partial to receiving external pull requests to resolve such issues instead of creating PRs themselves than they already are.

P. S.: Perhaps somebody else could express this better than me…; I apologize in advance if this doesn’t convey exactly (or even nearly) what I intended it to.


(Mike McQuaid) #4

That’s about building from source outside of a package manager. Only one of those arguments applies to building software through Homebrew.

No, sorry. The costs outweigh the benefits for both us and end-users. You can use the environment variable.


(Bryce Glover) #5

     I’d say that both the first and last bullets in that StackOverflow answer I linked to still stand within the environment provided by a package manager like Homebrew, and bullets three and four further also apply to varying extents for formula creation/update contributors and end users building from the level spec. You are right that not all of those points are germane to the circumstances of a Homebrew user, though, as at least the second bullet is already covered for him or her by project contributors. You’re free to disagree, of course.


     As tempting of an idea as that is, doing so would, as stated quite clearly in Homebrew’s man page, preclude me from reporting issues using Homebrew formulae under this condition. I’m not yet snobbish enough of a power user to say ‘no’ to help debugging something when I need it, nor do I aspire to ever come across as somebody of that nature. Be that as it may, I can acknowledge that a GitHub issue is not always the best venue to use in communicating an issue with a project such as Homebrew and that you as a maintainer have the right to prioritize issues as you see fit. Under current circumstances, I take it that this means not participating in the resolution of corner cases. That’s fine, as I’ll do all I can to fix problems on my own and without intentionally involving uninterested Homebrew maintainers and/or contributors. I would just prefer to do it in the open and also be able to share the consequent fixes with whoever else might need them.