The get_kheader_version() function in sys-libs/glibc/files/eblits/src_unpack.eblit seems to be incompatible with sys-devel/clang . This causes problems when trying to use clang as a system compiler. Reproducible: Always Steps to Reproduce: 1. emerge clang 2. CC=clang CPP="clang -E" emerge -1 sys-libs/glibc Actual Results: (...) * Checking linux-headers version (0.0.0 >= 2.6.16) ... [ !! ] * You need linux-headers of at least 2.6.16 for NPTL support! * ERROR: sys-libs/glibc-2.17::gentoo failed (unpack phase): * linux-headers version too low! (...) Expected Results: Everything "just works". The following patch seems to solve the issue for me, although I only tried with clang-3.3-r100 and gcc-4.8.1 . It is possible it will not work as well with other versions of either compiler, necessitating different checks based on compiler (or a different approach altogether). diff --git a/sys-libs/glibc/files/eblits/src_unpack.eblit b/sys-libs/glibc/files/eblits/src_unpack.eblit index 52f22f9..c397a73 100644 --- a/sys-libs/glibc/files/eblits/src_unpack.eblit +++ b/sys-libs/glibc/files/eblits/src_unpack.eblit @@ -17,7 +17,7 @@ eend_KV() { get_kheader_version() { printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \ - $(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" | \ + $(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \ For reference, a more minimal reproduction of the issue: eroen@occam ~ $ printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | x86_64-pc-linux-gnu-cpp -I /usr/include/ # 1 "<stdin>" # 1 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 1 "<command-line>" 2 # 1 "<stdin>" # 1 "/usr/include/linux/version.h" 1 3 4 # 2 "<stdin>" 2 199424 eroen@occam ~ $ printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | clang -E -I /usr/include/ clang: error: no input files eroen@occam ~ $ printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | x86_64-pc-linux-gnu-cpp -I /usr/include/ - # 1 "<stdin>" # 1 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 1 "<command-line>" 2 # 1 "<stdin>" # 1 "/usr/include/linux/version.h" 1 3 4 # 2 "<stdin>" 2 199424 eroen@occam ~ $ printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | clang -E -I /usr/include/ - # 1 "<stdin>" # 1 "<built-in>" 1 # 1 "<built-in>" 3 # 159 "<built-in>" 3 # 1 "<command line>" 1 # 1 "<built-in>" 2 # 1 "<stdin>" 2 # 1 "/usr/include/linux/version.h" 1 3 4 # 2 "<stdin>" 2 199424
Created attachment 358840 [details] build.log
last i checked, clang didn't produce a usable glibc. i don't mind committing this change, but if the resulting glibc build doesn't work, that's to be expected.
should be all set now in the tree; thanks for the report! Commit message: Tweak how we check the kernel header version to work w/clang http://sources.gentoo.org/sys-libs/glibc/files/eblits/src_unpack.eblit?r1=1.23&r2=1.24