Building LLVM and the LLVM GCC 4 Frontend

Installing Cygwin

Make sure you have the latest Cygwin release.

Here's the directory tree :-
    /usr/src/llvm
    /usr/src/llvm-gcc4

    /usr/build/llvm
    /usr/build/llvm-gcc4

    /usr/llvm
    /usr/llvm-gcc4
The GCC CFrontend maybe unzipped and installed under /usr (c:\Cygwin\usr)

Getting the source from CVS

Get LLVM :-
    cd /usr/src
    cvs -z3 -d :pserver:anon@llvm-cvs.cs.uiuc.edu:/var/cvs/llvm co llvm
Get the LLVM GCC 4 frontend :-
    svn co svn://anonsvn.opensource.apple.com/svn/llvm/trunk llvm-gcc4

Patching Cygwin's include/stdint.h

Get the stdint.h.diff patch :-

        stdint.h.diff

Run Cygwin's Bash and type :-
    patch /usr/include/stdint.h stdint.h.diff
'include/stdint.h' int32_t and uint32_t have to be changed from long's to int's, to bring Cygwin in line with all other *nix'es including MinGW32. This patch should not effect other compilations.

Patching llvm/lib/System/Unix/Program.inc

Get the Program.inc.diff patch :-

        Program.inc.diff

Patch the code :-
    patch /usr/src/llvm/lib/System/Unix/Program.inc.diff
This patch is because Cygwin does not support RLIMIT_RSS.

Build instructions


Save the path.
    ROOTPATH=${PATH}

Debug build

Build the tools
    cd /usr/build/llvm
    /usr/src/llvm/configure --prefix=/usr/llvm
    make tools-only
    PATH=/usr/build/llvm/debug/bin:${PATH}
Build and install the frontend.
    cd /usr/build/llvm-gcc4
    /usr/src/llvm-gcc4/configure --prefix=/usr/llvm-gcc4 --disable-threads --disable-nls --disable-shared --enable-languages=c,c++ --disable-c-mbchar --program-prefix=llvm- --enable-llvm=/usr/build/llvm
    make all
    make install
    PATH=/usr/llvm-gcc4/bin:${PATH}
Rebuild and install the LLVM.
    cd /usr/build/llvm
    make
    make -C runtime install-bytecode
    make install
Reset the path
    PATH=/usr/llvm-gcc4/bin:/usr/llvm/bin:${ROOTPATH}
    make check
Should result in the following :-
    # of expected passes            1620
    # of unexpected failures        136
    # of unexpected successes       1
    # of expected failures          19
Or there abouts.

Please email any mistakes, error, mods, or suggestions to angray@beeb.net