Here are the results of me playing around with the new EXPERIMENTAL release v3.1 of clang for Windows using MinGW32:
- You don’t need to go through the nightmare of building clang v3.1 yourself - it is right there on the download page, albeit at the very bottom.
- Install MinGW32 in the directory C:\MinGW and nowhere else. Otherwise you’ll get all sorts of errors about missing include files and nothing will work at all.
- Install all of MinGW32 - MSYS and all of the packages, just to be sure it all works.
- Install Clang in a directory without spaces in it (as the clang docs say).
- Add both c:\MinGW\bin and clang’s bin directory to your path using the PATH command: path c:\tmp\clang-3.1-win32-mingw32\bin;c:\MinGW\bin;%path%
- Be prepared to have to edit your source files a little as MinGW32 is not entirely Microsoft compatible (there’s no GetFileSizeEx() function, for instance).
- Remember to use MinGW’s ranlib, not llvm-ranlib, when you create an indexed archive. The latter won’t work and MinGW’s ld will reject the library.
clang++ -c -o a.o a.cpp
clang++ -c -o b.o b.cpp
llvm-ar rcs Test.lib a.o b.o
clang++ -o c.exe c.cpp Test.lib
Other than that, I have no comments. I managed to build a support library without problems and the module tests ran without any problems. I have not yet had time to play around with LLVM v3.1.
P.S. Thank you guys, it is wonderful that you are now (again) making a binary release for Windows. I think it is the first step in getting rid of the EXPERIMENTAL tag
P.P.S. And a quick, voiced prayer that we’ll one day see a distro of clang for MinGW64 as well. If I ever figure out how to build it, I’d be happy to build it for release purposes.