4.2 Compiling BlasterSim

4.2.1 Compiling from source tarball

Obtain the latest BlasterSim source code from http://trettel.us/blastersim/releases/blastersim-v0.2.0-source.zip.

Compiling BlasterSim requires only a modern Fortran compiler and a Make program like GNU Make on Linux and macOS or jom or NMAKE on Windows. Unfortunately, BlasterSim will not compile with every Fortran compiler due to the units module being too large. gfortran is recommended, but BlasterSim is also regularly tested with LLVM flang. The Intel Fortran Compiler unfortunately will not compile BlasterSim due to a bug in their front end [2].

After extracting the provided source archive, cd into the directory and build BlasterSim.

On Linux and macOS you can type:

make BUILD=release blastersim

On Windows you can type (if using jom):

jom BUILD=release blastersim.exe

Note that compilation of BlasterSim can be slow.

Once built, a BlasterSim executable should be moved to a directory on your PATH as discussed in § 1.2.

4.2.2 Compiling from Git

Building from the Git repository requires first building genunits and geninput from Ben Trettel’s FLT repository. The requirement for a modern Fortran compiler remains the same as that from § 4.2.1.

On Linux and macOS, clone the FLT repository and build genunits and geninput:

git clone https://github.com/btrettel/flt.git
cd flt
make BUILD=release genunits geninput

On Windows with jom, you should replace make genunits geninput with jom genunits.exe geninput.exe.

Place genunits or genunits.exe on your PATH. Now you can build BlasterSim by cloning the BlasterSim repository, cding into the clone, and following the instructions in § 4.2.1. To be more specific for GNU Make for Linux and macOS:

git clone https://github.com/btrettel/blastersim.git
cd blastersim
make BUILD=release blastersim

On Windows with jom, you should replace

make BUILD=release blastersim

with

jom BUILD=release blastersim.exe

And again, a BlasterSim executable should be moved to a directory on your PATH as discussed in § 1.2.

4.2.3 Compiling BlasterSim releases

BlasterSim releases are static binaries so that BlasterSim has no dependencies. The Makefiles will build static binaries if STATIC=yes is added to the Make command.

On Linux, run make BUILD=release STATIC=yes blastersim to build a release version of BlasterSim.

On Windows, run jom BUILD=release STATIC=yes blastersim.exe to build a release version of BlasterSim.

On macOS, it appears that static binaries can not be built. I do not yet have a good solution to this problem, but I’m working on it.

4.2.4 Compiling BlasterSim documentation

BlasterSim uses LaTeX for this documentation. All of the requirements from § 4.2.2 are required to compile the documentation as parts of it are auto-generated from BlasterSim tests. A LaTeX distribution like TeX Live for Linux or MikTeX for Windows is required to compile the documentation. On Linux, Aspell is also required for spell checking. Additionally, compiling the documentation requires that gentesthtml be built from the FLT repository mentioned previously. This can be compiled with make gentesthtml on Linux or with jom gentesthtml.exe on Windows.

BlasterSim’s PDF documentation can be compiled by running make docs/blastersim.pdf. BlasterSim’s HTML documentation can be compiled by running make docs/index.html.

Note that these Make commands will run some BlasterSim tests to generate some numbers to print in the documentation. This will slow down compilation of the documentation For speed, once the documentation numbers are generated, these BlasterSim tests will not be run again when compiling the documentation unless BlasterSim’s code changes.