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

[SR-2481] SwiftPM pkgconfig Cflags whitelist prevents MySQL client import #5229

Closed
swift-ci opened this issue Aug 25, 2016 · 4 comments
Closed
Labels

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-2481
Radar rdar://problem/28171331
Original Reporter badthing (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Environment

Homebrew installed MySQL 5.6. Ubuntu apt installed MySQL client 5.7.

Additional Detail from JIRA
Votes 9
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: ec1b505e3ef97c3584ba5334306e1e6b

duplicates:

  • SR-4195 omit frame pointer is not whitelisted

Issue Description:

This occurs on macOS when using a Homebrew installed MySQL 5.6 and on Ubuntu when using an apt installed MySQL client 5.7. These installations properly place a pkgconfig file which SPM is able to locate. However, these pkgconfig files utilize Cflags which are not white listed by SPM, thus building against them fails with the following:

error: nonWhitelistedFlags("Non whitelisted flags found: ["-fabi-version=2", "-fno-omit-frame-pointer"] in pc file mysqlclient")

The only way to complete the build is to edit the pc files; a suboptimal solution.

Whether or not MySQL client has any real need or business specifying these flags, I do not know, but at this point MySQL client is not usable from Swift "out of the box".

The Cflags in question are:

ubuntu: -fabi-version=2, -fno-omit-frame-pointer
macOS: -fno-omit-frame-pointer

@swift-ci
Copy link
Contributor Author

Comment by emlai (JIRA)

The same underlying issue with the SDL2 library: "Non whitelisted flags found: ["-D_THREAD_SAFE"] in pc file sdl2"

@swift-ci
Copy link
Contributor Author

swift-ci commented Dec 1, 2016

Comment by C0deH4cker (JIRA)

I believe this can be solved simply by modifying the single line here: https://github.com/apple/swift-package-manager/blob/master/Sources/PackageLoading/Module%2BPkgConfig.swift#L135. I would make the change and propose a pull request myself, though I can't get it to build on my machine due to an assertion failure in the swift compiler (ugh).

If "-f" and "-D" are added as whitelisted prefixes for CFLAGS, then both SDL and MySQL client should build correctly. Honestly though, I'm not sure what the point of having a whitelist is here, since the "whitelist" allows anything with the correct prefixes and doesn't even properly separate CFLAGS from LDFLAGS. My recommendation would be to remove the whitelist altogether.

@swift-ci
Copy link
Contributor Author

swift-ci commented Mar 8, 2017

Comment by Helge Heß (JIRA)

I have the same issue with ` /usr/lib/pkgconfig/apr-1.pc` (`-DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -DDARWIN_10`).

@swift-ci
Copy link
Contributor Author

Comment by Pop Flamingo (JIRA)

I encountered the same issue and did a PR to try to fix it : #1827

Don't hesitate to comment it if you have any feedback.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant