[cfe-dev] Fwd: Any tutorial or resource on getting a working CLang environment under Windows?

Pawel Wodnicki root at 32bitmicro.com
Sat Dec 22 16:41:13 PST 2012


Forwarding to cfe-dev ...

> On Fri, Dec 21, 2012 at 8:28 PM, greatwolf <clang.greatwolf at mamber.net> wrote:
>> In particular, I'm not looking to build llvm or clang from source but rather
>> how to use the precompiled binary made available from llvm's download
>> section under mingw windows setup.

3.2 Clang Mingw experimental was build and tested on a system with
fresh default Msys/MingW installation using g++.exe (GCC) 4.6.2.

>>
>> At the moment I downloaded the latest provided 3.2 Clang Mingw experimental
>> binary. However, when trying to compile a test program with clang++ it isn't
>> looking in the right place for the mingw header includes, libstdc++,
>> win32api and the like.

If you are not using  g++.exe (GCC) 4.6.2. or have non default
installation paths then you might encounter problems.

>>
>> I would get silly errors like:
>>
>> main.cpp:1:10: fatal error: 'iostream' file not found
>> #include <iostream>
>>          ^
>> 1 error generated.
>>
>> What's the recommended way to correct this problem? Adding '-I' for mingw's
>> header location might be one way but there has to be a better way to tell
>> clang on where to look for this by default.

First check and confirm your g++ installed version is g++.exe
(GCC)4.6.2. If your g++ version is different then you can try
setting clang options, do:

clang --help

And look for -isysroot, -isystem , detailed description is in
the clang documentation.  This is still experimental build!

http://clang.llvm.org/docs/UsersManual.html

Paweł
> 
> clang first looks relative to itself for MinGW (i.e. where the headers
> would be if you installed clang into MinGW).  Then, it tries
> "/mingw/include" and "c:/mingw/include".
> 
>> Secondly, what linker does Clang use? Does it try to use the default gnu ld
>> linker from mingw? Does Clang come with its own linker? What is llvm-link
>> for?
>>
>> Thanks in advance for clarifying.
> 
> At the moment, on MinGW clang invokes gcc to link. llvm-link is not a
> linker in the sense you care about; http://lld.llvm.org is, but that's
> not yet usable.
> 
> -Eli






More information about the cfe-dev mailing list