[cfe-dev] Using clang built with MSYS/Mingw on Windows

Óscar Fuentes ofv at wanadoo.es
Tue Jul 5 16:22:55 PDT 2011

Edward Diener <eldlistmailingz at tropicsoft.com>

> I have been able to build clang using MSYS using the instructions on the 
> clang web site. Everything appears to have built correctly except for a 
> problem building the llvm sample program which I reported, and nobody 
> has responded to. So I will ignore the problem as I see I have a 
> clang.exe and a clang++.exe in the build/llvm/Debug+Asserts/bin directory.
> I have a number of questions:
> 1) Do I need to re-run 'configure' followed by 'make' each time I get 
> the latest llvm and clang from SVN, or is running 'make' good enough.

After you executed `configure' for the first time, the makefiles will
automatically run `configure' whenever necessary.

> 2) How does clang find its headers and libraries ? In the clang User 
> Manual under "Operating System Features and Limitations" for Mingw32 it 
> says:
> "MinGW32
> Clang works on some mingw32 distributions. Clang assumes directories as 
> below;
>      C:/mingw/include
>      C:/mingw/lib
>      C:/mingw/lib/gcc/mingw32/4.[3-5].0/include/c++"
> This is a little confusing to me.

I think that clang has the paths hard-coded for MinGW.

> When running clang, built through MSYS, does clang understands Windows
> paths or does it need to be run from within MSYS and therefore
> understand only Linux-like paths ? The note suggests the former.

The paths you quoted are not unix-like paths. Lots of Windows
functionality handle `/' as path separator quite fine.

MSYS is required only for building clang (if you build with
configure+make) not for executing it.

> 3) Can clang handle the Windows header files used by gcc in its include 
> directory as specified above ?

AFAIK yes.

> 4) What is the difference between clang and clang++.exe ?

Just the name. When the executable starts it reads its own name from
argv[0]. If it is clang++.exe, several options for compiling and linking
C++ programs are automatically added. You can use clang.exe for
compiling C++ sources, but then you need to add lots of options to the
command line for correctly handling C++ programs.

> I do not mean to be critical because I know that many developers are 
> working to make clang better, but the online Users Manual is pretty 
> sparse in information, so I am hoping someone can help me here or point 
> me to better explanations.

I don't use clang on Windows, but once you are confident with it, if you
submit a documentation patch that would be a good contribution.


More information about the cfe-dev mailing list