Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 297248 - <dev-util/pkgconfig-0.26: build fails with C99 standard
Summary: <dev-util/pkgconfig-0.26: build fails with C99 standard
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: AMD64 Linux
: High enhancement (vote)
Assignee: Freedesktop bugs
URL: http://bugs.freedesktop.org/show_bug....
Whiteboard:
Keywords:
Depends on:
Blocks: 297436
  Show dependency tree
 
Reported: 2009-12-17 01:21 UTC by Andrew Jeffery
Modified: 2011-12-12 19:18 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Explicitly set -std=gnu89 for compilers with alternate defaults (pkgconfig-0.23-force-gnu89.patch,541 bytes, patch)
2009-12-17 01:22 UTC, Andrew Jeffery
Details | Diff
Explicitly set -std=gnu89 for compilers with alternate defaults (pkgconfig-0.23-force-gnu89-v2.patch,542 bytes, patch)
2009-12-17 02:04 UTC, Andrew Jeffery
Details | Diff
Patches the bundled version of glib to compile with C99 inline semantics (pkgconfig-glib-1.2.10-C99-inline-fix.patch,307 bytes, patch)
2009-12-22 12:05 UTC, Andrew Jeffery
Details | Diff
Patches bundled glib in src_unpack() with previously attached patch (pkgconfig-0.23-ebuild.patch,344 bytes, text/plain)
2009-12-22 12:08 UTC, Andrew Jeffery
Details
Patches the bundled version of glib to compile with C99 inline semantics v2 (pkgconfig-glib-1.2.10-C99-inline-fix.patch,502 bytes, patch)
2009-12-23 07:48 UTC, Andrew Jeffery
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Jeffery 2009-12-17 01:21:17 UTC
dev-util/pkgconfig fails to build out of the box using Clang. GCC defaults to
GNU89 and Clang to C99; the standards have differences in the way inlining is
handled. Attempting to compile and link using Clang in C99 mode leads to
failure from duplicate function definitions. 

Reproducible: Always

Steps to Reproduce:
1. $ CC=/path/to/clang emerge -av --oneshot dev-util/pkgconfig
Actual Results:  
pkgconfig fails to link

Expected Results:  
pkgconfig to build and install successfully

This patch explicitly sets GNU89 mode to successfully build pkgconfig with Clang. Applies to pkgconfig-0.23.ebuild, may also work on earlier versions.

Note: In testing whether the patch applies properly I kept getting "malformed patch" errors. The patch is generated with `diff -Nau`, diff version 2.8.7 from diffutils-2.8.7-r2, patch version 2.5.9. I can't see an issue with the patch, but given that it's fairly straight forward it can be easily applied by hand :)
Comment 1 Andrew Jeffery 2009-12-17 01:22:09 UTC
Created attachment 213254 [details, diff]
Explicitly set -std=gnu89 for compilers with alternate defaults
Comment 2 Andrew Jeffery 2009-12-17 02:04:24 UTC
Created attachment 213257 [details, diff]
Explicitly set -std=gnu89 for compilers with alternate defaults

Fixed patch so it actually applies
Comment 3 Rémi Cardona (RETIRED) gentoo-dev 2009-12-19 11:20:36 UTC
IMO, this should be fixed in pkgconfig directly, not in the ebuild.

Thanks
Comment 4 Andrew Jeffery 2009-12-20 00:12:35 UTC
(In reply to comment #3)
> IMO, this should be fixed in pkgconfig directly, not in the ebuild.
> 
> Thanks
> 

Yeah, Vapier said similar in #297243 (e2fsprogs suffers the same issue).

Changed the bug title to describe the problem (not the proposed solution). I'll look into getting pkgconfig itself fixed.
Comment 5 Andrew Jeffery 2009-12-22 12:05:31 UTC
Created attachment 213743 [details, diff]
Patches the bundled version of glib to compile with C99 inline semantics

Attached patch fixes the problem in pkg-config itself. After a little bit of digging it turned out that it was the bundled version of glib that was at fault. Patch tightens up when GNU style inlines are used.

Ebuild patch following
Comment 6 Andrew Jeffery 2009-12-22 12:08:50 UTC
Created attachment 213745 [details]
Patches bundled glib in src_unpack() with previously attached patch

Patch for pkgconfig-0.23.ebuild to apply previously attached patch in src_unpack()
Comment 7 Rémi Cardona (RETIRED) gentoo-dev 2009-12-22 18:22:16 UTC
I tried looking at the current glib to see how they managed this inline business and they've shuffled the code around and the 2 really can't be easily compared anymore.

In any case, if you swear on your first born's life that this change is innocuous for gcc, then ACK from me.

Cheers
Comment 8 Andrew Jeffery 2009-12-23 07:48:32 UTC
Created attachment 213902 [details, diff]
Patches the bundled version of glib to compile with C99 inline semantics v2

New patch attached. I tested the previous version of the patch only with the 4.3 and 4.4 series of GCC (along with Clang), but didnt take into account when the __GNUC_GNU_INLINE__ macro was added to GCC. Turns out this was in v4.1.3, which makes the previous patch invalid when compiling with earlier versions of GCC. This patch defines __GNUC_GNU_INLINE__ when __GNUC__ is defined but neither __GNUC_GNU_INLINE__ or __GNUC_STDC_INLINE__ are by the compiler. This matches the behaviour of GCC versions < 4.1.3. Patch tested and working at all optimisation levels on an AMD64 system using:

* gcc-3.4.6 <- important one in this case.
* gcc-4.3.2
* gcc-4.3.4
* gcc-4.4.2
* clang-1.0
* clang-svn

Essentially I threw it at all the GCCs I currently have installed. I'll test it with further versions of GCC if you like.
Comment 9 Samuli Suominen (RETIRED) gentoo-dev 2010-09-03 13:19:35 UTC
The patch should go into:

http://bugs.freedesktop.org/show_bug.cgi?id=29313

For possible upstream inclusion.

Otherwise this is already solved by the glib-2 branch at upstream pkg-config git, which should become the new master.
Comment 10 Samuli Suominen (RETIRED) gentoo-dev 2011-12-12 19:18:18 UTC
https://bugs.freedesktop.org/show_bug.cgi?id=29313#c2

Closing the bug as resolved by 0.26 since it's using system glib-2 instead of bundled glib-1.