SPM5 Debacle

I spent a week pulling my hair out whilst debugging errors I encountered during my initial setup of SPM5. I'm a neophyte and my hope is that this info will prove useful to someone else.

I had attempted to create a working SPM5 environment with an unlucky combination of elements: Debian Gnu/Linux (the "etch", or "stable", release) on an 8-core 6-bit machine; SPM5; and Matlab 2007b. My initial problems appeared to revolve around several SPM functions that would throw exceptions like "Too many images" (e.g. spm_bsplinc) even though I was confident that I was passing a proper and acceptable input argument.

Recompiling the MEX-files in spm5/src and installing them got rid of this problem, only to replace it with a more sinister series of problems, which tended to involve error messages like the following:

Invalid MEX-file '/software/spm5/mat2file.mexa64': /lib/libc.so.6: version `GLIBC_2.4' not found (required by /software/spm5/mat2file.mexa64).

This is not an SPM problem, but rather arises due to the different versions of the GNU C library that the Mathworks uses in each release of their compiler. The Debian "stable" release ships with version 2.3.6 at the time of writing, which is older than the one Mathworks used in Matlab 2007b. (You'd think that the standard C libraries wouldn't change every other week, but they do seem to change often). So I would run 'make' in spm5/src, and things would happily compile without exception, but runtime errors like the one above would arise.

I could also see the error message by running ldd against the compiled MEX-files; clearly, they wanted a glibc of at least version 2.4.

The solution? Downgrade to Matlab R14 sp3 and recompile the MEX-files. Everything works fine now.

Another possible solution would have been to build an alternate glibc and install it in a nonstandard location, then use LD_LIBRARY_PATH to specify that location. This is pretty gnarly, however and will almost assuredly cause other problems.

I believe that the next iteration of Debian will ship with glibc 2.7.something so as long as Mathworks isn't too aggressive with which glibc they use in future releases, Debian users should be ok... for a while. Other major GNU/Linux distros use different versions of glibc and I suspect that many use at least 2.4.

I hope this helps someone.