Bug 1278

Summary: [PENDING] pkg-config breaks packages that use two or more -framework flags on MacOS X
Product: pkg-config Reporter: Denis de Leeuw Duarte <denisld>
Component: srcAssignee: Dan Nicholson <dbn.lists>
Status: RESOLVED FIXED QA Contact:
Severity: blocker    
Priority: high CC: niederstrasser
Version: unspecified   
Hardware: PowerPC   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: [PATCH] Also match -Wl,-framework for OSX framework

Description Denis de Leeuw Duarte 2004-09-02 12:42:27 UTC
On OS X, gcc has a special -framework flag, which is used to link against
frameworks (frameworks are directories containing ordinary libraries). The
framework flag is a flag with a parameter. pkg-config messes up these flags
because it weeds out duplicates. For instance, if a package links against two
frameworks, Foo and Bar, we get this:

   -framework Foo -framework Bar

..which gets mangled by pkgconfig into:

   -framework Foo Bar

..which gcc will parse as '-framework Foo' with some garbage 'Bar'. 

So, each package that uses pkgconfig on OS X will break if it uses more than one
-framework flag.
Comment 1 Tollef Fog Heen 2005-04-02 01:07:23 UTC
 2005-04-02  Tollef Fog Heen  <tfheen@err.no>

       * parse.c (parse_libs): Handle -framework as a single argument.
       (Freedesktop #1278)

If you could try with the current CVS version, that would be nice.  It seems to
work in my preliminary testing.
Comment 2 Tollef Fog Heen 2005-04-12 04:18:01 UTC
pkg-config 0.17 released; closing bug
Comment 3 Hanspeter Niederstrasser 2013-05-21 11:02:03 UTC
Still broken:

$ cat libcdio.pc 
prefix=/sw
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libcdio
Description: Portable CD-ROM I/O library
Version: 0.79
#Requires: glib-2.0 
Libs: -L${libdir} -lcdio -L/sw/lib -lm  -Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,IOKit
Cflags: -I${includedir}

$ pkg-config --libs libcdio
-L/sw/lib -Wl,-framework -Wl,CoreFoundation -Wl,IOKit -lcdio -lm
Comment 4 Dan Nicholson 2014-09-28 00:11:54 UTC
Created attachment 106975 [details] [review]
[PATCH] Also match -Wl,-framework for OSX framework


Freedesktop #1278 (https://bugs.freedesktop.org/show_bug.cgi?id=1278)
---
 parse.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Comment 5 Dan Nicholson 2014-09-28 00:12:39 UTC
Does the attached patch fix things for you? We were only matching on -framework and not -Wl,-framework.
Comment 6 Dan Nicholson 2016-01-29 22:45:20 UTC
Went ahead and pushed the fix in 8d19fad. Moving back to fixed.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.