Software-Guides‎ > ‎

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
      (for Compiling LLVM)
    2. Perl
      (for Utilities)
    3. Subversion (SVN)
      (for the LLVM repository)
    4. Tcl / Tk / Expect
      (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
      (for building LLVM. See here for details)
    2. Graphviz
      (for viewGraph() functionality. See here for details)
    3. Python
      (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 llvm
  3. Download the Clang source code:
    1. cd /path/to/llvm-src-code
    2. cd llvm/tools
    3. svn co 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
      (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
      (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
      (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
      (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.