clang++ cannot locate string header, or bits/c++config.h

Tony Kelman kelman@berkeley.edu
Sun Feb 9 04:16:00 GMT 2014


I’ve uploaded cygcheck.out at https://gist.github.com/tkelman/8892631
This only applies to x86 Cygwin, as the clang package is not (yet?) 
available in 64-bit Cygwin.

Simple testcase:

echo "#include <string>" > hello.cpp
echo "int main () {};" >> hello.cpp
clang++ -v hello.cpp

This outputs:

clang version 3.1 (branches/release_31)
Target: i386-pc-cygwin
Thread model: posix
"/usr/bin/clang" -cc1 -triple 
i386-pc-cygwin -S -disable-free -disable-llvm-verifier -main-file-name 
hello.cpp -mrelocation-model 
static -mdisable-fp-elim -mconstructor-aliases -target-cpu 
pentium4 -target-linker-version 
2.22.52.20120326 -momit-leaf-frame-pointer -v -resource-dir 
/usr/bin/../lib/clang/3.1 -fmodule-cache-path 
/var/tmp/clang-module-cache -fdeprecated-macro -fno-dwarf-directory-asm -fdebug-compilation-dir 
/cygdrive/d/cygwin64/home/Tony/8875125 -ferror-limit 19 -fmessage-length 
100 -mstackrealign -fno-use-cxa-atexit -fgnu-runtime -fobjc-runtime-has-arc  
-fobjc-runtime-has-weak -fobjc-fragile-abi -fcxx-exceptions -fexceptions -fdiagnostics-show-option 
 -fcolor-diagnostics -o /tmp/hello-108VBJ.s -x c++ hello.cpp
clang -cc1 version 3.1 based upon LLVM 3.1 default target i386-pc-cygwin
ignoring nonexistent directory 
"/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++"
ignoring nonexistent directory 
"/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/i686-pc-cygwin"
ignoring nonexistent directory 
"/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/backward"
ignoring nonexistent directory "/usr/lib/gcc/i686-pc-cygwin/4.5.3/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/bin/../lib/clang/3.1/include
/usr/include
/usr/include/w32api
End of search list.
hello.cpp:1:10: fatal error: 'string' file not found
#include <string>
         ^
1 error generated.


Looks like clang was built with hardcoded GCC 4.5.3 header paths. I'm at GCC 
4.7.3 now.

A successful workaround is to add GCC 4.7.3 header paths to the compiler 
call:
clang++ -I/usr/lib/gcc/i686-pc-cygwin/4.7.3/include/c++ \
  -I/usr/lib/gcc/i686-pc-cygwin/4.7.3/include/c++/i686-pc-cygwin hello.cpp

Or by adding a symbolic link from /usr/lib/gcc/i686-pc-cygwin/4.5.3 to 
/usr/lib/gcc/i686-pc-cygwin/4.7.3.

I hope this inconvenience can be fixed with a future update to the clang 
package.

Thanks,
Tony


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list