Building on Linux

The instructions below document an old version of the GMAT build procedure.  Current GMAT builds are generated using the Cmake build system, as documented on the Compiling GMAT (CMake Build System) page.

These instructions were copied from Building on Mac. If you see Mac-specific details here (or Linux-specific details missing), please update them.

Get the code

Follow the instructions on the Downloads page to check out a copy of the GMAT source code from SourceForge.

Optionally, you can also check out a copy of the plugins repository further down on that page. If you choose to get the plugins code, you only need to check out the trunk/code directory from the repository. The rest is associated testing and documentation code, and is quite large.

We'll refer to the SourceForge checkout as sf and the internal code checkout as plugins.

Get the prerequisites

Toolchain

You'll need the standard GNU toolchain, including GCC and make.

wxWidgets

GMAT needs a version of wxWidgets with OpenGL enabled and Unicode disabled. This usually means building a custom wxGTK library:

  1. Download wxGTK 2.8.12 from http://wxwidgets.org.
  2. Unzip and untar the downloaded file.
  3. In a Terminal, run the following commands from the new wxGTK-2.8.12 directory (replacing /path/to/wxGTK-2.8.12 with the absolute path to your wxGTK-2.8.12 directory): 
    chmod a+x ./configure
    mkdir build-gmat
    cd build-gmat
    ../configure --prefix=/path/to/wxGTK-2.8.12/build-gmat --with-opengl
  4. Run make to compile the wxGTK libraries:
    make
  5. Run make install to install the libraries and correctly set install paths. This is necessary due to bug GMT-3021.
    make install

SPICE

  1. Download http://naif.jpl.nasa.gov/pub/naif/toolkit//C/PC_Linux_GCC_32bit/packages/cspice.tar.Z.
  2. Uncompress and untar cspice.tar.Z to result in a cspice directory.

f2c

  1. Download smb://mesa-file/595/GMAT/GMAT_3rdParty.zip (internal users only)
  2. Unzip and move the f2c32 directory to your preferred location.

PCRE

  1. Download PCRE from http://www.pcre.org
  2. Unzip and untar the downloaded file
  3. Run the following commands from the extracted pcre-#.## folder:
    ./configure
    make

Configure GMAT

  1. Set the following environment variable:
    PLATFORM=linux
  2. Copy sf/trunk/build/macosx/BuildEnv.mk to sf/src
  3. Edit BuildEnv.mk to set the following variables:
    TOP_DIR: path to the sf directory
    WX_INSTALLED: path to the directory containing wx-config; usually this is the wxGTK-2.8.12/build-gmat directory
    WX_LIB_LOC: path to the directory containing the compiled wx libraries; usually this is the wxGTK-2.8.12/build-gmat/lib directory
    SPICE_DIR: path to the directory containing the cspice directory
    F2C_LOC: path to the directory containing the f2c32 directory
    PCRE_LIB_LOC: path to the PCRE library location; usually pcre-#.##/.libs

Configure the bundled plugins

The public GMAT repository (on SourceForge) includes several plugins that can be compiled along with the main application.

MatlabInterfacePlugin

The MatlabInterfacePlugin is available on OS X Leopard (10.5) and Snow Leopard (10.6) only.

  1. Copy sf/plugins/MatlabInterfacePlugin/build/mac_snowleopard/MatlabInterfaceEnv.mk (or mac_leopard) to sf/plugins/MatlabInterfacePlugin/src.
  2. Edit the new sf/plugins/MatlabInterfacePlugin/src/MatlabInterfaceEnv.mk file:
    WX_INSTALLED: path to the directory containing wx-config; usually this is the wxMac-2.8.12 directory
    MATLAB_DIR: path to a MATLAB app (such as /Applications/MATLAB_R2012a.app)


Plugin configuration: To use the MATLAB interface plugin, you must have the following environment variable configured:
MATLABFORGMAT=/path/to/MATLAB_ver.app
You can do this system-wide by putting the variable and its value into the file ~/.MacOSX/environment.plist using the OS X Property List Editor. See Apple QA1067 for details. You'll need to log off and log back on before the setting will take effect.

CInterfacePlugin (alpha)

Copy sf/plugins/CInterfacePlugin/build/macosx/CInterfaceEnv.mk to sf/plugins/CInterfacePlugin/src. No extra configuration of this file is necessary.

EphemPropagatorPlugin (alpha)

  1. Copy sf/plugins/EphemPropagatorPlugin/build/macosx/EphemPropEnv.mk to sf/plugins/EphemPropagatorPlugin/src.
  2. Edit the new sf/plugins/EphemPropagatorPlugin/src/EphemPropEnv.mk file:
    SPICE_DIR: path to the directory containing cspice

EstimationPlugin (alpha)

Copy sf/plugins/EstimationPlugin/build/macosx/OdEnv.mk to sf/plugins/EstimationPlugin/src. No extra configuration of this file is necessary.

EventLocatorPlugin (alpha)

Copy sf/plugins/EventLocatorPlugin/build/macosx/EventLocatorEnv.mk to sf/plugins/EventLocatorPlugin/src. No extra configuration of this file is necessary.

ExtraPropagatorsPlugin (alpha)

  1. Copy sf/plugins/ExtraPropagatorsPlugin/build/macosx/ExtraPropagatorEnv.mk to sf/plugins/ExtraPropagatorsPlugin/src.
  2. Edit the new sf/plugins/ExtraPropagatorsPlugin/src/ExtraPropagatorEnv.mk file:
    GMAT_CODE_LOCATION: path to sf/src
    GMAT_BIN_LOCATION: path to sf/application/bin

FminconOptimizerPlugin

The FminconOptimizerPlugin is not available on Mac OS X.

Build GMAT and plugins

  1. Change to the top-level sf directory
  2. Run make
  3. If you built CInterfacePlugin:
    1. Copy the contents of sf/plugins/CInterfacePlugin/matlab to sf/application/matlab/libCInterface.
    2. Change to the sf/plugins/CInterfacePlugin/build/matlab directory.
    3. In MATLAB, run prepareInterface.m.

Configure and build the internal plugins

At the beginning of this guide, you may have checked out the trunk/code directory from the internal plugins repository. We'll refer to the location of this working copy as plugins.

Msise86Plugin

  1. Copy sf/plugins/Msise86Plugin/build/macosx/Msise86Env.mk to sf/plugins/Msise86Plugin/src.
  2. Edit the new sf/plugins/Msise86Plugin/src/Msise86Env.mk file:
    GMAT_CODE_LOCATION: path to sf/src; you'll need to remove one "../" and change trunk to the name you gave your sf working copy.
    GMAT_BIN_LOCATION: path to sf/application/bin; you'll need to remove one "../" and change trunk to the name you gave your sf working copy.
    F2C_LOCATION: path to the directory containing the f2c32 directory; you'll need to remove one "../" and change GMAT_3rdParty to the name of the directory above the f2c32 directory.
  3. Change to the sf/plugins/Msise86Plugin directory.
  4. Run make

The libMsise86.dylib plugin will be copied to the sf/application/plugins/proprietary directory.

NRLMsise00Plugin

  1. Copy sf/plugins/NRLMsise00Plugin/build/macosx/NRLMsise00Env.mk to sf/plugins/NRLMsise00Plugin/src.
  2. Edit the new sf/plugins/NRLMsise00Plugin/src/NRLMsise00Env.mk file:
    GMAT_CODE_LOCATION: path to sf/src; you'll need to remove one "../" and change trunk to the name you gave your sf working copy.
    GMAT_BIN_LOCATION: path to sf/application/bin; you'll need to remove one "../" and change trunk to the name you gave your sf working copy.
    F2C_LOCATION: path to the directory containing the f2c32 directory; you'll need to remove one "../" and change GMAT_3rdParty to the name of the directory above the f2c32 directory.
  3. Change to the sf/plugins/NRLMsise00Plugin directory.
  4. Run make

The libNRLMsise00.dylib plugin will be copied to the sf/application/plugins/proprietary directory.

Vf13OptimizerPlugin

  1. Copy sf/plugins/Vf13OptimizerPlugin/build/macosx/Vf13OptimizerEnv.mk to sf/plugins/Vf13OptimizerPlugin/src.
  2. Edit the new sf/plugins/Vf13OptimizerPlugin/src/Vf13OptimizerEnv.mk file:
    GMAT_CODE_LOCATION: path to sf/src; you'll need to remove one "-+ ../+-" and change trunk to the name you gave your sf working copy.
    GMAT_BIN_LOCATION: path to sf/application/bin; you'll need to remove one "-+ ../+-" and change trunk to the name you gave your sf working copy.
    F2C_LOCATION: path to the directory containing the f2c32 directory; you'll need to remove one "-+ ../+-" and change GMAT_3rdParty to the name of the directory above the f2c32 directory.
  3. Change to the sf/plugins/Vf13OptimizerPlugin directory.
  4. Run make

The libVF13Optimizer.dylib plugin will be copied to the sf/application/plugins/proprietary directory.

MarsGRAMPlugin (alpha)

  1. Copy sf/plugins/MarsGRAMPlugin/build/macosx/MarsGRAMEnv.mk to sf/plugins/MarsGRAMPlugin/src.
  2. Edit the new sf/plugins/MarsGRAMPlugin/src/MarsGRAMEnv.mk file:
    GMAT_CODE_LOCATION: path to sf/src
    GMAT_BIN_LOCATION: path to sf/application/bin
  3. Change to the sf/plugins/MarsGRAMPlugin directory.
  4. Run make

The libMarsGRAM.dylib plugin will be copied to the sf/application/plugins/proprietary directory.

CcsdsEphemerisFilePlugin

This plugin is obsolete and is no longer maintained.

DataFilePlugin

This plugin is obsolete and is no longer maintained.