<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - clang:failed to locate gcc header (gcc 4.8.1-9, libc6-dev: 2.17-92):/usr/include/stdc-predef.h:30:10: fatal error: 'bits/predefs.h' file not found"
   href="http://llvm.org/bugs/show_bug.cgi?id=18281">18281</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang:failed to locate gcc header (gcc 4.8.1-9, libc6-dev: 2.17-92):/usr/include/stdc-predef.h:30:10: fatal error: 'bits/predefs.h' file not found
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>stevchen@ca.ibm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi,

On little-endian PowerPC Debian API 0.2, after building a clang driver (only
-fsyntax-only should be working for now), the driver fails to compile (with
-fsyntax-only) a simple hello world because it cannot locate a gcc header. 

$ ./bin/clang hello.c -MD -MF hello.d -fsyntax-only
In file included from hello.c:1:
In file included from /usr/include/stdio.h:27:
In file included from /usr/include/features.h:341:
/usr/include/stdc-predef.h:30:10: fatal error: 'bits/predefs.h' file not found
#include <bits/predefs.h>
         ^
1 error generated.

$ ./bin/clang hello.c -MD -MF hello.d -v -fsyntax-only
clang version 3.5
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/powerpc64le-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/powerpc64le-linux-gnu/4.8.1
Selected GCC installation: /usr/lib/gcc/powerpc64le-linux-gnu/4.8
 "/home/build/clang/dev/testbld/builds/Release+Asserts/bin/clang" -cc1 -triple
powerpc64le-unknown-linux-gnu -fsyntax-only -disable-free -main-file-name
hello.c -mrelocation-model static -mdisable-fp-elim -fmath-errno
-mconstructor-aliases -fuse-init-array -target-cpu ppc64le
-target-linker-version 2.23.52.20130727 -v -resource-dir
/home/build/clang/dev/testbld/builds/Release+Asserts/bin/../lib/clang/3.5
-dependency-file hello.d -MT hello.o -sys-header-deps -internal-isystem
/usr/local/include -internal-isystem
/home/build/clang/dev/testbld/builds/Release+Asserts/bin/../lib/clang/3.5/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fno-dwarf-directory-asm -fdebug-compilation-dir /build/clang/dev/testbld
-ferror-limit 19 -fmessage-length 260 -mstackrealign -fno-signed-char
-fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-slp -x c hello.c
clang -cc1 version 3.5 based upon LLVM 3.5svn default target
powerpc64le-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include

/home/build/clang/dev/testbld/builds/Release+Asserts/bin/../lib/clang/3.5/include
 /usr/include
End of search list.
In file included from hello.c:1:
In file included from /usr/include/stdio.h:27:
In file included from /usr/include/features.h:341:
/usr/include/stdc-predef.h:30:10: fatal error: 'bits/predefs.h' file not found
#include <bits/predefs.h>
         ^
1 error generated.

The problem appears to be that header exists in GCC's search path ( Clang's
search path doesn't include the ones for

$ gcc hello.c -MD -MF hello.d -fsyntax-only -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc-4.8.real
COLLECT_LTO_WRAPPER=/usr/lib/gcc/powerpc64le-linux-gnu/4.8/lto-wrapper
Target: powerpc64le-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.8.1-9'
--with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++ --prefix=/usr --program-suffix=-4.8 --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--disable-libitm --disable-libsanitizer --disable-libquadmath --enable-plugin
--with-system-zlib --disable-libstdcxx-pch --enable-multiarch
--enable-checking=release --build=powerpc-linux-gnu
--host=powerpc64le-linux-gnu --target=powerpc64le-linux-gnu
Thread model: posix
gcc version 4.8.1 (Debian 4.8.1-9)
COLLECT_GCC_OPTIONS='-MD' '-MF' 'hello.d' '-fsyntax-only' '-v'
 /usr/lib/gcc/powerpc64le-linux-gnu/4.8/cc1 -quiet -v -imultilib . -imultiarch
powerpc64le-linux-gnu -MD hello.d -MF hello.d -D__unix__ -D__gnu_linux__
-D__linux__ -Dunix -D__unix -Dlinux -D__linux -Asystem=linux -Asystem=unix
-Asystem=posix hello.c -mstrict-align -quiet -dumpbase hello.c -auxbase hello
-version -fsyntax-only -o /dev/null
GNU C (Debian 4.8.1-9) version 4.8.1 (powerpc64le-linux-gnu)
        compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version
3.1.1-p2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/powerpc64le-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../../powerpc64le-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/powerpc64le-linux-gnu/4.8/include
 /usr/local/include
 /usr/lib/gcc/powerpc64le-linux-gnu/4.8/include-fixed
 /usr/include/powerpc64le-linux-gnu
 /usr/include
End of search list.
GNU C (Debian 4.8.1-9) version 4.8.1 (powerpc64le-linux-gnu)
        compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version
3.1.1-p2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: cf7ad25c9941681a43c8ed34c329e1f7
COMPILER_PATH=/usr/lib/gcc/powerpc64le-linux-gnu/4.8/:/usr/lib/gcc/powerpc64le-linux-gnu/4.8/:/usr/lib/gcc/powerpc64le-linux-gnu/:/usr/lib/gcc/powerpc64le-linux-gnu/4.8/:/usr/lib/gcc/powerpc64le-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/powerpc64le-linux-gnu/4.8/:/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../powerpc64le-linux-gnu/:/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../:/lib/powerpc64le-linux-gnu/:/lib/:/usr/lib/powerpc64le-linux-gnu/:/usr/lib/
COLLECT_GCC_OPTIONS='-MD' '-MF' 'hello.d' '-fsyntax-only' '-v'

$ cat hello.d
hello.o: hello.c /usr/include/stdc-predef.h \
 /usr/include/powerpc64le-linux-gnu/bits/predefs.h /usr/include/stdio.h \
 /usr/include/features.h /usr/include/powerpc64le-linux-gnu/sys/cdefs.h \
 /usr/include/powerpc64le-linux-gnu/bits/wordsize.h \
 /usr/include/powerpc64le-linux-gnu/gnu/stubs.h \
 /usr/include/powerpc64le-linux-gnu/gnu/stubs-64-v2.h \
 /usr/lib/gcc/powerpc64le-linux-gnu/4.8/include/stddef.h \
 /usr/include/powerpc64le-linux-gnu/bits/types.h \
 /usr/include/powerpc64le-linux-gnu/bits/typesizes.h /usr/include/libio.h \
 /usr/include/_G_config.h /usr/include/wchar.h \
 /usr/lib/gcc/powerpc64le-linux-gnu/4.8/include/stdarg.h \
 /usr/include/powerpc64le-linux-gnu/bits/stdio_lim.h \
 /usr/include/powerpc64le-linux-gnu/bits/sys_errlist.h

The FAILING OS is Linux Debian Little Endian ABI 0.2
with stdc-predef.h from libc6-dev 2.17-92
$ dpkg -S /usr/include/stdc-predef.h
libc6-dev:ppc64el: /usr/include/stdc-predef.h
$ dpkg-query -l|grep libc6-dev
ii  libc6-dev:ppc64el                 2.17-92                  ppc64el     
Embedded GNU C Library: Development Libraries and Header Files

This is PASSING on Fedora 19
with stdc-predef.h from glibc-headers-2.17-11:
$ rpm -qf /usr/include/stdc-predef.h
glibc-headers-2.17-11.fc19.ppc64p7

This is because between these two version of stdc-predef.h, it now defines IEC
559 macros in a separate header:
$ sdiff stdc-predef.h.debian stdc-predef.h.fedora -b -w150
...
/* Define __STDC_IEC_559__ and other similar macros.  */                  |    
/* We do support the IEC 559 math functionality, real and complex.  */
#include <bits/predefs.h>                                                 |    
#define __STDC_IEC_559__                1
                                                                          >    
#define __STDC_IEC_559_COMPLEX__        1
...

Both are built and run with GCC 4.8.1
$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc-4.8.real
COLLECT_LTO_WRAPPER=/usr/lib/gcc/powerpc64le-linux-gnu/4.8/lto-wrapper
Target: powerpc64le-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.8.1-9'
--with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++ --prefix=/usr --program-suffix=-4.8 --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--disable-libitm --disable-libsanitizer --disable-libquadmath --enable-plugin
--with-system-zlib --disable-libstdcxx-pch --enable-multiarch
--enable-checking=release --build=powerpc-linux-gnu
--host=powerpc64le-linux-gnu --target=powerpc64le-linux-gnu
Thread model: posix
gcc version 4.8.1 (Debian 4.8.1-9)
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/ppc64-redhat-linux/4.8.1/lto-wrapper
Target: ppc64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=<a href="http://bugzilla.redhat.com/bugzilla">http://bugzilla.redhat.com/bugzilla</a>
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin
--enable-initfini-array --enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-isl=/builddir/build/BUILD/gcc-4.8.1-20130603/obj-ppc64-redhat-linux/isl-install
--with-cloog=/builddir/build/BUILD/gcc-4.8.1-20130603/obj-ppc64-redhat-linux/cloog-install
--enable-secureplt --with-long-double-128 --build=ppc64-redhat-linux
Thread model: posix
gcc version 4.8.1 20130603 (Red Hat 4.8.1-1) (GCC)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>