[cfe-dev] /bit/c++config.h not found

Eli Friedman eli.friedman at gmail.com
Mon Jul 8 13:55:03 PDT 2013


On Mon, Jul 8, 2013 at 11:57 AM, Daniel QuiƱones Lopez
<kaos09 at hotmail.com> wrote:
> Hello,
>
> I'm trying to install Clang, using CMake with Ninja suport, according to
> this tutorial:
>
> clang.llvm.org/docs/LibASTMatchersTutorial.html
>
>
> The problem comes when building Clang. I uses this comand:
>
> cmake .. -GNinja -DCMAKE_C_COMPILER=/path/to/clang
> -DCMAKE_CXX_COMPILER=/path/to/clang++Esto es lo que creo que finalmente he
> puesto:cmake -G Ninja ../llvm -DLLVM_BUILD_TESTS=ON
> -DCMAKE_C_COMPILER=/usr/local/bin/clang
> -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++
>
> instead of what the tutorial says by someone recommendation. But when I run
> Ninja (whith -v option) again i get this:
>
>  [1/2256] /usr/local/bin/clang++   -D_DEBUG -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
> -Wmissing-field-initializers -pedantic -Wno-long-long
> -Wcovered-switch-default -Wnon-virtual-dtor -fcolor-diagnostics -fno-rtti
> -Ilib/Support -I/home/daniel/clang-llvm/llvm/lib/Support -Iinclude
> -I/home/daniel/clang-llvm/llvm/include    -fno-exceptions -MMD -MT
> lib/Support/CMakeFiles/LLVMSupport.dir/Errno.cpp.o -MF
> "lib/Support/CMakeFiles/LLVMSupport.dir/Errno.cpp.o.d" -o
> lib/Support/CMakeFiles/LLVMSupport.dir/Errno.cpp.o -c
> /home/daniel/clang-llvm/llvm/lib/Support/Errno.cpp
> [2/2256] /usr/local/bin/clang++   -D_DEBUG -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
> -Wmissing-field-initializers -pedantic -Wno-long-long
> -Wcovered-switch-default -Wnon-virtual-dtor -fcolor-diagnostics -fno-rtti
> -Ilib/Support -I/home/daniel/clang-llvm/llvm/lib/Support -Iinclude
> -I/home/daniel/clang-llvm/llvm/include    -fno-exceptions -MMD -MT
> lib/Support/CMakeFiles/LLVMSupport.dir/APFloat.cpp.o -MF
> "lib/Support/CMakeFiles/LLVMSupport.dir/APFloat.cpp.o.d" -o
> lib/Support/CMakeFiles/LLVMSupport.dir/APFloat.cpp.o -c
> /home/daniel/clang-llvm/llvm/lib/Support/APFloat.cpp
> [3/2256] /usr/local/bin/clang++   -D_DEBUG -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
> -Wmissing-field-initializers -pedantic -Wno-long-long
> -Wcovered-switch-default -Wnon-virtual-dtor -fcolor-diagnostics -fno-rtti
> -Ilib/Support -I/home/daniel/clang-llvm/llvm/lib/Support -Iinclude
> -I/home/daniel/clang-llvm/llvm/include    -fno-exceptions -MMD -MT
> lib/Support/CMakeFiles/LLVMSupport.dir/APSInt.cpp.o -MF
> "lib/Support/CMakeFiles/LLVMSupport.dir/APSInt.cpp.o.d" -o
> lib/Support/CMakeFiles/LLVMSupport.dir/APSInt.cpp.o -c
> /home/daniel/clang-llvm/llvm/lib/Support/APSInt.cpp
> FAILED: /usr/local/bin/clang++   -D_DEBUG -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
> -Wmissing-field-initializers -pedantic -Wno-long-long
> -Wcovered-switch-default -Wnon-virtual-dtor -fcolor-diagnostics -fno-rtti
> -Ilib/Support -I/home/daniel/clang-llvm/llvm/lib/Support -Iinclude
> -I/home/daniel/clang-llvm/llvm/include    -fno-exceptions -MMD -MT
> lib/Support/CMakeFiles/LLVMSupport.dir/APFloat.cpp.o -MF
> "lib/Support/CMakeFiles/LLVMSupport.dir/APFloat.cpp.o.d" -o
> lib/Support/CMakeFiles/LLVMSupport.dir/APFloat.cpp.o -c
> /home/daniel/clang-llvm/llvm/lib/Support/APFloat.cpp
> In file included from
> /home/daniel/clang-llvm/llvm/lib/Support/APFloat.cpp:15:
> In file included from
> /home/daniel/clang-llvm/llvm/include/llvm/ADT/APFloat.h:20:
> In file included from
> /home/daniel/clang-llvm/llvm/include/llvm/ADT/APInt.h:19:
> In file included from
> /home/daniel/clang-llvm/llvm/include/llvm/ADT/ArrayRef.h:14:
> In file included from
> /home/daniel/clang-llvm/llvm/include/llvm/ADT/SmallVector.h:17:
> In file included from
> /home/daniel/clang-llvm/llvm/include/llvm/Support/AlignOf.h:19:
> /usr/lib/gcc/i686-linux-gnu/4.7/../../../../include/c++/4.7/cstddef:43:10:
> fatal error: 'bits/c++config.h' file not found
> #include <bits/c++config.h>
>          ^
> 1 error generated.
> FAILED: /usr/local/bin/clang++   -D_DEBUG -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
> -Wmissing-field-initializers -pedantic -Wno-long-long
> -Wcovered-switch-default -Wnon-virtual-dtor -fcolor-diagnostics -fno-rtti
> -Ilib/Support -I/home/daniel/clang-llvm/llvm/lib/Support -Iinclude
> -I/home/daniel/clang-llvm/llvm/include    -fno-exceptions -MMD -MT
> lib/Support/CMakeFiles/LLVMSupport.dir/Errno.cpp.o -MF
> "lib/Support/CMakeFiles/LLVMSupport.dir/Errno.cpp.o.d" -o
> lib/Support/CMakeFiles/LLVMSupport.dir/Errno.cpp.o -c
> /home/daniel/clang-llvm/llvm/lib/Support/Errno.cpp
> In file included from /home/daniel/clang-llvm/llvm/lib/Support/Errno.cpp:14:
> In file included from
> /home/daniel/clang-llvm/llvm/include/llvm/Support/Errno.h:17:
> /usr/lib/gcc/i686-linux-gnu/4.7/../../../../include/c++/4.7/string:40:10:
> fatal error: 'bits/c++config.h' file not found
> #include <bits/c++config.h>
>          ^
> 1 error generated.
> FAILED: /usr/local/bin/clang++   -D_DEBUG -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
> -Wmissing-field-initializers -pedantic -Wno-long-long
> -Wcovered-switch-default -Wnon-virtual-dtor -fcolor-diagnostics -fno-rtti
> -Ilib/Support -I/home/daniel/clang-llvm/llvm/lib/Support -Iinclude
> -I/home/daniel/clang-llvm/llvm/include    -fno-exceptions -MMD -MT
> lib/Support/CMakeFiles/LLVMSupport.dir/APSInt.cpp.o -MF
> "lib/Support/CMakeFiles/LLVMSupport.dir/APSInt.cpp.o.d" -o
> lib/Support/CMakeFiles/LLVMSupport.dir/APSInt.cpp.o -c
> /home/daniel/clang-llvm/llvm/lib/Support/APSInt.cpp
> In file included from
> /home/daniel/clang-llvm/llvm/lib/Support/APSInt.cpp:15:
> In file included from
> /home/daniel/clang-llvm/llvm/include/llvm/ADT/APSInt.h:18:
> In file included from
> /home/daniel/clang-llvm/llvm/include/llvm/ADT/APInt.h:19:
> In file included from
> /home/daniel/clang-llvm/llvm/include/llvm/ADT/ArrayRef.h:14:
> In file included from
> /home/daniel/clang-llvm/llvm/include/llvm/ADT/SmallVector.h:17:
> In file included from
> /home/daniel/clang-llvm/llvm/include/llvm/Support/AlignOf.h:19:
> /usr/lib/gcc/i686-linux-gnu/4.7/../../../../include/c++/4.7/cstddef:43:10:
> fatal error: 'bits/c++config.h' file not found
> #include <bits/c++config.h>
>          ^
> 1 error generated.
> ninja: build stopped: subcommand failed.
>
> Using locate c++config.h i get this directory, which is not where clang++ y
> searching for it:
>
> /usr/include/i386-linux-gnu/c++/4.7/bits/c++config.h
>
> I think it's because g++ look for it in a directory by default, by clang++
> search for it in another location. How could I tell clang where to find it?
>
> I'm using LinuxMint 15 32-bit.

First off, is /usr/local/bin/clang built from trunk?

It's possible clang isn't detecting your Linux distribution correctly;
the relevant code is around Linux::AddClangCXXStdlibIncludeArgs in
clang/lib/Driver/ToolChains.cpp .   I mean, you could just add an
-isystem flag to CXXFLAGS, but we would prefer the detection code to
work correctly so other people don't run into the same issue.

-Eli




More information about the cfe-dev mailing list