Skip to content

Building ispc: Linux and Mac OS X

ispc edited this page Jun 22, 2011 · 11 revisions

Building ispc from source on Linux and Mac OS X is relatively straightforward.

First, install the LLVM headers and libraries and the clang compiler on your system:

  • Download the 2.9 release of LLVM from http://llvm.org/releases/download.html and untar it into a directory.
  • Download the 2.9 release of clang from http://llvm.org/releases/download.html and untar it into the llvm-2.9/tools/ directory. Rename the directory from clang-2.9 to clang.
  • Run ./configure from the top-level llvm-2.9 directory, then make install. (You may want to override the installation directory with the --prefix= command-line argument to configure.
  • Once LLVM is installed, make sure that the bin directory it installs its binaries into is in your PATH. (In particular, the tools llvm-config and clang must be available to build ispc.

You're now ready to build ispc:

  • Make sure your installed version of bison is 2.4 or later. (Unfortunately, the version that ships with Mac OS X is 2.3). Bison can be downloaded from http://www.gnu.org/software/bison/.
  • In the ispc source directory, run make
  • You should have an ispc binary in the top-level ispc directory when the build completes.

A note regarding versions of LLVM: ispc should still build with LLVM 2.8, but this path isn't well maintained (and is missing important functionality like emitting debugging symbols and directly generating binary object files). ispc usually builds with recent versions of the LLVM development top-of-tree, though there are occasionally bugs with ToT. (For example, as if 21 June 2011, LLVM ToT has a regression that causes ispc to generate substantially worse code (~15% slower) and to take substantially longer to compile programs (10x slower).)