Open skull-squadron opened 1 year ago
The current logic is pretty explicit about why this is done:
// Calling `brew --prefix <package>` command is usually slow and
// takes seconds, and will be used only as a last resort.
Premature optimization is the root of all evil, especially when it doesn't work.
HOMEBREW_NO_AUTO_UPDATE=1 brew shellenv | sed '/HOMEBREW_PREFIX/!d;s/[^"]*"//;s!".*!/opt!'
is guaranteed to be instantaneous.
Homebrew = root $ root $ evil -- sigh
Please describe to me how this optimization was made prematurely.
Expected
It should just work.
Encountered
Tries to link to unrelated brew environment with a different architecture and fails to compile. Several utility crates are affected.
Use case
There is an installation at
/opt/homebrew/
for a different architecture that absolutely cannot be moved. Cannot do magic environment variables workarounds because this is fragile and not scalable.Solution
Trying random "well-known" locations particular to tools is fragile, breaks repeatability, separations of concerns, and isolation of builds and dev environments.
Instead of guessing at locations, if the
brew
command exists, ask it for the source of truthbrew --prefix openssl@{{n}}
.