Skip to content

Add Homebrew libraries to the library search on Apple Silicon/darwin-arm64, or how to find them from other software? #13481

@eregon

Description

@eregon

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 process

What 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionInput solicited from othersoutdatedPR was locked due to agestaleNo recent activity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions