Skip to content

python@3.9: set RPATH to $HOMEBREW_PREFIX/lib#80052

Closed
carlocab wants to merge 1 commit intoHomebrew:masterfrom
carlocab:python3.9-rpath
Closed

python@3.9: set RPATH to $HOMEBREW_PREFIX/lib#80052
carlocab wants to merge 1 commit intoHomebrew:masterfrom
carlocab:python3.9-rpath

Conversation

@carlocab
Copy link
Copy Markdown
Member

@carlocab carlocab commented Jun 26, 2021

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

This allows the ctypes module to be able to find libraries installed
into a non-/usr/local prefix with ctypes.cdll.LoadLibrary.

Closes qmk/qmk_cli#60
Resolves Homebrew/discussions#1737


In retrospect, this is probably the right fix for #75020. I'll check to see if the patch from #76383 is still needed when this is merged. Tested locally in a non-/usr/local prefix. It seems the patch to gobject-introspection is still needed.

This allows the `ctypes` module to be able to find libraries installed
into a non-`/usr/local` prefix with `ctypes.cdll.LoadLibrary`.

Closes qmk/qmk_cli#60
Resolves Homebrew/discussions#1737
carlocab added a commit to carlocab/homebrew-core that referenced this pull request Jun 26, 2021
This is the same patch is in Homebrew#80052 applied to `python@3.8`.
@carlocab
Copy link
Copy Markdown
Member Author

I don't really understand the ctypes module well enough to know why this isn't enough to do the job:

# Allow python modules to use ctypes.find_library to find homebrew's stuff
# even if homebrew is not a /usr/local/lib. Try this with:
# `brew install enchant && pip install pyenchant`
inreplace "./Lib/ctypes/macholib/dyld.py" do |f|
f.gsub! "DEFAULT_LIBRARY_FALLBACK = [",
"DEFAULT_LIBRARY_FALLBACK = [ '#{HOMEBREW_PREFIX}/lib', '#{Formula["openssl@1.1"].opt_lib}',"
f.gsub! "DEFAULT_FRAMEWORK_FALLBACK = [", "DEFAULT_FRAMEWORK_FALLBACK = [ '#{HOMEBREW_PREFIX}/Frameworks',"
end

However, AFAICT ctypes.cdll.LoadLibrary is just a wrapper around dlopen, which will use the linker's default search path, and this includes consulting any relevant LC_RPATH entries. ctypes.find_library could be based on something else entirely.

@carlocab
Copy link
Copy Markdown
Member Author

Cherry-picked onto #80175.

@carlocab carlocab closed this Jun 28, 2021
@carlocab carlocab deleted the python3.9-rpath branch June 28, 2021 14:45
carlocab added a commit to branchv/homebrew-core that referenced this pull request Jun 29, 2021
This is the same patch is in Homebrew#80052 applied to `python@3.8`.
BrewTestBot pushed a commit that referenced this pull request Jun 29, 2021
* python@3.8 3.8.11
* python@3.8: set `RPATH` to `$HOMEBREW_PREFIX/lib`
  This is the same patch is in #80052 applied to `python@3.8`.

Closes #80200.

Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
Signed-off-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>
@github-actions github-actions bot added the outdated PR was locked due to age label Jul 29, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated PR was locked due to age

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Failed loading libhidapi.dylib on M1 mac due to homebrew path changed

1 participant