[FSL] [TitleIndex] [WordIndex

Preparing a build environment

These notes detail how to create a development environment suitable for compiling the FSLView project. You may be able to download and install binary installations of some of these packages, however details of how to compile them from sources are available here in case you don't have access to the pre-built versions.

Wherever possible these instructions performing an out-of-source build, i.e., a build in a separate directory from the source directory. This is desirable because it allows you to re-build with various different switches from the same source tree, e.g., maintaining separate debug and optimised builds. At FMRIB we build all releases of FSLView, each supported architecture with both debug and release flags, from a single shared source directory. When this works it is very useful and FSLView is intended to be built this way.

These instructions will install these packages into their own directory within /usr/local allowing the use/testing of different versions. You don't need to do this but it'll make following the instructions easier if you do.

Dependencies

The following packages are required to build FSLView:

Package name

Minimum Version

Notes

BOOST

1.33.1

Probably any version above 1.29 (first one I tried) will do.

Qt

3.1.x-3.3.x

On my systems the uic compiler messes up the icons for qt < 3.3

Qwt

4.2.0

Do not try Qwt 5.x

CMake

2.2-patch 3

VTK

5.0

FSL

3.3.x

Platform Notes

MacOSX Leopard/Snow Leopard (version 10.5/10.6) are not supported by Trolltech for Qt 3.x variants - Qt 3.x was end-of-lifed in July 2007. We are quite likely to be porting to Qt 4.x soon but until that time you will need to obtain Tiger (10.4) binaries on Leopard/Snow Leopard machines.

Configuring and building the dependent packages

CMake

A word about CMake

This package performs a wide range of build configuration tasks which are difficult to achieve with other systems (including the popular automake and autoconf tools).

Download from CMake download page and unpack into your source directory.

Configure and build as follows:

cd CMake
mkdir build
cd build
../configure
make
make install

Platform Notes

MacOSX Libraries created using the switch: -install_name @executable_path/../Frameworks/ can be copied into the FSLView.app/Contents/Frameworks subdirectory creating a relocatable bundle. To get CMake to build libraries this way modify the /usr/local/share/CMake/Modules/Platform/Darwin.cmake file with this patch:

cd /usr/local/shared/CMake/Modules/Platform
patch -i cmakepatch.txt

Configure cmake projects without rpath support, i.e. CMAKE_USE_RELATIVE_PATHS=OFF.

BOOST

Download from boost.org and unpack into /usr/local/boost

We're only using some of the template classes from boost so we don't need anything but header files, therefore, you don't need to compile boost.

Qt

Important

You may well have qt already installed on your machine. Most Linux distributions ship with Qt to support the popular KDE windowing system. If it's already on your system then I recommend you try using that version before installing from scratch. If you decide to do this then you will need to change QTDIR in all the subsequent builds accordingly.

Warning

Qt can take a very long time to compile. You can speed things up a little by editing the Makefile file in the distribution top-level source directory and removing the sub-tutorial and sub-example references from the all: target.

Important

When building Qt you must ensure that other installations of Qt aren't pathed in. In particular it can ruin the installation if an old qt/lib directory is used by the qt tools during the build.

Download from Trolltech Qt Site and unpack into your source directory.

Configure and build as follows:

Platform notes

MacOSX Currently a bug in the build means that it will fail due to a missing Info.plist file. Restart the build at this point to complete the rest of the compilation.

MacOSX As with CMake you need to modify the link stages if you want to make relocatable .app bundles. (Un)comment the relevant lines in mkspec/macx-g++/qmake.conf and/or mkspec/darwin-g++/qmake.conf configuration before building.

MacOSX X11 (untested) Set MAKESPECS to darwin-g++ to enable building with X11 support.

Qwt

Download from Qwt Sourceforge and unpack into your source directory.

Bizarrely Qwt doesn't have an install target for its main components (only for the plugin!) so add one to /home/sources/qwt-4.2.0/qwt.pro as follows:

cat >> qwt.pro
INSTALLBASE    = /usr/local/qwt
target.path    = $$INSTALLBASE/lib
headers.path   = $$INSTALLBASE/include
headers.files  = $$HEADERS
INSTALLS       = target headers

Configure and build as follows:

export QTDIR=/usr/local/qt
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$QTDIR/lib:$DYLD_LIBRARY_PATH
cd /home/builds; mkdir qwt; cd qwt
qmake /home/sources/qwt-4.2.0/qwt.pro
make
make install
mkdir designer; cd designer
qmake /home/sources/qwt-4.2.0/designer/qwtplugin.pro
make
make install

VTK

Download from VTK download page and unpack into your source directory.

Configure and build as follows:

export QTDIR=/usr/local/qt
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$QTDIR/lib:$DYLD_LIBRARY_PATH
cd /home/builds; mkdir vtk; cd vtk
export QTDIR=/usr/local/qt
cmake /home/sources/VTK \
  -DCMAKE_INSTALL_PREFIX=/usr/local/vtk -DCMAKE_BUILD_TYPE=Release \
  -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON \
  -DVTK_USE_GUISUPPORT=ON -DVTK_USE_QVTK=ON
make
make install

FSLView

Getting the sources

FSL distribution

The sources are bundled with every FSL distribution and in particular the fsl-X.Y.Z-sources.tar.gz or Uncompiled sources only download. Look in $FSLDIR/src/fslview for them.

Via CVS

FMRIB account holders only may get the sources via our CVS repository. Set up your environment as follows:

export CVSROOT=:ext:mace.fmrib.ox.ac.uk:/usr/local/share/sources
export CVS_RSH=ssh

Now check out the fslview project:

cvs co fslview

Supporting FSL modules should come from your existing FSL installation.

Setting up your environment variables

You need to set QTDIR, PATH and LD_LIBRARY_PATH (DYLD_LIBRARY_PATH on Mac OS X) so all the Qt and Qwt tools and libraries can be found. In the following everything has been installed into the /usr/local directory tree.

export QTDIR=/usr/local/qt
export PATH=$QTDIR/bin:$PATH
export QWTDIR=/usr/local/qwt
export LD_LIBRARY_PATH=$QTDIR/lib:$QWTDIR/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$QTDIR/lib:$QWTDIR/lib:$DYLD_LIBRARY_PATH

If you're building using a pre-installed FSL distribution then you also need to set FSLDIR as per the FSL instructions.

Configuring a CMake build tree

It is recommended that you always configure the build trees away from the source directories. This has several advantages including being able to build for multiple platforms or configurations (i.e. Release/Debug) from the same sources. CMake makes this particularly easy:

cd /home/builds; mkdir fslview-release; cd fslview-release
cmake $FSLDIR/src/fslview \
  -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \
  -DVTK_DIR=/usr/local/vtk/lib/vtk-5.0 -DBOOST_DIR=/usr/local/boost \
  -DQWT_DIR=/usr/local/qwt

Running make

Now you're ready to build the binary:

make
make install

Troubleshooting

For troubleshooting see the FslView FAQ.


2017-04-20 13:28