Open shenlebantongying opened 1 year ago
Were you previously running macOS 11? Currently you need to brew reinstall pkg-config
when you do major macOS updates.
@Bo98 Yes, it fixed the problem, thank you very much :)
Were you previously running macOS 11?
I forget. I got my machine around 2021 Sept, it might be, but I upgraded every versions in between.
However this is so frustrating. The process of deep diving into pkg-config to find a workaround is so long :(
Should this be closed? Or i just change the title.
I tried to fix the handling of this a while back, but ran out of steam. I could try looking at it again, though I'm happy for someone else to take a stab at it.
We can keep this issue open for now.
I'm interested in having a stab at this, but I'm not sure what the best path would be to fix it. The search path for pkg-config
is baked into pkg-config
binary at build time, currently set to include #{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}
.
I would propose that we instead include something like #{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/current
, which will be a symlink to #{MacOS.version}
. (The symlink should not be checked into Git - or we can put this symlink somewhere else - maybe somewhere in Cellar? - to avoid this.)
Then the question would be at what point to update the symlink to point at the current version of #{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}
. Maybe:
brew reconfigure-pkg-config
or something.
dpkg-reconfigure
- brew reconfigure pkg-config
. This would probably need some DSL additions for more formulae to be able to specify/leverage this.brew reinstall pkg-config
. User still needs to discover the command, and run it themselves.brew
command that runs often. Somewhere in brew update
maybe?
pkg-config
until the brew
command runs.launchd
item to contain this and possible future things that need to run outside of the lifecycle of brew
commands (e.g. once per boot or something).
systemd
probably covers most people, but maybe provide a manual option/command that users can hook into their own preferred init systems.brew
-related code is running on the system. Also one more thing to clean up on uninstall, and not contained neatly in HOMEBREW_PREFIX
.Or maybe there's a better way than this symlink approach, but for most other ideas I can think of, I still see the same issue of user needing to manually run a command (maybe brew
can prompt/show a message, but still requires user to run a brew
command) or we need some way to automate/do stuff at the right time.
Alternative, which could apply to non-pkg-config cases like GCC and Clang's DEFAULT_SYSROOT
, could be a way of mark formulae that need reinstalling on newer macOS and those will appear as "outdated" if current OS != tab.dig("built_on", "os_version")
I would propose that we instead include something like
#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/current
, which will be a symlink to#{MacOS.version}
. (The symlink should not be checked into Git - or we can put this symlink somewhere else - maybe somewhere in Cellar? - to avoid this.)
This was essentially the approach I took in https://github.com/Homebrew/brew/pull/13664. Fine with doing this, but I remember there being concerns about when that symlink would be updated.
Alternative, which could apply to non-pkg-config cases like GCC and Clang's
DEFAULT_SYSROOT
, could be a way of mark formulae that need reinstalling on newer macOS and those will appear as "outdated" if current OS !=tab.dig("built_on", "os_version")
This is the approach I'd like to see: a new DSL that forces an upgrade or reinstall in the case mentioned here.
@Bo98 @carlocab do we want to still do anything here? Given we've done another major release without this: it seems we don't really want/need to do anything here.
I do think the DSL to force reinstall would be useful.
A temporary alternative would be a message in brew doctor
for formulae that we are aware are incompatible and need reinstall. Should be easier to implement and at least provide users some information on what is problem.
Given we've done another major release without this: it seems we don't really want/need to do anything here.
We've kinda gotten lucky given the last couple macOS releases have been very minor in terms of dependency updates.
But it is a problem if you go two major Xcode versions without reinstalling.
There is some potential for seeing if pkgconf
can handle this better but I'm still scoping that out.
@cho-m Either of those seem good. Would you be able to pick something up?
brew doctor
outputVerification
brew doctor
output" above saysYour system is ready to brew.
and am still able to reproduce my issue.brew update
twice and am still able to reproduce my issue.brew install wget
. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.brew config
outputWhat were you trying to do (and why)?
Trying to use
pkg-config
viacmake
to findpango
which depends onlibffi
from macOS SDK, but failed because pkg-config will provides invalid path pointing to older macOS SDKMinimum CMakeLists.txt to reproduce the problem:
Will gives
What happened (include all command output)?
The pkg-config tries to uses
libffi.pc
from macOS 11 while i am using the current Xcode and macOS 14.The pkg-config will give cmake a none-exists path because this line got included:
https://github.com/Homebrew/brew/blob/master/Library/Homebrew/os/mac/pkgconfig/11/libffi.pc#L1
instead of
https://github.com/Homebrew/brew/blob/master/Library/Homebrew/os/mac/pkgconfig/14/libffi.pc#L1
The pkg-config's path falsely includes
/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/11
What did you expect to happen?
I think pkg-config's search path should be
/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/14
instead of/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/11
on newest macOS & XCode.Step-by-step reproduction instructions (by running
brew
commands)The path outputted should includes
/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/14
instead of/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/11
For extra info, my XCode 15 installtion includes those things, the 11 got removed recently? i don't know.