LLVM on Windows (cygwin?)

Hi,

I was wondering whether anyone has attempted to port LLVM to windows running with a POSIX layer, such as cygwin?

I recently tried to build and run llvm on cygwin, and I got the llvm tools working. There were a few problems in the configure script, namely the mmap test fails due to MAP_FIXED not working on windows (all other mmap() stuff works), which I simply commented out since its not used by llvm.

I could not get the gcc frontend to build:

/home/tony/llvm/gcc-fe/cfrontend/build/gcc/xgcc -B/home/tony/llvm/gcc-fe/cfrontend/build/gcc/ -B/home/tony/llvm/gcc-fe/cfrontend/build/i686-pc-cygwin/bin/ -B/home/tony/llvm/gcc-fe/cfrontend/build/i686-pc-cygwin/lib/ -isystem /home/tony/llvm/gcc-fe/cfrontend/build/i686-pc-cygwin/include -isystem /home/tony/llvm/gcc-fe/cfrontend/build/i686-pc-cygwin/sys-include -O2 -I../../src/gcc/../winsup/w32api/include -I../../src/gcc/../winsup/include -I../../src/gcc/../winsup/cygwin/include -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include -g -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I. -I../../src/gcc -I../../src/gcc/. -I../../src/gcc/../include -DL_chkstk -xassembler-with-cpp -c ../../src/gcc/config/i386/cygwin.asm -o libgcc/./_chkstk.o
gccas: /tmp/ccSFlVhW.s:1: syntax error, unexpected $undefined
/tmp/ccSFlVhW.s:1: while reading token: '#'

Which seems to be a libgcc problem.

Any ideas where to start digging for more information on how to port the gcc frontend to cygwin?

GCC natively build and runs happily on cygwin, however, it seems that with the gcc FE using gccas rather than as breaks the build due to some x86 asm being used as part of the build.

Thanks in advance,

Tony

I was wondering whether anyone has attempted to port LLVM to windows
running with a POSIX layer, such as cygwin?

I know that Brian once got the LLVM CVS core compiled under Cygwin, but I
don't recall how well it worked. I thought he had the JIT running, but I
might be wrong.

I recently tried to build and run llvm on cygwin, and I got the llvm tools
working. There were a few problems in the configure script, namely the
mmap test fails due to MAP_FIXED not working on windows (all other mmap()
stuff works), which I simply commented out since its not used by llvm.

Okay, sounds good.

I could not get the gcc frontend to build:

/home/tony/llvm/gcc-fe/cfrontend/build/gcc/xgcc
-B/home/tony/llvm/gcc-fe/cfrontend/build/gcc/
-B/home/tony/llvm/gcc-fe/cfrontend/build/i686-pc-cygwin/bin/
-B/home/tony/llvm/gcc-fe/cfrontend/build/i686-pc-cygwin/lib/ -isystem
/home/tony/llvm/gcc-fe/cfrontend/build/i686-pc-cygwin/include -isystem
/home/tony/llvm/gcc-fe/cfrontend/build/i686-pc-cygwin/sys-include -O2
-I../../src/gcc/../winsup/w32api/include -I../../src/gcc/../winsup/include
-I../../src/gcc/../winsup/cygwin/include -DIN_GCC -W -Wall
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem
./include -g -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I.
-I../../src/gcc -I../../src/gcc/. -I../../src/gcc/../include -DL_chkstk
-xassembler-with-cpp -c ../../src/gcc/config/i386/cygwin.asm -o
libgcc/./_chkstk.o
gccas: /tmp/ccSFlVhW.s:1: syntax error, unexpected $undefined
/tmp/ccSFlVhW.s:1: while reading token: '#'

Which seems to be a libgcc problem.
Any ideas where to start digging for more information on how to port the
gcc frontend to cygwin?

Noone to my knowledge has tried compiling the C front-end on cygwin, so
you may run into problems like this. Here's a patch that I think should
fix this specific problem:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040426/014074.html

GCC natively build and runs happily on cygwin, however, it seems that with
the gcc FE using gccas rather than as breaks the build due to some x86 asm
being used as part of the build.

Yes, when porting the C front-end to a new target, there are often lots of
little wierd tweaks like this to the build that have to be put in. :frowning: If
you run into any other problems, please let me know.

-Chris

FYI:

I did once compile all the LLVM tools (except llvm-gcc) on cygwin.
I am pretty sure I got the JIT to work (on simple test cases
like: int %main () { ret int 0 }), but I haven't built LLVM on
cygwin more than once, so maybe things have bitrotted since then.

It's fine to just comment out the mmap() test - we should probably
rewrite it so that this isn't necessary.

-Brian