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
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
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.
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