Differences between revisions 3 and 4
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
This page walks through the process of building the !FreeSurfer source code and creating a distribution. For an introduction to the repository and the development process, visit the [[DevGuide|Dev Guide]]. This page walks through the process of building the freesurfer source code and creating a distribution. For an introduction to the repository and the development process, visit the [[DevGuide|Dev Guide]].
Line 5: Line 5:

<<BR>>
Line 7: Line 9:
Freesurfer depends on a variety of third-party packages, and the following recommends the easiest way to install these requirements on your machine.

''This section can be ignored by those developing on the Martinos filesystem.''
Line 8: Line 14:

On ubuntu/debian, install a few of the build dependencies with apt-get:

{{{
sudo apt-get update
sudo apt-get install build-essential tcsh cmake gfortran \
  libglu1-mesa-dev libfreetype6-dev uuid-dev \
  libxmu-dev libxmu-headers libjpeg62-dev \
  libxi-dev libx11-dev libxml2-utils libxt-dev \
  libxaw7-dev liblapack-dev
}}}

If gcc4.8 or higher is not installed on your machine, run:

{{{
## install gcc/g++/gfortran version 4.8
sudo apt-get install gcc-4.8 g++-4.8 libgfortran-4.8-dev

## set as default compiler
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
}}}

The remaining dependencies can be built locally using the build_packages.sh freesurfer script, or they can just be downloaded as prebuilt packages (recommended). The following will create a `packages` directory containing a set of required freesurfer dependencies (built on centos7):

{{{
curl https://surfer.nmr.mgh.harvard.edu/pub/data/fspackages/prebuilt/centos7-packages.tar.gz -o centos7-packages.tar.gz
tar -xzvf centos7-packages.tar.gz
}}}
Line 14: Line 49:
brew install cmake gcc5 glib
brew install
qt5 # optional (for building GUIs)
brew install cmake gcc5 qt5
Line 21: Line 55:
curl
tar -xzvf
curl https://surfer.nmr.mgh.harvard.edu/pub/data/fspackages/prebuilt/osx10.11-packages.tar.gz -o osx10.11-packages.tar.gz
tar -xzvf osx10.11-packages.tar.gz
Line 25: Line 59:

<<BR>>
Line 32: Line 68:
<<BR>>
Line 40: Line 77:
External users not developing on the Martinos filesystem will get an error saying "". To resolve this, you must point cmake to the full path of the packages directory configured above with the following flag: <!> External users not developing on the Martinos filesystem will get an error saying "". To resolve this, you must point cmake to the full path of the packages directory configured above with the following option:
Line 46: Line 83:
This path can also be set in an FS_PACKAGES_DIR environment variable, so that it doesn't need to be supplied on the command line for every new configuration. This path can also be set in an `FS_PACKAGES_DIR` environment variable, so that it doesn't need to be supplied on the command line for every new configuration.
Line 50: Line 87:
By default, freesurfer will install to /usr/local/freesurfer, but the install path can be configured with: By default, freesurfer will install to `/usr/local/freesurfer`, but the install path can be configured with:
Line 56: Line 93:
Alternatively, this path can be set in an FS_INSTALL_DIR environment variable to avoid having to specify it for every configuration. Alternatively, this path can be set in an `FS_INSTALL_DIR` environment variable to avoid having to specify it for every configuration.
Line 63: Line 100:
<<BR>>
Line 67: Line 105:
The current 8-threaded build time is roughly 6 minutes. Single-threaded builds can take between ? and ? minutes. The current 8-threaded build time is roughly 6 minutes. Single-threaded builds can take between 10 and 20 minutes.

FreeSurfer Build Guide

This page walks through the process of building the freesurfer source code and creating a distribution. For an introduction to the repository and the development process, visit the Dev Guide.


Build Requirements

Freesurfer depends on a variety of third-party packages, and the following recommends the easiest way to install these requirements on your machine.

This section can be ignored by those developing on the Martinos filesystem.

Linux

On ubuntu/debian, install a few of the build dependencies with apt-get:

sudo apt-get update
sudo apt-get install build-essential tcsh cmake gfortran \
  libglu1-mesa-dev libfreetype6-dev uuid-dev \
  libxmu-dev libxmu-headers libjpeg62-dev \
  libxi-dev libx11-dev libxml2-utils libxt-dev \
  libxaw7-dev liblapack-dev

If gcc4.8 or higher is not installed on your machine, run:

## install gcc/g++/gfortran version 4.8
sudo apt-get install gcc-4.8 g++-4.8 libgfortran-4.8-dev

## set as default compiler
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50

The remaining dependencies can be built locally using the build_packages.sh freesurfer script, or they can just be downloaded as prebuilt packages (recommended). The following will create a packages directory containing a set of required freesurfer dependencies (built on centos7):

curl https://surfer.nmr.mgh.harvard.edu/pub/data/fspackages/prebuilt/centos7-packages.tar.gz -o centos7-packages.tar.gz
tar -xzvf centos7-packages.tar.gz

OSX

Freesurfer is supported on OSX El Capitan (10.11) and later, and we recommend using the brew package manager to install a few of the build dependencies:

brew install cmake gcc5 qt5

The remaining dependencies can be built locally using the build_packages.sh freesurfer script, or they can just be downloaded as prebuilt packages (recommended). The following will create a packages directory containing a set of required freesurfer dependencies (built on OS X 10.11.6):

curl https://surfer.nmr.mgh.harvard.edu/pub/data/fspackages/prebuilt/osx10.11-packages.tar.gz -o osx10.11-packages.tar.gz
tar -xzvf osx10.11-packages.tar.gz


Source

get source from github or fork --

get annex data --


Configuration

Freesurfer supports both in-source and out-of-source builds using CMake (although tests can only be run from an in-source build). To configure a simple in-source build tree, enter the top-level directory of the repository and run:

cmake .

<!> External users not developing on the Martinos filesystem will get an error saying "". To resolve this, you must point cmake to the full path of the packages directory configured above with the following option:

cmake . -DFS_PACKAGES_DIR="/path/to/packages"

This path can also be set in an FS_PACKAGES_DIR environment variable, so that it doesn't need to be supplied on the command line for every new configuration.

Install Path

By default, freesurfer will install to /usr/local/freesurfer, but the install path can be configured with:

cmake . -DCMAKE_INSTALL_PREFIX="/path/to/desired/install"

Alternatively, this path can be set in an FS_INSTALL_DIR environment variable to avoid having to specify it for every configuration.

Optimization and Debugging

Modules


Building

Once your build tree has been configured appropriately, freesurfer can be compiled with make and installed with make install. Additionally, unit and regression tests can be run with make test (previously make check) from individual subdirectories or from the top-level.

The current 8-threaded build time is roughly 6 minutes. Single-threaded builds can take between 10 and 20 minutes.

BuildGuide (last edited 2021-03-04 07:20:54 by buildqa)