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
Created attachment 213253 [details, diff] Explicitly set -std=gnu89 for compilers with alternate defaults
Ah - forgot to mention this applies to e2fsprogs-1.41.9.ebuild (maybe earlier versions, I didn't test that though)
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 :)
Created attachment 213255 [details, diff] Explicitly set -std=gnu89 for compilers with alternate defaults Fixed the patch so it actually applies
erm, let's fix the problems instead of ignoring them
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
Created attachment 213719 [details, diff] Add epatch call for C99 inline fixes e2fsprogs-1.41.9.ebuild patch to include C99 inline fixes.
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
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.