/panfs/scratch3/vol10/junghans/gentoo-prefix/var/tmp/portage/sys-devel/llvm-3.4/work/llvm-3.4-amd64/Release/bin/clang -fno-exceptions -fPIC -funwind-tables -I/panfs/scratch3/vol10/junghans/gentoo-prefix/var/tmp/portage/sys-devel/llvm-3.4/work/llvm-3.4/projects/compiler-rt/lib -I/panfs/scratch3/vol10/junghans/gentoo-prefix/var/tmp/portage/sys-devel/llvm-3.4/work/llvm-3.4/projects/compiler-rt/include -Wall -Werror -O3 -fomit-frame-pointer -m64 -fPIE -fno-builtin -gline-tables-only -fno-rtti -c -o /panfs/scratch3/vol10/junghans/gentoo-prefix/var/tmp/portage/sys-devel/llvm-3.4/work/llvm-3.4-amd64/tools/clang/runtime/compiler-rt/clang_linux/san-x86_64/x86_64/SubDir.lib__sanitizer_common/sanitizer_stacktrace.o /panfs/scratch3/vol10/junghans/gentoo-prefix/var/tmp/portage/sys-devel/llvm-3.4/work/llvm-3.4/projects/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc /panfs/scratch3/vol10/junghans/gentoo-prefix/var/tmp/portage/sys-devel/llvm-3.4/work/llvm-3.4/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cc:56:10: fatal error: 'linux/perf_event.h' file not found #include <linux/perf_event.h> ^ 1 error generated. make[5]: *** [/panfs/scratch3/vol10/junghans/gentoo-prefix/var/tmp/portage/sys-devel/llvm-3.4/work/llvm-3.4-amd64/tools/clang/runtime/compiler-rt/clang_linux/san-x86_64/x86_64/SubDir.lib__sanitizer_common/sanitizer_platform_limits_linux.o] Error 1 Basically the linux headers of the host are used instead of the one from prefix. Adding something like: if use clang && use prefix; then sed -e '/^CFLAGS /s@$@'" -I${EPREFIX}/usr/include@" \ -i 'projects/compiler-rt/make/platform/clang_linux.mk' || die fi to src_prepare should help. We could put that into a clang patch too and add clang_linux.mk to sub_files. Appending '-I${EPREFIX}/usr/include' to CPPFLAGS don't help as these flags are ignored when lib_sanitizer is build.
+ 14 Apr 2014; Christoph Junghans <ottxor@gentoo.org> llvm-3.4-r2.ebuild, + llvm-9999.ebuild: + add prefix include path for kernel headers (bug #505908) +