Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 297243 - sys-fs/e2fsprogs: build fails with C99 standard
Summary: sys-fs/e2fsprogs: 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 normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 297436
  Show dependency tree
 
Reported: 2009-12-17 00:41 UTC by Andrew Jeffery
Modified: 2012-11-01 17:26 UTC (History)
2 users (show)

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


Attachments
Explicitly set -std=gnu89 for compilers with alternate defaults (e2fsprogs-1.41.9-force-gnu89.patch,461 bytes, patch)
2009-12-17 00:47 UTC, Andrew Jeffery
Details | Diff
Explicitly set -std=gnu89 for compilers with alternate defaults (e2fsprogs-1.41.9-force-gnu89-v2.patch,407 bytes, patch)
2009-12-17 02:02 UTC, Andrew Jeffery
Details | Diff
Fixes e2fsprogs to compile with C99 inline rules (e2fsprogs-1.41.9-c99-inline-fixes.patch,13.01 KB, patch)
2009-12-22 02:22 UTC, Andrew Jeffery
Details | Diff
Add epatch call for C99 inline fixes (e2fsprogs-1.41.9-ebuild.patch,558 bytes, patch)
2009-12-22 02:24 UTC, Andrew Jeffery
Details | Diff
Fixes e2fsprogs to compile with C99 inline rules v2 (e2fsprogs-1.41.9-c99-inline-fixes.patch,13.54 KB, patch)
2009-12-24 01:33 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 00:41:54 UTC
sys-fs/e2fsprogs 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. This patch explicitly sets GNU89 mode to successfully build e2fsprogs with Clang

Reproducible: Always

Steps to Reproduce:
1. $ CC=/path/to/clang emerge -av --oneshot sys-fs/e2fsprogs
Actual Results:  
e2fsprogs fails to link due to duplicate function definitions

Expected Results:  
e2fsprogs to build and install correctly
Comment 1 Andrew Jeffery 2009-12-17 00:47:06 UTC
Created attachment 213253 [details, diff]
Explicitly set -std=gnu89 for compilers with alternate defaults
Comment 2 Andrew Jeffery 2009-12-17 00:54:24 UTC
Ah - forgot to mention this applies to e2fsprogs-1.41.9.ebuild (maybe earlier versions, I didn't test that though)
Comment 3 Andrew Jeffery 2009-12-17 01:24:28 UTC
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 4 Andrew Jeffery 2009-12-17 02:02:59 UTC
Created attachment 213255 [details, diff]
Explicitly set -std=gnu89 for compilers with alternate defaults

Fixed the patch so it actually applies
Comment 5 SpanKY gentoo-dev 2009-12-18 15:16:08 UTC
erm, let's fix the problems instead of ignoring them
Comment 6 Andrew Jeffery 2009-12-22 02:22:17 UTC
Created attachment 213717 [details, diff]
Fixes e2fsprogs to compile with C99 inline rules

Patch for e2fsprogs to build with GCC and Clang out of the box: Deals with the difference between GNU and C99 inlining styles. Tested (make check) on amd64 at -O2 with:

* gcc (Gentoo 4.3.4 p1.0, pie-10.1.5) 4.3.4
* clang version 1.1 (trunk 91240)

Tested at all optimisation levels (not specified, -O0 -> -O3) with:

* gcc (Gentoo 4.4.2 p1.0) 4.4.2
* clang version 1.0 (https://llvm.org/svn/llvm-project/cfe/branches/release_26 exported).

Ebuild patch following
Comment 7 Andrew Jeffery 2009-12-22 02:24:33 UTC
Created attachment 213719 [details, diff]
Add epatch call for C99 inline fixes

e2fsprogs-1.41.9.ebuild patch to include C99 inline fixes.
Comment 8 Andrew Jeffery 2009-12-24 01:33:47 UTC
Created attachment 214006 [details, diff]
Fixes e2fsprogs to compile with C99 inline rules v2

New patch attached. One thing that isn't taken into account with the original is when GCC started defining __GNUC_GNU_INLINE__, which turns out to be from v4.1.3. The original patch therefore isn't correct when compiling with GCC versions < 4.1.3. This patch corrects this by defining __GNUC_GNU_INLINE__ when __GNUC__ is defined but neither __GNUC_GNU_INLINE__ or __GNUC_STDC_INLINE__ are, catering for the behaviour of GCC < 4.1.3. Patch tested and working (builds and passes `make check') on AMD64 at all levels of optimisation (not specified, -O0 -> -O3) using:

* gcc-3.4.6
* gcc-4.3.2
* gcc-4.3.4
* gcc-4.4.2
* clang-1.0
* clang-svn
Comment 9 Jack Todaro 2012-11-01 11:34:25 UTC
I just built sys-fs/e2fsprogs using:

sudo CC=/usr/bin/clang emerge -av1 sys-fs/e2fsprogs

The whole emerge process went smoothly, besides a few warnings from clang. I haven't done any 'testing' further than invoking the e2fsck binary to print its usage options (let me know if anything useful needs to be done and I'll see what I can do), but other than that, this issue seems fixed from my point of view.