From GridLAB-D Wiki
Jump to: navigation, search

These instructions will set up the MSYS2 environment, which is the preferred approach to building GridLAB-D from the source files.

Installing MSYS2

The MSYS2 environment is used to build GridLAB-D 4.1 or newer for the Windows OS. It can be downloaded from http://www.msys2.org. From the website download the appropriate MSYS2 installer for 64bit (x86_64) OS’s and install MSYS2 on your machine.

Setting Up the MSYS2 Environment

To start the MSYS2 environment start msys2.exe (or use the "MSYS2 MinGW x64" link in the Program menu). As can be seen MSYS2 provides a Linux-like command terminal and environment for building GNU compliant C/C++ executables for Windows OS’s. When Running the MSYS2 environment for the first time updates will need to be performed. To perform update run

pacman -Syuu

Type "y" and hit enter to continue. if you get a line like the following

:: To complete this update all MSYS2 processes including this terminal will be
closed.  Confirm to proceed [Y/n]

Type "y" and hit enter. The MSYS2 window will close. Reopen MSYS2 (ideally with the "MSYS2 MinGW x64" shortcut). Then to continue the updates run

pacman -Su

Type "y" and hit enter. You shouldn't get the warning messages from before this time.

In order to build GridLAB-D There are a couple MSYS2 packages that need to be installed. They are as follows:

  • base-devel: This package provide the necessary make program needed to compile GridLAB-D
  • mingw-w64-x86_64-cmake: This package provides the compiler/build configuration tools needed to compile GridLAB-D
  • mingw-w64-x86_64-gcc(64 bit machines): This package provides gcc compiler for compiling C/C++ code.
  • git: This is required so the GridLAB-D GitHub repository can be checked out.

In order to install these packages type the following:

  • 64 bit machines:
pacman -S --needed base-devel mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc git

Important note!!!!! After doing this /mingw64/bin needs to be added to the path variable. In fact it would be a good idea to build a shell script so that /mingw64/bin is added to PATH when MSYS2 is started. The command to add it to the path (per session) is along the lines of (for 64-bit):

export PATH=$PATH:/mingw64/bin

Alternatively, run the "MSYS2 MinGW 64-bit" shortcut in the Programs menu.