I've blown a couple of weekends trying to build under MinGW.
I can build the llvm tools with only a couple of minor hassles, but can't
seem to make any headway with the C Front End
Most errors I run into involve not being able to find header files.
The most frustrating part is that the error messages report that the file
can't be found, and then proceed to give a path to where the file actually
is located.
In the example below, the header "config/i386/xm-mingw32.h" cannot be
found. BUT the include path, specified by "-I../../src/gcc/", leads right
to the desired header.
I can work-around this particular error by copying files out of the src
directory into the corresponding places in the build directory.
I'm left believing that something is fundamentally wront with my setup.
Has anyone had any recent success building the CFE on MinGW?
Thanks.
$ xgcc -B/home/llvm-1.7/cfrontend/build/gcc
-B/home/llvm-1.7/cfrontend/install/i686-pc-mingw32/bin/ -B/home/llvm-1.7/
cfrontend/install/i686-pc-mingw32/lib/ -isystem
/home/llvm-1.7/cfrontend/install/i686-pc-mingw32/include -isystem /ho
me/llvm-1.7/cfrontend/install/i686-pc-mingw32/sys-include -O2
-I../../src/gcc/../winsup/w32api/include -DIN_GCC -DDEF
AULT_TARGET_MACHINE=\"i686-pc-mingw32\" -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -isystem ./
include -g -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I -I../../src
-I../../src/gcc/ -I../../src/gcc/../include -DL_m
uldi3 -c ../../src/gcc/libgcc2.c -o libgcc/./_muldi3.o
In file included from ../../src/gcc/libgcc2.c:40:
./tconfig.h:5:37: config/i386/xm-mingw32.h: No such file or directory
In file included from ../../src/gcc/libgcc2.c:41:
../../src/gcc/tsystem.h:75:19: stdio.h: No such file or directory
../../src/gcc/tsystem.h:78:23: sys/types.h: No such file or directory
../../src/gcc/tsystem.h:81:19: errno.h: No such file or directory
../../src/gcc/tsystem.h:88:20: string.h: No such file or directory
../../src/gcc/tsystem.h:89:20: stdlib.h: No such file or directory
../../src/gcc/tsystem.h:90:20: unistd.h: No such file or directory
In file included from
C:/msys/1.0/home/llvm-1.7/cfrontend/build/gcc/include/limits.h:122,
from
C:/msys/1.0/home/llvm-1.7/cfrontend/build/gcc/include/syslimits.h:7,
from
C:/msys/1.0/home/llvm-1.7/cfrontend/build/gcc/include/limits.h:11,
from ../../src/gcc/tsystem.h:93,
from ../../src/gcc/libgcc2.c:41:
./include/limits.h:122:61: no include path in which to search for limits.h
In file included from ../../src/gcc/libgcc2.c:41:
../../src/gcc/tsystem.h:96:18: time.h: No such file or directory
In file included from ../../src/gcc/libgcc2.c:43:
./tm.h:4:31: config/i386/i386.h: No such file or directory
./tm.h:5:31: config/i386/unix.h: No such file or directory
./tm.h:6:30: config/i386/bsd.h: No such file or directory
./tm.h:7:30: config/i386/gas.h: No such file or directory
./tm.h:8:29: config/dbxcoff.h: No such file or directory
./tm.h:9:34: config/i386/cygming.h: No such file or directory
./tm.h:10:34: config/i386/mingw32.h: No such file or directory
./tm.h:11:23: defaults.h: No such file or directory
In file included from ../../src/gcc/libgcc2.c:44:
../../src/gcc/llvm-out.h:69: error: syntax error before '*' token
../../src/gcc/llvm-out.h:69: warning: function declaration isn't a
prototype
../../src/gcc/libgcc2.c: In function `__mulhi3':
../../src/gcc/libgcc2.c:502: error: `BITS_PER_UNIT' undeclared (first use
in this function)
../../src/gcc/libgcc2.c:502: error: (Each undeclared identifier is
reported only once
../../src/gcc/libgcc2.c:502: error: for each function it appears in.)
I've blown a couple of weekends trying to build under MinGW.
I can build the llvm tools with only a couple of minor hassles, but can't
seem to make any headway with the C Front End
Most errors I run into involve not being able to find header files.
The most frustrating part is that the error messages report that the file
can't be found, and then proceed to give a path to where the file actually
is located.
This sounds like the problems people face when building a regular FSF
gcc release under MinGW. There was some discussion about this topic
recently on MinGW user's mailing list. Some workarounds were found,
using absolute paths on the config scripts, IIRC.
I haven't seen this before, but it is vaguely reminiscent of a
permissions problem. Permissions can be weird under cygwin/mingw. You
have to ensure both the windows and the unix permissions allow the files
to be read. In this environment, sometimes "file not found" can actually
mean "directory not readable".
--includedir and --libdir should be Windows directories
(c:/msys/...). MinGW does not understand Cygwin/MSYS paths.
With forward-slashes? or back-slashes? (I'll try both if I have to
Is --srcdir really needed?
I don't know. At this poin I'm just trying lots of stuff.
> make CFLAGS=-O LIBCFLAGS+=-g LIBCFLAGS+=-O2 LIBCXXFLAGS+=-g
> LIBCXXFLAGS+=-O2 LIBCXXFLAGS+=-fno-implicit-templates LDFLAGS=-s all
I don't know about LLVM, but shouldn't this be
make ... bootstrap
as per the gcc build instructions?
I don't know either. I believe I tried the bootstrap flag at one point,
but still no dice. Last weekend, I actualy did build gcc (*not* llvm-gcc)
successfully which proved to me that there wasn't something fundamentally
wrong with my MinGW setup. The build went smoothly using a script I
snagged off the MinGW WIKI. This is what prompted me to start my own
script.
Forward works ok with MinGW. Back slashes can be interpreted as escape
sequences by MSYS/Cygwin tools.
I've succeeded in building CFE in Mingw at some 1.3-1.4 release.
After, I just don't have enough time to play with LLVM. I've sent my
instructions to Henrik Bach <henrik_bach_llvm@hotmail.com>, maybe it's
worth to ask him. I'll also try to seek for e-mails i've sent to him
(please note, that they should be outdated - i've written them a year
ago).
Anyway, the problem isn't in mingw itself, but in msys. Some patching
will be needed in order to build it successfully. One of the decent
solutions is just to use some small piece of cygwin just for shell stuff.