Bug#645731: clang uses gcc header files, but cannot handle some of them
Miles Bader
miles at gnu.org
Tue Oct 18 07:01:03 UTC 2011
Package: clang
Version: 2.9-16
Severity: normal
Clang seems to use header files which are distributed with gcc (from
the system's default installation of gcc?). However, it cannot handle
some of the constructs in them.
Here's a sample source file, "cb.cc":
#include <emmintrin.h>
If I compile it with "clang++ -c cb.cc", it spews out errors,
apparently due to __builtin constructs that clang doesn't know about:
In file included from cb.cc:1:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.6/include/emmintrin.h:36:
/usr/lib/gcc/x86_64-linux-gnu/4.6/include/xmmintrin.h:102:19: error: use of undeclared identifier '__builtin_ia32_addss'
return (__m128) __builtin_ia32_addss ((__v4sf)__A, (__v4sf)__B);
^
/usr/lib/gcc/x86_64-linux-gnu/4.6/include/xmmintrin.h:108:19: error: use of undeclared identifier '__builtin_ia32_subss'
return (__m128) __builtin_ia32_subss ((__v4sf)__A, (__v4sf)__B);
^
/usr/lib/gcc/x86_64-linux-gnu/4.6/include/xmmintrin.h:114:19: error: use of undeclared identifier '__builtin_ia32_mulss'
return (__m128) __builtin_ia32_mulss ((__v4sf)__A, (__v4sf)__B);
[...etc...]
I don't know whether <emmintrin.h> is something a user is _supposed_
to be able to include, but the above example isn't artificial; it
comes from "llvm/tools/clang/lib/Lex/Lexer.cpp" in the llvm+clang
source tree, which contains the following bit of code:
#ifdef __SSE2__
#include <emmintrin.h>
#elif __ALTIVEC__
#include <altivec.h>
#undef bool
#endif
soooo, the result is that now I can't compile the clang trunk using
the system clang (which is the compiler llvm choose by default if it
can)...
I'm not sure the right way to fix this, but it seems that if clang is
going to use gcc-specific headers, it should maybe have some sort of
fairly specific versioned dependency on gcc, so upstream "internal"
gcc changes don't confuse clang.
Installed gcc:
$ dpkg-query --show gcc
gcc 4:4.6.1-3
$ dpkg-query --show gcc-4.6
gcc-4.6 4.6.1-15
Thanks,
-Miles
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (50, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 3.0.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages clang depends on:
ii libc6 2.13-21
ii libffi5 3.0.10-3
ii libgcc1 1:4.6.1-15
ii libllvm2.9 2.9+dfsg-3
ii libstdc++6 4.6.1-15
ii libstdc++6-4.6-dev 4.6.1-15
Versions of packages clang recommends:
ii llvm-2.9-dev 2.9+dfsg-3
ii python 2.7.2-9
clang suggests no packages.
-- no debconf information
More information about the Pkg-llvm-team
mailing list