Build failure with compiler-rt on trunk under linux

I've been building clang on linux for a couple of years now, contributing to the testing on Ubuntu, but this one has me stumped:

fatal error: 'asm/socket.h' file not found
#include <asm/socket.h>

[1556/4006] Building CXX object projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.i386.dir/sanitizer_platform_limits_posix.cc.o
FAILED: /usr/local/bin/clang++-3.6 -DSANITIZER_NEEDS_SEGV=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -fcolor-diagnostics -ffunction-sections -fdata-sections -Wall -std=c++11 -O3 -DNDEBUG -Iprojects/compiler-rt/lib/sanitizer_common -I/home/ben/development/llvm/trunk/llvm/projects/compiler-rt/lib/sanitizer_common -Iinclude -I/home/ben/development/llvm/trunk/llvm/include -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -fcolor-diagnostics -ffunction-sections -fdata-sections -Wall -std=c++11 -m32 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-function-sections -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -Wframe-larger-than=512 -Wglobal-constructors -MMD -MT projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.i386.dir/sanitizer_platform_limits_posix.cc.o -MF projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.i386.dir/sanitizer_platform_limits_posix.cc.o.d -o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.i386.dir/sanitizer_platform_limits_posix.cc.o -c /home/ben/development/llvm/trunk/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
In file included from /home/ben/development/llvm/trunk/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:31:
In file included from /usr/include/arpa/inet.h:22:
In file included from /usr/include/netinet/in.h:23:
In file included from /usr/include/sys/socket.h:38:
/usr/include/bits/socket.h:345:10: fatal error: 'asm/socket.h' file not found
#include <asm/socket.h>

clang++-3.6 -E -x c++ - -v < /dev/null
clang version 3.6.0 (tags/RELEASE_360/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
"/home/ben/opt/chroots/default-ubuntu-14.04/home/development/llvm/3.6.0/final/Phase3/Release/llvmCore-3.6.0-final.install/bin/clang" -cc1 -triple x86_64-unknown-linux-gnu -E -disable-free -disable-llvm-verifier -main-file-name - -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.24 -v -dwarf-column-info -resource-dir /home/ben/opt/chroots/default-ubuntu-14.04/home/development/llvm/3.6.0/final/Phase3/Release/llvmCore-3.6.0-final.install/bin/../lib/clang/3.6.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward -internal-isystem /usr/local/include -internal-isystem /home/ben/opt/chroots/default-ubuntu-14.04/home/development/llvm/3.6.0/final/Phase3/Release/llvmCore-3.6.0-final.install/bin/../lib/clang/3.6.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/ben/development/llvm/trunk/build/release -ferror-limit 19 -fmessage-length 192 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o - -x c++ -
clang -cc1 version 3.6.0 based upon LLVM 3.6.0 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9"
#include "..." search starts here:
#include <...> search starts here:
  /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
  /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
  /usr/local/include
/home/ben/opt/chroots/default-ubuntu-14.04/home/development/llvm/3.6.0/final/Phase3/Release/llvmCore-3.6.0-final.install/bin/../lib/clang/3.6.0/include
  /usr/include/x86_64-linux-gnu
  /usr/include
End of search list.
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 320 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2

ls -alh /usr/include/x86_64-linux-gnu/asm/socket.h
-rw-r--r-- 1 root root 32 Mar 3 03:16 /usr/include/x86_64-linux-gnu/asm/socket.h

This is my configure line: cmake -GNinja -DCMAKE_C_COMPILER=clang-3.6 -DCMAKE_CXX_COMPILER=clang++-3.6 -DCMAKE_BUILD_TYPE=Release -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_LIBCXXABI_INCLUDE_PATHS=../../llvm/projects/libcxxabi/include -DLIT_EXECUTABLE=../../llvm/utils/lit/lit.py ../../llvm/

This has only been a problem with trunk since a little after it was switched to 3.7.

Thanks in advance for any ideas.

Ben

Hmmm, posting this message to the list seems to have magically fixed it.

Or perhaps bumping my binutils version.

Ben

I'm still having this problem... this time on a different machine, ideas are still welcome.

I can't compile with clang-3.6 or the native compiler (g++ 4.9.2), the asm directory doesn't seem to be in the include path.

I have a checkout of trunk, all in source with llvm

These are my commands:
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
svn co http://llvm.org/svn/llvm-project/cfe/trunk llvm/tools/clang
svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk llvm/tools/clang/tools/extra
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk llvm/projects/compiler-rt
svn co http://llvm.org/svn/llvm-project/lld/trunk llvm/tools/lld
svn co http://llvm.org/svn/llvm-project/lldb/trunk llvm/tools/lldb
svn co http://llvm.org/svn/llvm-project/polly/trunk llvm/tools/polly
svn co http://llvm.org/svn/llvm-project/libcxx/trunk llvm/projects/libcxx
svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk llvm/projects/libcxxabi
mkdir -p build/release
cd build/release
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_LIBCXXABI_INCLUDE_PATHS=../../llvm/projects/libcxxabi/include -DLIT_EXECUTABLE=../../llvm/utils/lit/lit.py -DLLVM_CONFIG_PATH=../../llvm/tools.llvm-config -DCMAKE_C_COMPILER=clang-3.6 -DCMAKE_CXX_COMPILER=clang++-3.6 -DCMAKE_PREFIX_PATH=../../install/release ../../llvm/
ninja compiler-rt

...
/home/ben/development/llvm/trunk/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cc:31:10: fatal error: 'asm/posix_types.h' file not found
#include <asm/posix_types.h>

Does anybody have any ideas?

Thanks,

Ben

Info:

FAILED: /usr/local/bin/clang++-3.6 -DSANITIZER_NEEDS_SEGV=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -fcolor-diagnostics -ffunction-sections -fdata-sections -Wall -std=c++11 -O3 -DNDEBUG -Iprojects/compiler-rt/lib/sanitizer_common -I/home/ben/development/llvm/trunk/llvm/projects/compiler-rt/lib/sanitizer_common -Iinclude -I/home/ben/development/llvm/trunk/llvm/include -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -fcolor-diagnostics -ffunction-sections -fdata-sections -Wall -std=c++11 -m32 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-function-sections -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -Wframe-larger-than=512 -Wglobal-constructors -MMD -MT projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.i386.dir/sanitizer_platform_limits_posix.cc.o -MF projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.i386.dir/sanitizer_platform_limits_posix.cc.o.d -o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.i386.dir/sanitizer_platform_limits_posix.cc.o -c /home/ben/development/llvm/trunk/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
In file included from /home/ben/development/llvm/trunk/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:31:
In file included from /usr/include/arpa/inet.h:22:
In file included from /usr/include/netinet/in.h:23:
In file included from /usr/include/sys/socket.h:38:
/usr/include/bits/socket.h:345:10: fatal error: 'asm/socket.h' file not found

$ clang++-3.6 -E -x c++ - -v < /dev/null
clang version 3.6.0 (tags/RELEASE_360/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.2
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.0.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
"/home/ben/development/llvm/trunk/final/Phase3/Release/llvmCore-3.6.0-final.install/bin/clang" -cc1 -triple x86_64-unknown-linux-gnu -E -disable-free -disable-llvm-verifier -main-file-name - -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.25 -v -dwarf-column-info -resource-dir /home/ben/development/llvm/trunk/final/Phase3/Release/llvmCore-3.6.0-final.install/bin/../lib/clang/3.6.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward -internal-isystem /usr/local/include -internal-isystem /home/ben/development/llvm/trunk/final/Phase3/Release/llvmCore-3.6.0-final.install/bin/../lib/clang/3.6.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/ben/development/llvm/trunk/build/release -ferror-limit 19 -fmessage-length 160 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o - -x c++ -
clang -cc1 version 3.6.0 based upon LLVM 3.6.0 default target x86_64-unknown-linux-gnu
ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9"
#include "..." search starts here:
#include <...> search starts here:
  /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
  /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
  /usr/local/include
/home/ben/development/llvm/trunk/final/Phase3/Release/llvmCore-3.6.0-final.install/bin/../lib/clang/3.6.0/include
  /usr/include/x86_64-linux-gnu
  /include
  /usr/include
End of search list.
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 320 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2

$ lls -alh /usr/include/x86_64-linux-gnu/asm/socket.h
-rw-r--r-- 1 root root 32 Mar 10 22:14 /usr/include/x86_64-linux-gnu/asm/socket.h

What is the version of you linux distribution?

What is the version of you linux distribution?

Ubuntu Vivid, but the first time I posted, it was for Trusty.

Ben

What is the version of you linux distribution?

Ubuntu Vivid, but the first time I posted, it was for Trusty.

Frankly, no idea what's wrong here.
We don't test on Vivid yet, but Trusty is our primary platform.
I don't remember this kind of failure on Trusty or any requirement to
install any special packages to have asm/posix_types.h,
which seems to be coming from the linux-headers-3.13.0-46 package.
Is your Trusty a vanilla installation?

--kcc

Yeah, I run the tests and upload the binary for it. Mostly, I wonder if installing the gcc-5 snapshot broke it? Trusty is working fine now, I’ll try to remove gcc-5 from Vivid, but that’s not easy. Ben