I'm running Clang from inside a Docker instance running Ubuntu 12.04. Here's a tiny test case that shows the problem: root@eacf7e43c75a:~# cat test.c # include_next <limits.h> In file included from test.c:1: /usr/include/limits.h:125:16: fatal error: 'limits.h' file not found # include_next <limits.h> ^ 1 warning and 1 error generated. root@eacf7e43c75a:~# clang -v Ubuntu clang version 3.4.1-1~exp1 (branches/release_34) (based on LLVM 3.4.1) Target: x86_64-pc-linux-gnu Thread model: posix Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.6 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.6.4 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.1 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4 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.1 Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8 However, I have a docker instance I built a couple months ago that's almost entirely the same, except for what I think is a version bump in clang-3.4: (the following snippet is from the old image, which handles the test case fine) root@7c57e7415f1d:~# clang -v Ubuntu clang version 3.4-1~exp1 (branches/release_34) (based on LLVM 3.4) Target: x86_64-pc-linux-gnu Thread model: posix Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.6 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.6.4 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.1 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4 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.1 Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8 Did something change in how clang looks for include files?
Upon further digging, I believe this is due to clang expecting: /usr/bin/../lib/clang/3.4.1/include unfortunately, only /usr/bin/../lib/clang/3.4/include exists
Even worse, there appears to be a circular symlink loop in the /usr/lib/clang directory. I'd be very grateful for adult supervision! root@9983b8ac1abe:/usr/lib/clang# ls -al total 12 drwxr-xr-x 3 root root 4096 Apr 1 00:02 . drwxr-xr-x 54 root root 4096 Apr 1 00:02 .. drwxr-xr-x 2 root root 4096 Apr 1 00:02 3.4 lrwxrwxrwx 1 root root 3 Mar 30 00:28 3.4.0 -> 3.4 root@9983b8ac1abe:/usr/lib/clang# ls -al 3.4/ total 8 drwxr-xr-x 2 root root 4096 Apr 1 00:02 . drwxr-xr-x 3 root root 4096 Apr 1 00:02 .. lrwxrwxrwx 1 root root 38 Mar 30 00:28 include -> ../../llvm-3.4/lib/clang/3.4.0/include lrwxrwxrwx 1 root root 34 Mar 30 00:28 lib -> ../../llvm-3.4/lib/clang/3.4.0/lib root@9983b8ac1abe:/usr/lib/clang#
Where did you get your Clang 3.4.1 package from?
(In reply to comment #3) > Where did you get your Clang 3.4.1 package from? From the usual apt-get repo: deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.4 main deb-src http://llvm.org/apt/precise/ llvm-toolchain-precise-3.4 main apt-get install -y clang-3.4 llvm-3.4
Ah, my mistake. The links aren't circular - they're just wrong or missing. /usr/lib/clang/3.4.1 is not present /usr/lib/clang/3.4.0 is present but contains include -> /usr/lib/llvm-3.4/lib/clang/3.4.0/include, which is not present. There is only /usr/lib/llvm-3.4/lib/clang/3.4 and /usr/lib/llvm-3.4/lib/clang/3.4.1, which contains the proper headers Symlinking that appears to let my build succeed. There is however, another wrinkle: /usr/lib/llvm-3.4/lib/clang/3.4/lib appears to be empty. On my "good" installation, this directory contains "linux"
Is there an official workaround for this bug or should we just symlink until the bug is resolved?
I've been symlinking. I haven't got any sort of official response to the bug yet.
(In reply to comment #7) > I've been symlinking. I haven't got any sort of official response to the bug > yet. Can you try this patch: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140303/100882.html
(In reply to comment #8) > (In reply to comment #7) > > I've been symlinking. I haven't got any sort of official response to the bug > > yet. > > Can you try this patch: > http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140303/100882. > html Tom, I'm not a very sophisticated user. Is there a doc I can follow about how to compile clang from source with a specified patch?
that should be fixed now.