-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Add Homebrew libraries to the library search on Apple Silicon/darwin-arm64, or how to find them from other software? #13481
Comments
There was some discussion in https://github.com/orgs/Homebrew/discussions/1600 related to this, cc @larskanis, but it does not seem to lead to a clear or official solution to me. |
Shell out to |
Thanks for the quick reply. |
By Homebrew or by FFI? I'd say "probably" for us and "maybe" for you 😁 We'd need to set it in
No, this is not intentional. |
I meant by Homebrew, but maybe it's interesting to see if that'd work for FFI. I'm not sure that modifications to this env var are considered after the process started, would need to check.
Interesting, then I think it'd be worth considering if setting |
Yup. @Homebrew/maintainers any thoughts here? I don't think we can rely on
That's fair 👍🏻 |
Probably a bit of a chicken-and-egg problem, i.e., if
Yes, definitely something to consider, and should system packages be in front or behind Homebrew packages, should a package/library/header exists for both. |
Sorry, I don't agree here. I'm thinking partly "people who don't need |
Be aware that there are some security restrictions to the use of
|
Not a fan of
This is basically the security restriction that @fxcoudert references above. I am open to adding |
Is there something like an actual system library search path on macOS, which can be set globally and permanently? |
@eregon no I am pretty sure there is not |
For Ruby FFI, we'll probably search directories for now (since there seems to be no way to make
Specifically, where should |
After Putting it before Something that might make sense to add to CPPFLAGS="-I${HOMEBREW_PREFIX}/include${CPPFLAGS+ ${CPPFLAGS}}"
LDFLAGS="-L${HOMEBREW_PREFIX}/lib -Wl,-rpath,${HOMEBREW_PREFIX}/lib${LDFLAGS+ ${LDFLAGS}}" though. It doesn't solve your problem, but it might help make it smaller. |
In particular, since |
Somewhat related discussion (since Python reads all of the
This is quite a notable shortcoming. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Let's close this, thanks for the discussion. |
Provide a detailed description of the proposed feature
I wonder why Homebrew does not seem to add the libraries it installs to the system library search path on Apple Silicon/darwin-arm64.
Specifically, the case I care about here is Ruby FFI and other dlopen() users, and how they are supposed to find libraries installed via Homebrew: ffi/ffi#880 (comment)
I'm also interested in the general question: "How should software compiled from source (e.g., ruby) find Homebrew-installed headers+libraries?"
There is some discussion in #9177 and notably #9177 (comment)
But I am not clear on what's really a solution there.
brew --prefix wget
is unusable for FFI purposes as we only get the library name, no the package name.brew shellenv
does not seem applicable as we need to stay in the same processWhat is the motivation for the feature?
Make it easier for Ruby FFI and other dlopen() users to use Homebrew-installed libraries.
How will the feature be relevant to at least 90% of Homebrew users?
By making it easier (ideally automatic with no user intervention) for Ruby FFI and other dlopen() users to use Homebrew-installed libraries (and even software compiled from source in general) to find Homebrew packages, there is less need to know about lots of details (e.g., how to pass the openssl dir for ruby, actually not trivial it's
--with-openssl-dir
+PKG_CONFIG_PATH
) and workarounds to make it work.My observation is many macOS users in particular seem to not know much about their system, so the less they need to tweak the better chance they do not mess it up (which seems to happen a lot given a lot more report from macOS rather than Linux on most softwares).
What alternatives to the feature have been considered?
Searching a hardcoded directory like
/opt/homebrew/lib/
but it feels like a ugly workaround and might not work long-term, plus it does not scale to maintain such exceptions for every platform.Another way to think about this is every single platform supported by Ruby FFI needs no special search path, except darwin-arm64, how can we avoid it?
The text was updated successfully, but these errors were encountered: