Installing MINC from sources, using cmake superbuildEdit
Read installation instructions at https://github.com/BIC-MNI/minc-toolkit
Installing MINC from sources , using big makefile (outdated)Edit
The MINC tools have been successfully compiled on a wide variety of systems. Including SGI, Sun, Linux, Windows, Mac OS X and VAX. This tutorial covers how to install the minc tools by compiling the sources. The tutorial presumes that you are using GNU/Linux, the procedure to build on other platforms is sometimes subtly different but will largely follow the example below.
The MINC tools have a relatively large number of dependencies. The exact list of packages that needs to be installed before successfully compiling all the tools will depend on the target system, as every distribution of Linux/BSD comes with a different package set. In a new installation of Debian or Ubuntu, the following packages might be missing and need to be installed using apt-get or synaptic :
- g++ (older versions of N3 require g++ 4.2, yet there is no such restriction for the latest N3 release)
also, latex tools might be necessary to build the documentation. The following packages are required only if installing Display and/or register:
- opengl (libGL) dev
- glut (libglut) dev
This does not apply, however, for Nvidia-based video cards, which have their own libraries installed with the drivers. To check for these libraries, type:
A window with rotating gears should appear.
To install everything in one go via apt-get on Ubuntu or Debian, this should suffice:
$ sudo apt-get install libnetcdf-dev libhdf5-serial-dev libnetpbm9-dev \ fftw-dev libgsl0-dev libgetopt-tabular-perl libxext-dev glutg3-dev libsoqt3-dev \ libxmu-dev libxi-dev imagemagick libtext-format-perl libpcre++0 libpcre3 \ libsimage-dev libpcre++-dev autoconf perl-byacc flex g++ patch
In order to build the packages you might also need to install the compiler and GNU make:
$ sudo apt-get install gcc g++ make
Building from the source code using one big makefileEdit
A very large Makefile has been constructed, which builds much of the MNI-BIC content found on http://packages.bic.mni.mcgill.ca/tgz, in addition to a few other bits and pieces (notably parts of ITK). Please note that this process downloads, builds, and installs from source, and as such, if used, should be used instead of the aforementioned binary options (e.g. apt-getting minc-bundle). In addition, the presence of other minc libs from previous binary installs might result in the linker grabbing an older library, so it's best ensure that all previously installed minc components (e.g. netcdf, hdf5, etc) are removed prior to building. This method has been tested on several recent Linux distributions: Debian 5, Ubuntu 10.04, 10.10 & 11.04.
Step 1: Download the Make fileEdit
This file is currently part of Vlad Fonov's EZminc package, so that's where to find it. If problems, contact Vladimir Fonov <vladimir.fonov @NOSPAM@ mcgill.ca>.
Step 2: Decide on what you want to buildEdit
The Makefile provides quite a few build targets, the two extremes being make minc-only and make minc-full. Type make help to get a little help info, or take a look at the Makefile header with your favorite text editor in order to read details on all targets.
Step 3: Create your build and install directoriesEdit
The Makefile downloads source packages and builds them in a user-defined build directory, specified via the BUILD_DIR argument. Create this directory prior to starting the build. If not specified, the build will occur in your current directory (which is messy). All build products will be installed to the specified INSTALL_DIR. Note that if you want to install to a system directory, say, /usr/local/bic, you will need to run the Makefile under sudo.
Step 4: Ensure that prerequisite packages are installedEdit
Even though the big Makefile builds a lot of stuff, there are still some non-MNI-BIC packages that will need to be installed prior to the Make. Simply apt-get these packages; the Makefile header contains the apt-get statement that should do the job.
Step 5: Run your build(s)Edit
OK, now for the moment of truth. Here are some build examples:
- Minimal build: netcdf, hdf5, minc
make minc-only BUILD_DIR=$HOME/temp/build_minc INSTALL_DIR=$HOME/minc
- Full build: Build lots of stuff, plus register and Display, and install the MNI-BIC fitting models
make minc-full BUILD_DIR=$HOME/temp/build_minc INSTALL_DIR=$HOME/minc make models BUILD_DIR=$HOME/temp/build_minc INSTALL_DIR=$HOME/minc make visual BUILD_DIR=$HOME/temp/build_minc INSTALL_DIR=$HOME/minc
Please note that if anything goes wrong in one of the builds, the building of all dependent packages will not be attempted. To fix build errors, simply go into your BUILD_DIR/package_name directory and have a fiddle. As a matter of fact, this sort of fiddling is currently required when building Display under Ubuntu Lucid LTS (make visual), due to problems with libtool.
Building individual packagesEdit
It's possible to compile the MINC tools from individual packages. A typical installation will require:
Valuable additional scripts can be found here: http://packages.bic.mni.mcgill.ca/scripts/; these can be downloaded after the MINC tools have been installed.
First download the latest version of the MINC 2.x toolchain from http://packages.bic.mni.mcgill.ca/tgz
$ wget http://packages.bic.mni.mcgill.ca/tgz/minc-2.0.18.tar.gz
Then untar the package
$ tar zxvf minc-2.0.18.tar.gz
Enter the directory
$ cd minc-2.0.18
At this stage you should of course read the README file, and NEWS and ChangeLog files to discern what changes have been made since the last release. Lets presume you have done this.
In our case we want to install all the MINC Tools in /usr/local/bic and know that NetCDF and HDF5 have been previously installed in /usr/local. As such we will configure the package like this:
$ ./configure --with-build-path=/usr/local --prefix=/usr/local/bic
Note that with the minc2 libraries you will need to add an additional flag:
$ ./configure --with-minc2 --with-build-path=/usr/local --prefix=/usr/local/bic
A bunch of output will result from this command as configure checks for various libraries on your system. Running configure should generate a makefile. Which we can now use
This will build all the MINC files and now we can run the inbuilt checks that come with the MINC package. This is one of the advantages of building MINC from source as you can run the checks yourself, binary packages do not afford this possibility as the presumption is make that a build on one system will be fine on another system of the same platform. To run the checks type:
$ make check
The checks that are running will determine if underlying MINC API is self consistent plus a few other checks. Once the checks are complete the status is returned. You should see a line similar to this:
All 3 tests passed
It is now time to install MINC, given that we provided configure with a prefix argument this is the directory where the MINC API and base tools will be installed. In our case this is /usr/local/bic to do this type the following:
$ make install
This will install a number of things into four subdirectories in /usr/local/bic. Executable programs in bin/ header files in include/ library files in lib/ and manual pages in man/.
We can test the installation with something like this:
$ mincmath -version
This should return both the version number of the program and the underlying libraries.