[cfe-dev] Building Clang on MinGW

Ruben Van Boxem vanboxem.ruben at gmail.com
Sun Feb 27 03:56:41 PST 2011

> Hello all :)
> Since I don't have a proper Unix system yet, and since Visual Studio is such a pain when it comes to Clang, I decided to try out MinGW.
> I've properly installed MinGW, and I've followed the instructions at:
> http://clang.llvm.org/get_started.html
> I decided to begin simple, using `make` instead of `cmake`, but it fails:
> >> make[1]: Entering directory `/d/llvm-build/tools/llvm-
> config`
> >> llvm[1]: Regenerating LibDeps.txt.tmp
> >> 'd:' n'est pas reconnu en tant que commande interne ou externe, un programme executable ou un fichier de commandes.
> >> nm failed at d:/llvm/utils/GenLibDeps.pl line 230.
> (the French line means that apparently the script gets a "d:" command to execute, which probably stems from a path issue, since paths on Windows begin by the drive letter followed by a colon, though I don't understand how this could be interpreted as a command instead of a path...)
> The script line is:
> >> close UNDEFS or die "nm failed";
> which does correspond to the error message... however I am no perl user... so I don't really understand what's going on here.
> I'd appreciate some pointers from people using MinGW :)
> Thanks,
> Matthieu.

You should really use CMake to build on mingw:

> cmake path/to/llvm/source -G"MinGW Makefiles"
> mingw32-make

Note that you'll need "mingw32-make.exe" installed in the mingw/bin folder.

Alternatively, install MSYS and run CMake from the msys bash shell:

> cmake path/to/llvm/source -G"MSYS Makefiles"
> make

It might be possible to do (from MSYS):

> path/to/llvm/source/configure
> make

But it surely will be slower than running CMake.

Hope this helps!

More information about the cfe-dev mailing list