in 2012 I bought a student version of Matlab (r2012a, 32bit) which I have now installed on my Ubuntu 14.04.2 LTS. This far, everything works.

However, I would like to install SPM12 (a software used for analysing functional neuroimaging (and other) data, for which I need to compile certain mex-files. According to the install instructions accessible here, I need to run a number of commands, like this

cd /home/login/spm12/src
make distclean
make && make install
make external-distclean
make external && make external-install

Yet, while changing drive (obviously) and make distclean seem to run without problems, I get a couple of warnings when running make && make install, which look like this:

mex -O -largeArrayDims -c spm_vol_utils.c -DSPM_UNSIGNED_CHAR 

Warning: You are using gcc version "4.8.4-2ubuntu1~14.04)".  The version
     currently supported with MEX is "4.4.6".
     For a list of currently supported compilers see: 

mv -f spm_vol_utils.o  utils_uchar.mexa64.o

I get about fifteen of these warnings (apparently for various mex files to be compiled). As it appears, I would need to use gcc version 4.4.6 in order to compile these files, but searching for help online has not brought any success, neither running sudo apt-get install gcc-4.4

Any suggestions as to how I could compile these files?

2 Answers 2


Ok, so five more minutes of searching might have helped me to find an answer. Here is an explanation of how to set gcc to an older version.


First of all, are you sure the files failed to compile? Warnings are usually just that (warnings, not errors).

If you do want to compile with gcc-4.4.x, it is however still available from the Ubuntu 14.04 repositories, as package gcc-4.4 (although at least in 14.04.2 it appears to be minor version 4.4.7 rather than 4.4.6). You should be able to install it via the Software Center (or synaptic package manager, if it is installed) or from the command line using

sudo apt-get install gcc-4.4

Unless you symlink the binary to make it the system's default compiler (which I would not recommend), you will probably need to modify your mexopts.sh file to point directly to gcc-4.4 i.e.


An identical process can be used for g++ if your files need it i.e. install g++-4.4 and set CXX='g++-4.4' in mexopts.sh.

  • Thanks for the quick reply. I tried to modify my mexopts.sh file in the way you specified and as pointed out somewhere else, which unfortunately did not work. Therefore I followed the instructions I found here. Somehow I have the strange feeling that this proceeding is exactly the one you do not recommend.
    – bunsenbaer
    Jul 30, 2015 at 17:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .