Building CFE in Mingw

Hello, all.

Just found this file in my e-mail atchive, hope it will be useful for somebody.

===cut=here===

Some small rules:

1) No blankspace in the paths to the top-level directories.
2) Add paths to binaries to your system PATH variable.
3) Use short paths to top-level directories.

1. Some checks & preparations.

1) Be sure, that you're using right make version:
    $ make --version
    GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
    Built for i686-pc-msys
    Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
            Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.
    There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
    PARTICULAR PURPOSE.

    Report bugs to <bug-make@gnu.org>.

  2) Some patching:
     Go to gcc\gcc directory, open Makefile.in file.

     Find lines:

INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
           -I$(srcdir)/../include @INCINTL@

     Change them to:

INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
           -I$(srcdir)/../include @INCINTL@ -IPREFIX/include

      Note: use forward slashes for PREFIX, e.g.
      -If:/projects/mingw

2. Possible issues.

    1) Problem: Complains about *.info files.
       Resolutions: There are know miscompartibilities between msys makeinfo
                    file and GCC's sources. Either use makeinfo from cygwin,
                    or just remove msys' version out.

    2) Problem: Complains about gthr-default.h file.
       Resolution: Grab gcc/gcc/gthr-win32.h file and copy it to gthr-default.h

    3) Problem: Complains about "CL_ObjCXX" and simular ("CL_") during
                compilation c-opts.c.
       Resolution: Turn off windows file protection, remove system32\sort.exe
                   file. After, check, that sort --version tells you, that it
                   is sort 2.0 (GNU textutils).

    4) Problem: Complains about files sitting in your PATH (or above), but,
                actually had not found.
       Resolution: Check your directories for the trailing '\'. It should not
                   be used! (E.g. c:\winnt - right, c:\winnt\ - wrong).

    5) Problem: Complains about find.exe while building libstdc++.
       Resolution: Look into issue 3) and remove windows' find.exe.
       You should you GNU's one.
       
===cut=here===

Anton Korobeynikov <asl@math.spbu.ru> writes:

[snip]

    2) Problem: Complains about gthr-default.h file.
       Resolution: Grab gcc/gcc/gthr-win32.h file and copy it to gthr-default.h

... so --enable-threads=win32 is broken... good to know.

    3) Problem: Complains about "CL_ObjCXX" and simular ("CL_") during
                compilation c-opts.c.
       Resolution: Turn off windows file protection, remove system32\sort.exe
                   file. After, check, that sort --version tells you, that it
                   is sort 2.0 (GNU textutils).

Another workaround for this problem is checking that cygwin or msys
bin directories comes first on PATH.

Great post, Anton.

Hi Oscar

Sorry for the delay, but I haven't been that active for a while on llvm. But, I've put some notes on my private llvm web-site (Yahoo | Mail, Weather, Search, Politics, News, Finance, Sports & Videos) for building llvm tools and cfe. Hopefully, you can put the pieces together. I'll stay alert for the next time.

Henrik.