Using LLVM with MobaXterm

A simple guide to to getting LLVM to compile in Windows using MobaXterm (and to a lesser extend Cygwin)

**Note: All of the links in this guide open in new windows/tabs.

Setting up the Compilation Environment:

  1. Download MobaXterm from MobaXterm's website here.

  2. Download the following plugins from MobaXterm's Plugins Listing here and place them into your MobaXterm directory:

    1. Gcc, G++, and development tools

    2. (for Compiling LLVM)

    3. Perl

    4. (for Utilities)

    5. Subversion (SVN)

    6. (for the LLVM repository)

    7. Tcl / Tk / Expect

      1. (for the Automated test suite?)

  3. Download the following additional 3rd party plugins from my website here and place them into your MobaXterm directory:

    1. CMake

    2. (for building LLVM. See here for details)

    3. Graphviz

      1. (for viewGraph() functionality. See here for details)

    4. Python

      1. (needed by LLVM-lit)

Downloading the Sources:

(see here for details)

  1. Choose a directory were you want to place the LLVM source code.

  2. download the LLVM source code:

    1. cd /path/to/llvm-src-code

    2. svn co https://llvm.org/svn/llvm-project/llvm/trunk llvm

  3. Download the Clang source code:

    1. cd /path/to/llvm-src-code

    2. cd llvm/tools

    3. svn co https://llvm.org/svn/llvm-project/cfe/trunk clang

Compiling LLVM (MobaXterm/Cygwin specific):

  1. Setup the linker to support a large heap size (otherwise debug builds will fail when linking lto and libclang):

    1. peflags --bigaddr=1 /bin/ld

      1. (see here for details)

  2. Setup the build directory:

    1. Choose a directory where you want to compile llvm.

    2. cd /path/to/llvm-build-directory

    3. cmake -DCMAKE_BUILD_TYPE:STRING=Debug /path/to/llvm-source-code

      1. (Change the build type to Release for the non-debug build)

  3. Compiling

    1. make all

    2. make check

    3. peflags --bigaddr=1 /path/to/llvm-build-directory/bin/clang

      1. (for large heap size or it will fail to call its low level driver)

    4. peflags --bigaddr=1 /path/to/llvm-build-directory/bin/clang-x.x

      1. (where x.x is the version number)

Additional Notes:

  • You will need to run peflags on /bin/ld everytime you start MobaXterm. It would be pertinent to enable a persistent HOME directory in MobaXterm's preferences and add the line to ~/.bash_profile.

  • You will need to run peflags on clang every time you recompile.

References:

Questions/Comments/Corrections?