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

extend/ENV/super: always set PKG_CONFIG_LIBDIR #19023

Merged
merged 1 commit into from
Jan 1, 2025

Conversation

cho-m
Copy link
Member

@cho-m cho-m commented Jan 1, 2025

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Setting PKG_CONFIG_LIBDIR overrides compiled default. This helps reduce opportunistic linkage when pkg-config call finds modules installed on system but not included in a formula's dependency tree.


The default on Linux is:

  • #{HOMEBREW_PREFIX}/lib/pkgconfig
  • #{HOMEBREW_PREFIX}/share/pkgconfig
  • #{HOMEBREW_LIBRARY}/Homebrew/os/linux/pkgconfig

Removing first 2 are needed to avoid opportunistic linkage. The final path doesn't exist.

On macOS, PKG_CONFIG_LIBDIR is:

[Pathname("/usr/lib/pkgconfig"), Pathname("#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}")]

Setting PKG_CONFIG_LIBDIR overrides compiled default. This helps reduce
opportunistic linkage when pkg-config call finds modules installed on
system but not included in a formula's dependency tree.
@cho-m
Copy link
Member Author

cho-m commented Jan 1, 2025

Need to try some formulae out to see any issues.

Currently saw openjdk having trouble finding harfbuzz but not sure why as it is a dependency so should be on PKG_CONFIG_PATH.

EDIT: openjdk was local issue as I am testing on ARM Linux so building everything from source. Specifically freetype had opportunistic linkage. Rebuilding freetype with this PR fixed pkg-config to only use formula dependencies.

@cho-m cho-m marked this pull request as ready for review January 1, 2025 05:05
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me!

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Jan 1, 2025
Merged via the queue into master with commit ddbb497 Jan 1, 2025
28 checks passed
@MikeMcQuaid MikeMcQuaid deleted the reduce-opportunistic-linkage branch January 1, 2025 12:37
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 this pull request may close these issues.

2 participants