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
[SR-12937] [Regression][5.2][macOS] SwiftPM can not properly get pkg-config libs and C flags for some libraries #4537
Comments
Comment by Max Liberman (JIRA) I'm running into this issue as well, in my case with the
|
Comment by Max Liberman (JIRA) I opened a PR here. |
Comment by Serhii Mumriak (JIRA) mliberman (JIRA User) oh my god, thank you so much! can i ask how did you find the underlying problem? I was thinking about debugging swiftpm itself, but it's not really possible which i tried to find help for here: https://forums.swift.org/t/is-there-a-way-to-debug-swift-package-manager-in-xcode/37185/5 |
Comment by Max Liberman (JIRA) PALKOVNIK (JIRA User) I tracked down the warning message ( |
Comment by Max Liberman (JIRA) PALKOVNIK (JIRA User) by the way, as a local workaround, you can just change the
The file should be located at: $(brew --prefix)/opt/glib/lib/pkgconfig/gobject-2.0.pc |
Comment by Serhii Mumriak (JIRA) mliberman (JIRA User) yea, I was also going thru `TSCUtility`, did not know about the `Requires.private` in pkg-config (I mean I don't know much about it at all). Also thanks for the workaround, I'll try it today 🙂 |
Comment by Serhii Mumriak (JIRA) mliberman (JIRA User) I tried that workaround with changing the absolute path to just `libffi >= 3.0.0` and the issue is still there. I assume that's the one you've fixed is a different one. UPD. oops, did not remove the file extension and it works correctly. Thanks for fix! |
Comment by Tobias H (JIRA) Hello, I think I've also encountered a similar, maybe the same problem. I think this issue has actually been fixed in the `main` branch of `apple/swift-tools-support-core`: See my post here: https://forums.swift.org/t/possible-bug-regression-with-regards-to-pc-files/42306 |
Attachment: Download
Environment
OS: macOS 10.15.5
Xcode 11.4/11.5
Additional Detail from JIRA
md5: 93258efbe2740a983119fe6423c1ea6f
Issue Description:
Most of the dev libraries installed via homebrew provide pkg-config configuration files which swift package manager is able to locate and parse in order to get needed linking libraries and C flags to pass to compiler for "system library" targets.
Up till swift 5.1.x shipped with Xcode 11.3.x this worked perfectly fine. Starting from swift 5.2.x shipped with Xcode 11.4 and newer the parser fails to get the needed flags.
One example is the library called "pango".
It can be installed via homebrew (pango has hard dependency on glib):
```
brew install pango glib
```
After that you can inspect that pkg-config file located at `/usr/local/lib/pkgconfig/pango.pc`
I've added a sample project that adds the pango C module. Hit `swift build -v` and you can easily the the error on newer swift vesions:
a warning saying "warning: you may be able to install pango using your system-packager: brew install pango glib"
a compilation error saying "error: 'pango/pango.h' file not found".
None of this happens with swift 5.1.
Also this is a macOS specific issue - linux runs fine up to 5.2.4.
The text was updated successfully, but these errors were encountered: