[LLVMdev] Tips for using clang v3.1 on Windows

Mikael Lyngvig mikael at lyngvig.org
Wed May 23 19:32:15 PDT 2012


Here are the results of me playing around with the new EXPERIMENTAL release
v3.1 of clang for Windows using MinGW32:

   0. 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.
   1. 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.
   2. Install all of MinGW32 - MSYS and all of the packages, just to be
sure it all works.
   3. Install Clang in a directory without spaces in it (as the clang docs
say).
   4. 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%
   5. 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).
   6. 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.

Sample session:

    clang++ -c -o a.o a.cpp
    clang++ -c -o b.o b.cpp
    llvm-ar rcs Test.lib a.o b.o
    ranlib Test.lib
    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.


Cheers,
Mikael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120524/b1321e4c/attachment.html>


More information about the llvm-dev mailing list