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

openssl-sys | mac | Doesn't respect brew --prefix #1813

Open
skull-squadron opened this issue Feb 8, 2023 · 4 comments · May be fixed by #1814
Open

openssl-sys | mac | Doesn't respect brew --prefix #1813

skull-squadron opened this issue Feb 8, 2023 · 4 comments · May be fixed by #1814

Comments

@skull-squadron
Copy link

skull-squadron commented Feb 8, 2023

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 truth brew --prefix openssl@{{n}}.

@skull-squadron skull-squadron changed the title Doesn't respect brew --prefix and instead makes an invalid assumption openssl-sys | Doesn't respect brew --prefix and instead makes an invalid assumption Feb 8, 2023
@skull-squadron skull-squadron linked a pull request Feb 8, 2023 that will close this issue
@skull-squadron skull-squadron changed the title openssl-sys | Doesn't respect brew --prefix and instead makes an invalid assumption openssl-sys | Doesn't respect brew --prefix Feb 8, 2023
@skull-squadron skull-squadron changed the title openssl-sys | Doesn't respect brew --prefix openssl-sys | mac | Doesn't respect brew --prefix Feb 8, 2023
@sfackler
Copy link
Owner

sfackler commented Feb 8, 2023

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.

@skull-squadron
Copy link
Author

skull-squadron commented Feb 9, 2023

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.

@skull-squadron
Copy link
Author

Homebrew = root $ root $ evil -- sigh

@sfackler
Copy link
Owner

sfackler commented Feb 9, 2023

Please describe to me how this optimization was made prematurely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants