build clang failed under MSYS (windows)

I just follow the instruction here: ( I just use the svn to update to the latest clang and llvm)

http://clang.llvm.org/get_started.html

Then I have all the required tools installed.

When I finish the configure, I simply run the "make" command under the llvm folder.

But here is the error :

$ make
Makefile:130: /Makefile.rules: No such file or directory
make: *** No rule to make target `/Makefile.rules'. Stop.

I just look at the makefile line 130:

# Include the main makefile machinery.
include $(LLVM_SRC_ROOT)/Makefile.rules

It seems $(LLVM_SRC_ROOT) is not defined.

How can I fix this kind of problem?

thanks.

asmwarrior

Please show us "./config.status --version", thank you.

eg. $ ./config.status --version
llvm config.status 2.9svn
configured by ../../llvm-cur/configure, generated by GNU Autoconf 2.63,
  with options "'-C' '--disable-docs' '--enable-pthreads'
'--enable-optimized' '--enable-assertions=yes'
'--prefix=/c/Users/chapuni/llvm/build/msys-shared/install/stage1'
'--enable-shared=yes' '--enable-targets=all' 'CXX=ccache g++'"

Copyright (C) 2008 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.

...Takumi

Hi, thanks for the reply.

I have just update the llvm and clang to the latest svn.
Then do it again.

it seems configure command works fine , but make command give the same error:

Good morning.

-------------------------------------------------------------------------
here is the report:

/e/clang_build/llvm
$ ./config.status --version
llvm config.status 2.9svn
configured by ./configure, generated by GNU Autoconf 2.60,
with options ""

Copyright (C) 2006 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
-------------------------------------------------------------------------

In-place configure (./configure) might be bad sometimes,
and you may try configure on dedicated build directory, thank you.

$ mkdir /path/to/build
$ cd /path/to/build
$ /path/to/llvm/configure
$ make

I will investigate what would be wrong by in-place configure, someday.

...Takumi

Thanks.
  In-fact, I have tried to build in an dedicated directory, ( I have create a separate directory /e/clang_build/build )
and do the configure like:
../llvm/configure
but it gives the same make command error.

asmwarrior

Hello.

In-fact, I have tried to build in an dedicated directory, ( I have create a
separate directory /e/clang_build/build )
and do the configure like:
../llvm/configure
but it gives the same make command error.

I doubt something would be insane to your environment.

  - Make sure llvm's source tree is not dirty with garbage of in-place
configure.
  - Don't source directory and build directory contain space character
or non-ascii character?
    (It would be okay as far as your log)
  - Is your msys sane?
    With which (or type), check paths for sh, grep, sort, make, sed, and perl.
    and confirm versions for toolchain.

Please show us "config.log(.gz)" and "Makefile.config" if you did not
find any problems.
...Takumi

Hi, thanks for the hint.

It seems my msys system is ok. ( I have used it to build a windows version of GDB some days ago). When trying to build clang, I have just add the perl-msys package recently.

I just add the attachment (which contains the config.log and Makefile.config files. (these files was generated by in-place configure, strange that I can't do the configure from other directory, the configure command will compliant that "in-place" configure is already used..... then just exit, I'm not sure how to clean the in-place garbage of the in-place configure)

Hope it helps.

thanks.
asmwarrior

configlog.7z (19.3 KB)

It would be better to re-extract source archives or to delete and
re-checkout from svn,
to clean garbage.

If you are using Subversion, svn could find garbage as "untracked files".
(also TortoiseSVN could)

...Takumi

thanks for the quick reply. I just delete all the garbage, then update the llvm and clang svn ( I use TortoiseSVN).

Now, running the configure from an external folder seems failed. like:

I am sorry, I had to tell you exactly how to seek garbages.
llvm-svn has the attribute svn:ignore.

from command line, svn st --no-ignore
with tsvn, in "Check for modifications...", check "Show unversioned
files" and "Show ignored files".
(you may delete files listed on the dialog)

I have tried configure with TortoiseSVN-1.6.11 and msysgit on Drive D: (/d/).
I don't find any problems with my environment.

...Takumi

Thanks for the valuable hint.
Now, I have totally remove all the garbage in the llvm and its subfolder.
Now, run the command from the "build" folder.

cd build
../llvm/configure

then, it seems configure stage works fine now.

but I still get failed when running make command:

configlog2.7z (19.3 KB)

As far as I checked your Makefile.config, it must be sane.

Would you like to check;

  - which make
  - make --version

and try to revert my change r110166.
If you have another version of GNU Make, try one, too.

...Takumi

If you have another version of GNU Make, try one, too.

...Takumi

Good news!!!

I just delete the make.exe in my mingw/bin folder.
Now, the "which make" command just show another make, which is under bin/ (this is the folder of MSYS/bin)

running make, good, it's compiling now.

You MUST use msys make, mingw make should NOT be in path if you use
msys or it should be named mingw32-make.exe or such so it doesnt get
picked up.
If you fix this you should be able to build it.

Yes, I'm just replying your last post. I'm sorry for my mistake!!!

I will report the build status (if any build issue) later.

thanks.

asmwarrior

Hi, every one.
After building for about One hour, I have successfully build the clang.

Oh my god, the build folder size is 3.5G!
and the folder \build\Debug+Asserts is 2.5G.
especially, under the folder: \build\Debug+Asserts\bin

clang++.exe 430M
clang.exe 430M
llc.exe 170M
....

why these files were so big? (just because Debug enabled?)

After strip command, the clang++.exe is about 20M.

I just test the codecompletion method mentioned in this page (My original test for a cross build clang.exe)

it seems very thing works fine!
Great!thanks all guys for your help.

BTW:
I'm not sure how easy/difficult it is integrate the clang module to an IDE like codeblocks. we need a lot of feature:

1, collecting tags, this is called "batch parsing" in codeblocks : this involve parsing all the files, for clang is should parse all the translation unit. hope PCH can make the parsing much faster. we don't need parse the function body, because we are not interested about local variables.
2, supply some tag-tree structure, so that people can navigate the source from here to there, or jump from declaration to definition.
3, codecompletion, this time, the local variable in the current function scope should be parsed.

additional feature:
code re-factoring (re-name some identifiers)

asmwarrior
ollydbg from codeblocks' forum

Hi, every one.
After building for about One hour, I have successfully build the clang.

Oh my god, the build folder size is 3.5G!
and the folder \build\Debug+Asserts is 2.5G.
especially, under the folder: \build\Debug+Asserts\bin

clang++.exe 430M
clang.exe 430M
llc.exe 170M
....

why these files were so big? (just because Debug enabled?)

Yes. It helps to have a beefy machine for building LLVM & clang.

After strip command, the clang++.exe is about 20M.

Reid

hi, all.

Today, I just update the llvm and clang trunk to the latest version (rev 121337).

I'm trying to build clang again under MSYS and Windows. Since it works OK several weeks ago.

Here is the steps:

cd build
../llvm/configure
make ENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1

Now, in the final stage, build failed. see the log:

Update again.

-eric

Hi, thanks for the quick response.
I just update the clang to

Just for a record.
For those would like to build clang under 32bit MSYS and MINGW. I suggest you can do:

1, download a MSYS packge(which contain all the need tools) from:

2, download a MinGW package, I personal use Loaden's MinGW 4.4.5

http://code.google.com/p/qp-gcc/downloads/detail?name=mingw-static-4.4.5-all.7z&can=2&q=

But you can also use the Official mingw 4.4 or the TDM-MinGW 4.5.1

3, configure(edit) the file
      msys\etc\fstab

like: (my mingw was installed under d:/mingw)
d:/mingw /mingw
F:/cb/python27 /python

So that the MSYS system can find your MinGW compiler

4, download the llvm trunk and clang trunk.
and follow the steps like (the folder named "build" was along the llvm folder, the make option will build a release version, if you use the default option, the output file will eat 3G of your hard disk, but in release mode, it only eat 300M+)

cd build
../llvm/configure
make ENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1

6, happy building

more reference can be found :

http://clang.llvm.org/get_started.html

http://llvm.org/docs/GettingStarted.html#requirements
(I think the information about mingw can be updated, at least I use mingw 4.4.5)

http://llvm.org/docs/HowToReleaseLLVM.html

asmwarrior
ollydbg from codeblocks' forum