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-7689] SwiftPM can not handle pkg-config file which contains -D options for cflags at all #4817

Open
omochi opened this issue May 15, 2018 · 3 comments
Labels

Comments

@omochi
Copy link
Contributor

omochi commented May 15, 2018

Previous ID SR-7689
Radar rdar://problem/40257646
Original Reporter @omochi
Type Bug
Environment

macOS High Sierra version 10.13.4
iMac (retina 4K, 21.5-inch, 2017)
Xcode 9.3
Homebrew 1.6.3
imagemagick: stable 7.0.7-31 (bottled)

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

md5: 5af0917f7ede1519c735bf074c4a2f92

Issue Description:

SwiftPM can not handle pkg-config file which contains `-D` options for cflags at all.

In my investigation, `PackageLoading.whitelist` throws `PkgConfigError.nonWhitelistedFlags` if cflags in `*.pc` file contains `-D` style options and `PackageLoading.pkgConfigArgs(for: fileSystem🙂` which is a caller of `whitelist` returns error value of `PkgConfigResult`.

This is problem in a library actually exists.

For example, `MagickWand` distributed by homebrew in mac contains `-D` options.
This is programming interface of `ImageMagick` which is a very famous image processing tool.

$ cat /usr/local/lib/pkgconfig/MagickWand.pc
prefix=/usr/local/Cellar/imagemagick/7.0.7-27
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/ImageMagick-7
includearchdir=/usr/local/Cellar/imagemagick/7.0.7-27/include/ImageMagick-7
libname=MagickWand-7.Q16HDRI
 
Name: MagickWand
Description: MagickWand - C API for ImageMagick (ABI Q16HDRI)
URL: https://www.imagemagick.org
Version: 7.0.7
Requires: MagickCore
Cflags: -I${includearchdir} -I${includedir} -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
Libs: -L${libdir} -l${libname}
Libs.private: -L${libdir} -l${libname}   -L/usr/local/opt/freetype/lib -lfreetype    -lxml2       -L/usr/local/Cellar/xz/5.2.3/lib -llzma -lbz2 -lz -lltdl  -lm      -lm
@ankitspd
Copy link
Member

@swift-ci create

@swift-ci
Copy link
Contributor

Comment by Brian Palmer (JIRA)

This is a problem with SDL2 as well, which has `-D_THREAD_SAFE` in its .pc file CLFAGS.

@swift-ci
Copy link
Contributor

Comment by Tom Sullivan (JIRA)

Also an issue with `osxfuse`:

$ pkg-config --cflags osxfuse

-D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -I/usr/local/include/osxfuse/fuse

@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
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

4 participants