Back to LAMMPS Packages Overview

Building Windows Installer Packages with MinGW64 Cross-compilers on Fedora Linux

This page describes the process of building installer packages for Windows using the MinGW64 cross-compiler toolchain as bundled with Fedora Linux. Using a Linux-hosted cross compiler has the advantage, that the process of building LAMMPS can be done with similar tools, makefiles and scripts than what is used routinely on Linux/Unix-like machines, which makes it easy to automate the process and minimizes the maintenance effort. It is possible to build and run LAMMPS natively on Windows using a Cygwin or MinGW environment. Another alternative for running LAMMPS on Windows is to install the Windows Subsystem for Linux on Windows 10 and then install or compile and run Linux executables in the embedded Ubuntu Linux subsystem with Bash on Windows.

Prerequisites

The cross-compilation is currently tested on Fedora Linux 27 and the following packages and their dependencies should be installed:

As a next step, a clone or snapshot file of the lammps-packages git repository from https://github.com/lammps/lammps-packages should be obtained. The scripts and files required to build Windows installer packages are located in the mingw-cross folder inside the lammps-packages directory.

The build-win-on-linux.py script

The main tasks of downloading sources, configuring, compiling and packaging the resulting files are managed by a script called build-win-on-linux.py. This script supports a number of flags that can be used to customize the build process and select what kind of binary to build and package.

Please note, that the build-win-on-linux.py only supports building LAMMPS versions from 11Aug2017 onward. The script makes assumptions about files and options, that are not available in older LAMMPS versions. and thus building older versions with this script is not likely to work.

Below is a list of the supported command line options:
Usage: python build-win-on-linux.py -b  -j  -p  -t  -r  -v 

Flags (all flags are optional, defaults listed below):
  -b : select Windows variant (default value: 64)
    -b 32       : build for 32-bit Windows
    -b 64       : build for 64-bit Windows
  -j : set number of CPUs for parallel make (default value: automatic)
    -j     : set to any reasonable number or 1 for serial make
  -p : select message passing parallel build (default value: no)
    -p mpi      : build an MPI parallel version with MPICH2 v1.4.1p1
    -p no       : build a serial version using MPI STUBS library
  -t : select thread support (default value: omp)
    -t omp      : build with threads via OpenMP enabled
    -t no       : build with thread support disabled
  -r : select LAMMPS source revision to build (default value: stable)
    -r stable   : download and build the latest stable LAMMPS version
    -r unstable : download and build the latest patch release LAMMPS version
    -r master   : download and build the latest development snapshot
    -r patch_  : download and build a specific patch release
    -r stable_ : download and build a specific patch release
    -r  : download and build a specific snapshot version
  -v : select output verbosity
    -v yes      : print progress messages and output of make commands
    -v no       : print only progress messages

Example:
  python build-win-on-linux.py -r unstable -t omp -p mpi
    

Compiling LAMMPS and building the installer package

After changing to a folder where the installer package or packages should be built, the python script is called and then a temporary directory is created - named after the various options selected - where the build is then performed. The script will print out messages about the progress of the build. With the option -v yes also, the screen output of all shell commands will be printed to the screen. At the end of the script run, the final installer package will be written to the current working directory, and the temporary folder and all its contents will be removed.


Last modified: Wed Aug 20:07:12 UTC 2017 by akohlmey