Compiling libhx-2.2 with the hardened x86_64-pc-linux-gnu-3.4.6 gcc fails with this error: mc.c: In function `HXmc_memcpy': mc.c:58: warning: implicit declaration of function `__builtin_offsetof' mc.c:58: error: syntax error before "struct" mc.c: In function `HXmc_length': mc.c:58: warning: redundant redeclaration of '__builtin_offsetof' mc.c:58: warning: previous implicit declaration of '__builtin_offsetof' was here mc.c:87: error: syntax error before "struct" mc.c: In function `HXmc_setlen': mc.c:58: warning: redundant redeclaration of '__builtin_offsetof' mc.c:58: warning: previous implicit declaration of '__builtin_offsetof' was here mc.c:98: error: syntax error before "struct" mc.c: In function `HXmc_trunc': mc.c:58: warning: redundant redeclaration of '__builtin_offsetof' mc.c:58: warning: previous implicit declaration of '__builtin_offsetof' was here mc.c:105: error: syntax error before "struct" mc.c: In function `HXmc_memcat': mc.c:58: warning: redundant redeclaration of '__builtin_offsetof' mc.c:58: warning: previous implicit declaration of '__builtin_offsetof' was here mc.c:128: error: syntax error before "struct" mc.c: In function `HXmc_memins': mc.c:58: warning: redundant redeclaration of '__builtin_offsetof' mc.c:58: warning: previous implicit declaration of '__builtin_offsetof' was here mc.c:176: error: syntax error before "struct" mc.c: In function `HXmc_memdel': mc.c:58: warning: redundant redeclaration of '__builtin_offsetof' mc.c:58: warning: previous implicit declaration of '__builtin_offsetof' was here mc.c:198: error: syntax error before "struct" mc.c: In function `HXmc_free': mc.c:58: warning: redundant redeclaration of '__builtin_offsetof' mc.c:58: warning: previous implicit declaration of '__builtin_offsetof' was here mc.c:216: error: syntax error before "struct" make[1]: *** [mc.lo] Error 1 libHX-2.2 uses __builtin_offsetof which is not available in gcc < 3.5. This gives problems on hardened because the current stable version of gcc for hardened is 3.4.6. Simple patch to fix this follows... Reproducible: Always Steps to Reproduce: 1. emerge =sys-libs/libhx-2.2 under Gentoo Hardened 2. 3.
Created attachment 177971 [details, diff] Fixes compile error with gcc < 3.5
Hmm, I'm unsure if we really should fix issues with such old compiler versions (gcc 4.0 has been released four years ago). Though it seems it doesn't really hurt, can you try sending that patch upstream and see if it get's accepted?
Should be fixed within 2.3, please test.
I also expierenced this bug and I would submit it again as this bug is marked as fixed but is still unifixed in the portage tree. I won't be too optimistic for gcc 4.x and Gentoo. It really makes sense to fix those bugs when we can't even tell in what timeframe we get gcc 4.x for everything.
It is fixed in version 2.3. Thanks!