[cfe-dev] [3.5 Release] <cxxabi.h> not found by clang-3.5 rc1 with libc++

Ben Pope benpope81 at gmail.com
Tue Aug 12 01:39:36 PDT 2014


On Friday, August 08, 2014 12:01 AM, Larry Evans wrote:
> On 08/05/2014 05:23 AM, Ben Pope wrote:
>> On 08/04/2014 04:58 PM, Dan Albert wrote:
>>>      ben:~/development/test$ clang++-3.5 -std=c++11 -stdlib=libc++ abi.cpp
>>>      -nostdinc -I/usr/include/c++/v1
>>>      In file included from abi.cpp:1:
>>>      /usr/include/c++/v1/cxxabi.h:__18:10: fatal error: 'stddef.h' file
>>>      not found
>>>
>>>
>>> -nostdinc*++*. We still want it to find the standard headers, just not
>>> libstdc++.
>>
>> Mea culpa, it compiles successfully.
>>
>>> LLVM_ENABLE_LIBCXX controls whether or not LLVM itself is built with
>>> libc++. AFAIK, it shouldn't affect clang's behavior from the user side
>>> of things.
>>>
>>> Sounds like it's an issue with clang's default include search path.
>>> Maybe one of the clang people can chime in?
>>
>> Is there some way to check what the include paths are?
>>
>> Ben
> Using -v flag shows these paths (as well as a bunch of other stuff).
> Here's what I get:
>
> make headers
> /home/evansl/dwnlds/llvm/3.5rc1/build-variants/release/install/bin/clang++
> -c -O0 -gdwarf-2 -std=c++1y   -isystem /usr/local/include/c++/4.9.0
> -isystem /usr/local/include/c++/v1 -v -x c++ /dev/null -fsyntax-only
> clang version 3.5.0 (tags/RELEASE_35/rc1)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> 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.2
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.0
> Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
> Candidate multilib: .;@m64
> Selected multilib: .;@m64
>   "/home/evansl/dwnlds/llvm/3.5rc1/build-variants/release/install/bin/clang" -cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -disable-free -main-file-name null -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.24 -v -gdwarf-2 -dwarf-column-info -resource-dir /home/evansl/dwnlds/llvm/3.5rc1/build-variants/release/install/bin/../lib/clang/3.5.0 -isystem /usr/local/include/c++/4.9.0 -isystem /usr/local/include/c++/v1 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/x86_64-linux-gnu -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/ba
>   ckward -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8 -internal-isystem /usr/local/include -internal-isystem /home/evansl/dwnlds/llvm/3.5rc!
>   1/build-va
> riants/release/install/bin/../lib/clang/3.5.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -std=c++1y -fdeprecated-macro -fdebug-compilation-dir /home/evansl/prog_dev/clang -ferror-limit 19 -fmessage-length 124 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -x c++ /dev/null
> clang -cc1 version 3.5.0 based upon LLVM 3.5.0svn default target
> x86_64-unknown-linux-gnu
> ignoring nonexistent directory
> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/x86_64-linux-gnu"
> ignoring nonexistent directory "/include"
> #include "..." search starts here:
> #include <...> search starts here:
>   /usr/local/include/c++/4.9.0
>   /usr/local/include/c++/v1
>   /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8
>   /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward
>   /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8
>   /usr/local/include
>   /home/evansl/dwnlds/llvm/3.5rc1/build-variants/release/install/bin/../lib/clang/3.5.0/include
>   /usr/include/x86_64-linux-gnu
>   /usr/include
> End of search list.
>
> Compilation finished at Thu Aug  7 10:49:31
>
>
> You'll have to parse the output to get the include paths shown between:
>
> #include <...> search starts here:
>
> and:
>
> End of search list.
>
> You may be curious about the /usr/local/include entries.  If you look at
> the command, you'll see 2 -isystem flags.  I've had to add those to get
> the compiles to work on a simple hello_work.cpp program.

Right, so I get this:

clang++-3.5 -std=c++11 -stdlib=libc++ abi.cpp -v
clang version 3.5.0 (tags/RELEASE_350/rc2)
Target: x86_64-unknown-linux-gnu
Thread model: posix
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.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.1
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Selected multilib: .;@m64
 
"/home/ben/development/llvm/3.5/rc2/Phase3/Release/llvmCore-3.5.0-rc2.install/bin/clang" 
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all 
-disable-free -disable-llvm-verifier -main-file-name abi.cpp 
-mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose 
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu 
x86-64 -target-linker-version 2.24.51.20140617 -v -dwarf-column-info 
-resource-dir 
/home/ben/development/llvm/3.5/rc2/Phase3/Release/llvmCore-3.5.0-rc2.install/bin/../lib/clang/3.5.0 
-internal-isystem 
/home/ben/development/llvm/3.5/rc2/Phase3/Release/llvmCore-3.5.0-rc2.install/bin/../include/c++/v1 
-internal-isystem /usr/local/include -internal-isystem 
/home/ben/development/llvm/3.5/rc2/Phase3/Release/llvmCore-3.5.0-rc2.install/bin/../lib/clang/3.5.0/include 
-internal-externc-isystem /usr/include/x86_64-linux-gnu 
-internal-externc-isystem /include -internal-externc-isystem 
/usr/include -std=c++11 -fdeprecated-macro -fdebug-compilation-dir 
/home/ben/development/test -ferror-limit 19 -fmessage-length 253 
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions 
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/abi-97f8d1.o -x 
c++ abi.cpp
clang -cc1 version 3.5.0 based upon LLVM 3.5.0 default target 
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 
/home/ben/development/llvm/3.5/rc2/Phase3/Release/llvmCore-3.5.0-rc2.install/bin/../include/c++/v1
  /usr/local/include
 
/home/ben/development/llvm/3.5/rc2/Phase3/Release/llvmCore-3.5.0-rc2.install/bin/../lib/clang/3.5.0/include
  /usr/include/x86_64-linux-gnu
  /usr/include
End of search list.
abi.cpp:1:10: fatal error: 'cxxabi.h' file not found
#include <cxxabi.h>
          ^
1 error generated.

So perhaps there is something not quite right about the libc++ built 
with clang-3.5.

Does anybody know if ./llvm.src/utils/release/test-release.sh is 
supposed to build a working libc++?  I thought I read recently that 
libc++abi is the default, but perhaps that's for clang-3.6.

Ben




More information about the cfe-dev mailing list