I prepared to setup a symbian development environmont on my gentoo machine. After downloading gnupoc-package-1.15 (http://www.martin.st/symbian/) and begin to install. It breaks by compiling libelf-elftoolchain of the elf2e32 tool. The maintainer of the package shows a lot of engagement to find the source of the problem (big thanks again to him). It would be the easiest to post their last email that points out the problem: === Ah, here's the problem. The official glibc doesn't have this definition in this header, the gentoo developers have copied additional items into this header from FreeBSD, see http://bugs.gentoo.org/201979. This patch is in http://dev.gentoo.org/~vapier/dist/glibc-2.11-patches-1.tar.bz2. The problem here is that this defines STAILQ_LAST to use __offsetof. In FreeBSD, __offsetof is defined in some way so that it is usable, but this definition isn't available on linux. So, this header should either be updated to use plain "offsetof" (which is ANSI C, defined in stddef.h), or __offsetof should be defined in some way. The libelf-elftoolchain code checks for STAILQ_LAST - if the system has it defined, it uses that instead, otherwise it uses its own definition as a fallback. Either way, this is your distribution shipping broken headers. === IMHO: If the gentoo patches introduce a macro for STAILQ_LAST it should be ensured that the macro is working. Reproducible: Always Steps to Reproduce:
Created attachment 222019 [details] A simple testcase to point out the problem
I suggest changing the summary of the bug report to "sys-libs/glibc: gentoo patches use undefined __offsetof in sys/queue.h". The attached testcase stailq.c is a condensed example of what's happening in this case. Portable code includes sys/queue.h and uses the definitions found there, if they're available, otherwise supplies its own definition of some macros. Normal glibc sys/queue.h doesn't contain a definition of STAILQ_LAST, but the gentoo patched version does. The version in gentoo sys/queue.h is copied verbatim from freebsd, and uses __offsetof, which is defined elsewhere on BSD systems, but not on gentoo. I suggest to simply change __offsetof into offsetof (which to my knowledge is a standard C feature since about C90) in this function macro.
Confirmed on a stable x86 system with sys-libs/glibc-2.10.1-r1.
changed to offsetof http://sources.gentoo.org/gentoo/src/patchsets/glibc/2.7/1010_all_glibc-queue-header-updates.patch?r1=1.1&r2=1.2 http://sources.gentoo.org/gentoo/src/patchsets/glibc/2.8/1010_all_glibc-queue-header-updates.patch?r1=1.1&r2=1.2 http://sources.gentoo.org/gentoo/src/patchsets/glibc/2.9/1010_all_glibc-queue-header-updates.patch?r1=1.1&r2=1.2 http://sources.gentoo.org/gentoo/src/patchsets/glibc/2.10.1/1010_all_glibc-queue-header-updates.patch?r1=1.1&r2=1.2 http://sources.gentoo.org/gentoo/src/patchsets/glibc/2.11/1010_all_glibc-queue-header-updates.patch?r1=1.1&r2=1.2