[cfe-dev] Error in xmmintrin.h with Clang and LLVM 3.1 built from RELEASE_31 tag.

Chandler Carruth chandlerc at google.com
Wed May 23 02:06:43 PDT 2012


On Tue, May 22, 2012 at 10:29 PM, Eli Friedman <eli.friedman at gmail.com>wrote:

> On Tue, May 22, 2012 at 9:28 PM, Gabe Rives-Corbett
> <gabe at gaberivescorbett.com> wrote:
> > Hello,
> >
> > I built Clang and LLVM 3.1 on OS X using the following configure command:
> >
> > configure --with-gcc-toolchain=/opt/local/ --prefix=/opt/clang-3.1/
> > --enable-targets=x86_64,x86 --enable-optimized
> >
> > the reason for the gcc-tolchain location is to use the macports gcc 4.6
> > libstdc++ in order to support more of C++11.  I also made the following
> > changes to InitHeaderSearch::AddDefaultCIncludePaths:
> >
> > void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple
> &triple,
> >                                             const HeaderSearchOptions
> > &HSOpts) {
> >   llvm::Triple::OSType os = triple.getOS();
> >
> >   if (HSOpts.UseStandardSystemIncludes) {
> >     switch (os) {
> >     case llvm::Triple::FreeBSD:
> >     case llvm::Triple::NetBSD:
> >       break;
> >     default:
> >       // FIXME: temporary hack: hard-coded paths.
> >       //AddPath("/usr/local/include", System, true, false, false);
> >
> >       AddPath("/opt/local/include/gcc46/c++", System, true, false,
> false);
> >  AddPath("/opt/local/include/gcc46/c++/x86_64-apple-darwin11/.", System,
> > true, false, false);
> >       AddPath("/opt/local/include/gcc46/c++/backward/", System, true,
> false,
> > false);
> >
> > AddPath("/opt/local/lib/gcc46/gcc/x86_64-apple-darwin11/4.6.3/include",
> > System, true, false, false);
> >       AddPath("/usr/local/include", System, true, false, false);
> >
> >
> AddPath("/opt/local/lib/gcc46/gcc/x86_64-apple-darwin11/4.6.3/include-fixed",
> > System, true, false, false);
> >       AddPath("/usr/include", System, true, false, false);
> >
> >       break;
> >     }
> >   }
> >
> >
> > Then when building a C source file I get the following error:
> >
> > In file included from
> > /System/Library/Frameworks/Carbon.framework/Headers/Carbon.h:20:
> > In file included from
> >
> /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:21:
> > In file included from
> >
> /System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:20:
> > In file included from
> >
> /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:129:
> > In file included from
> >
> /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/DriverServices.h:32:
> > In file included from
> >
> /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:29:
> >
> /opt/local/lib/gcc46/gcc/x86_64-apple-darwin11/4.6.3/include/xmmintrin.h:102:10:
> > error: invalid conversion between vector type '__m128' and integer type
> > 'int' of different size
> >
> > Any ideas?
>
> Adding "/opt/local/lib/gcc46/gcc/x86_64-apple-darwin11/4.6.3/include/"
> to your include paths is a bad idea.


To expand on this a bit:

By adding this header search path, you are telling Clang to look into GCC's
*internal* headers. These headers are written directly against the
implementation details of GCC at the precise version they ship with GCC.
Clang won't be able to parse these because it's implementation details are
significantly different. Because of this Clang ships with its own internal
headers, including 'xmmintrin.h', which are implemented using *Clang's*
implementation details.

These headers are in a different fundamental group from the "system"
headers, these are "builtin" headers. That is, they are considered to be
built into the compiler itself, and not a separable entity. As such, they
cannot be shared between GCC and Clang, unlike the system headers of
libstdc++ or Linux in general.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120523/7005d0e6/attachment.html>


More information about the cfe-dev mailing list