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

Larry Evans cppljevans at suddenlink.net
Tue Aug 12 12:44:12 PDT 2014


On 08/12/2014 03:39 AM, Ben Pope wrote:
> 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
The attached headers.mk makefile hightlights how the
include search paths differ depending on the presence or absence
of the -nostdinc++ flag.

The output of the make is:

-*- mode: compilation; default-directory: "~/prog_dev/clang/" -*-
Compilation started at Tue Aug 12 14:09:21

make -f headers.mk headers
***headers***
header=cxx
how=clangxx3_5_rc1
/home/evansl/dwnlds/llvm/3.5rc1/build-variants/release/install/bin/clang++
-stdlib=libc++ -std=c++11  -nostdinc++ -v -x c++ abi.cpp 2>
not.cxx.compile-clangxx3_5_rc1.out
make: [headers] Error 1 (ignored)
csplit not.cxx.compile-clangxx3_5_rc1.out '%^#include <%'+1 '/^End of
search/' >/dev/null
mv xx00 not.out
/home/evansl/dwnlds/llvm/3.5rc1/build-variants/release/install/bin/clang++
-stdlib=libc++ -std=c++11   -v -x c++ abi.cpp 2>
yes.cxx.compile-clangxx3_5_rc1.out
csplit yes.cxx.compile-clangxx3_5_rc1.out '%^#include <%'+1 '/^End of
search/' >/dev/null
mv xx00 yes.out
diff not.out yes.out
0a1
>  /usr/include/c++/v1
make: *** [headers] Error 1

Compilation exited abnormally with code 2 at Tue Aug 12 14:09:23

showing that the only difference is the libc++ include:

>  /usr/include/c++/v1

In contrast to you original post, the compile without this flag
succeeds, as shown by the
yes.cxx.compile-clangxx3_5_rc1.out contents,
which is also attached.  OTOH, *with* the -nostdinc++ flag, the
not.cxx.compile-clangxx3_5_rc1.out contents, also attached, show
the same error as your original post:

abi.cpp:1:10: fatal error: 'cxxabi.h' file not found
#include <cxxabi.h>
         ^
1 error generated.

So the mystery here is why Ben's clang3.5rc1 compile of abi.cpp failed
but mine succeeded.

Dan Albert's 2nd post, on 8/4, indicated it was because Ben's clang was
looking for the libstdc++, but my clang3.5rc1 apparently doesn't have
that problem.

-regards,
Larry

BTW, you can't use header.mk directly because it has some included
makefiles which are not attached; however, I think you can figure
out from the macro names the proper substitutions to make.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: headers.mk
Type: text/x-makefile
Size: 1262 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140812/9a69f3f7/attachment.bin>
-------------- next part --------------
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 -emit-obj -mrelax-all -disable-free -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 -v -dwarf-column-info -resource-dir /home/evansl/dwnlds/llvm/3.5rc1/build-variants/release/install/bin/../lib/clang/3.5.0 -internal-isystem /usr/include/c++/v1 -internal-isystem /usr/local/include -internal-isystem /home/evansl/dwnlds/llvm/3.5rc1/build-variants/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 -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /home/evansl/prog_dev/clang -ferror-limit 19 -fmessage-length 0 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o /tmp/abi-2c0ccc.o -x c++ abi.cpp
clang -cc1 version 3.5.0 based upon LLVM 3.5.0svn default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/v1
 /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.
 "/usr/bin/ld" -z relro --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.8 -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. -L/home/evansl/dwnlds/llvm/3.5rc1/build-variants/release/install/bin/../lib -L/lib -L/usr/lib /tmp/abi-2c0ccc.o -lc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.8/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o
-------------- next part --------------
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 -emit-obj -mrelax-all -disable-free -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 -v -dwarf-column-info -nostdinc++ -resource-dir /home/evansl/dwnlds/llvm/3.5rc1/build-variants/release/install/bin/../lib/clang/3.5.0 -internal-isystem /usr/local/include -internal-isystem /home/evansl/dwnlds/llvm/3.5rc1/build-variants/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 -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /home/evansl/prog_dev/clang -ferror-limit 19 -fmessage-length 0 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o /tmp/abi-66f682.o -x c++ abi.cpp
clang -cc1 version 3.5.0 based upon LLVM 3.5.0svn default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /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.
abi.cpp:1:10: fatal error: 'cxxabi.h' file not found
#include <cxxabi.h>
         ^
1 error generated.


More information about the cfe-dev mailing list