Building Clang on MinGW

Hello all :slight_smile:

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 :slight_smile:

Thanks,
Matthieu.

Why is Visual Studio a pain? It’s working just fine for me.

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.

Pretty sure you've got something in your path that you shouldn't. At various times different versions of the unix-standard utilities like perl and sed and such have been built with different configurations of shared dlls, so your failure mode is path-oriented -- in more than one sense. :slight_smile:

Make sure that you've got a current MinGW, current msys binutils, and current perl, and nothing else in your path, and try again.

Matthieu,

Please make sure;

  - You are using "MSYS" and working on "MSYS bash shell".
    (It seems you would be right)
  - Your msys has "perl"
    $ type perl
    perl is /bin/perl
    (msys-unaware perl distros (eg. activeperl) will not work for you)
  - Make sure you are using mingw32's gcc and mingw32's binutils (nm etc)
    $ type gcc
    gcc is /mingw/bin/gcc
    $ type nm
    nm is /mingw/bin/nm

If you did not build anyways. please show us; "config.log" and
"Makefile.config".

...Takumi

Hi Takumi,

You were right, the issue was Perl. I had (naively) downloaded Strawberry Perl instead of the msys-perl package.

I have now downloaded the msys-perl package
I have reviewed my PATH and made it as minimal I could

I have another problem now:

make[2]: Leaving directory /d/llvm-build/tools/llvm-config
llvm-config: unknown component name: bitreader
make[2]: Entering directory /d/llvm-build/tools/opt
/d/lvlm/Makefiles.rules:941: *** llvm-config --libs failed. Stop.

This corresponds to this command in the Makefile:

LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)

Apparently $(LLVM_CONFIG) is /d/llvm-build/tools/llvm-config so I don’t really understand how it is supposed to be executable.

I joined the Makefile.config and config.log files this time. The version of perl is correctly detected, though it does not seem to be an issue any longer.

Thanks for assisting,
Matthieu.

2011/2/27 NAKAMURA Takumi <geek4civic@gmail.com>

Makefile.config (10.5 KB)

config.log (336 KB)