[cfe-dev] How to compile using Clang?

Csaba Raduly rcsaba at gmail.com
Fri May 4 00:19:54 PDT 2012

Hi Michael,

On Thu, May 3, 2012 at 10:04 AM, Michal Stefanow wrote:
> I'm having a problem with compiling. I've never used clang and I'm not sure
> how set up environment etc...
> Trying to make:
> make
> Making all in backend
(snip libtool invoking clang)
> In file included from deps/http-parser/http_parser.c:21:
> deps/http-parser/http_parser.h:28:10: fatal error: 'sys/types.h' file not
> found
> #include <sys/types.h>
>          ^
> 1 error generated.
> make[1]: *** [libfiresheep_la-http_parser.lo] Error 1
> make: *** [all-recursive] Error 1
> ***
> cat /usr/include/sys/types.h - http://pastebin.com/ke59jmfq
> ***
> clang --version
> Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
> Target: x86_64-apple-darwin11.3.0
> Thread model: posix
> ***
> I have never been proficient in solving includes and compiling dependecies,
> simple Google search search in this case neither... Probably this a matter
> of setting one flag or another. Any hints?

First, run

make CXXFLAGS=-v

This will pass the -v flag to clang, causing it to print the
directories where headers are searched, among other things. Perhaps
this will help understand why the compiler doesn't find sys/types.h (I
suspect this option:  -isysroot /Developer/SDKs/MacOSX10.6.sdk).

GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds

More information about the cfe-dev mailing list