Hi Malcolm,
Thanks for the extra details.
To modify the run_spm12.sh script not to require the MCR path at the
command line, you need to change two lines:
6c6
< if [ "x$1" = "x" ]; then
---
> if [ "x$1" = "y" ]; then
11c11
< MCRROOT=$1 ; shift 1
---
> MCRROOT=/export/matlab/MCR/R2010a/v713/
And you could then have 'spm' as a symbolic link to run_spm12.sh.
Alternatively you could use (and rename) the attached bash script that
will also be available in the next update of SPM12. You have to define
environment variables MCR_HOME and SPM_HOME in order to use it.
MCR_HOME="/export/matlab/MCR/R2010a/v713/"
SPM_HOME="/export/src/spm12/spm12"
Best regards,
Guillaume.
On 05/07/17 13:44, Malcolm Tobias wrote:
> Guillaume,
>
> Thanks for the response.
>
> 'spm' is a direct link to the executable:
>
> [root@login02 spm12]# ls -l spm
> lrwxrwxrwx 1 root root 13 May 24 10:17 spm -> spm12_glnxa64
>
> I realize the correct way to set up SPM is to use the bash scripts, but I
> couldn't get them to work without explicitly passing the path to the MCR.
>
> On our cluster we use software modules to configure most software, so I was
> using a module to replicate the environmental variables set by the
> run_spm12.sh script:
>
> [mtobias@login01 ~]$ cat /act/modulefiles/SPM
> #%Module1.0
> prepend-path PATH /export/src/spm12/spm12
> prepend-path LD_LIBRARY_PATH /export/matlab/MCR/R2010a/v713/runtime/glnxa64
>
>
>
> The first time I ran this as root it did work:
>
> [root@login02 spm12]# /export/src/spm12/spm12/run_spm12.sh
> /export/matlab/MCR/R2010a/v713
> Extracting CTF archive. This may take a few seconds, depending on the
> size of your application. Please wait...
> ...CTF archive extraction complete.
> SPM12 (6914): /export/src/spm12/spm12/spm12_mcr/spm12
>
>
> It depends on the directory that I'm located in. If I'm sitting in the
> directory that contains the CTF file, it starts up fine. If I'm sitting in any
> other directory, it complains that it can't find the CTF file:
>
> [root@login02 ~]# spm
> Extracting CTF archive. This may take a few seconds, depending on the
> size of your application. Please wait...
> Cannot find CTF archive '/root/spm12.ctf'.
>
> Error initializing CTF Archive
>
>
> I'm assuming the executable looks in the current directory for a CTF file to
> decide whether it's been extracted. I'm assuming there's some way to point it
> to the installation directory to look for the CTF file?
>
>
> I understand since I'm not doing this in the standard way that I'm basically
> on my own to make it work, but if anyone has any insight into this I'd
> appreciate it.
>
> Thanks,
> Malcolm
>
> On Tuesday, July 04, 2017 03:02:41 PM Guillaume Flandin wrote:
>> Hi Malcolm,
>>
>> What is 'spm' and where is it located on your system? Is it a bash
>> script in /foo/spm/ or a symbolic link to run_spm12.sh?
>> Do you confirm that you got the "Extracting CTF archive." message the
>> first time you used run_spm12.sh as root but that it was not displayed
>> thereafter?
>>
>> Best regards,
>> Guillaume.
>>
>> On 03/07/17 20:59, Malcolm Tobias wrote:
>>> I run a small compute cluster, and users have requested that I install
>>> SPM.
>>> I'm using the "stand-alone" version and have the MCR set up. I've run it
>>> once to extract the CTF (as root) and everything works fine.
>>>
>>> The problem occurs when non-privileged users try to run it. It seems SPM
>>> looks into their home directory for the CTF file:
>>>
>>> [mtobias@login01 ~]$ spm
>>> Extracting CTF archive. This may take a few seconds, depending on the
>>>
>>> size of your application. Please wait...
>>>
>>> Cannot find CTF archive '/home/mtobias/spm12.ctf'.
>>>
>>> Error initializing CTF Archive
>>>
>>> But the CTF file lives in the installation directory, say, /foo/spm. If I
>>> cd into the directory and start up SPM, it starts fine.
>>>
>>> My working is assumption is that SPM looks in either the current
>>> directory, or the home directory for the CTF file to verify that it has
>>> been extracted. Is there some option/environmental variable that I can
>>> use to have SPM to look in the installation directory for the CTF file?
>>> I've tried PATH/MATLABPATH/etc., so I'm guessing this is a SPM-specific
>>> option.
>>>
>>> Cheers,
>>> Malcolm
>>>
>>>
>>>
>>>
>>> --
>>> Malcolm Tobias
>>> 314.362.1594
>>>
>>>
>>>
>>> ________________________________
>>> The materials in this message are private and may contain Protected
>>> Healthcare Information or other information of a sensitive nature. If you
>>> are not the intended recipient, be advised that any unauthorized use,
>>> disclosure, copying or the taking of any action in reliance on the
>>> contents of this information is strictly prohibited. If you have received
>>> this email in error, please immediately notify the sender via telephone
>>> or return mail.
>
> --
> Malcolm Tobias
> 314.362.1594
>
>
>
> ________________________________
> The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.
>
--
Guillaume Flandin, PhD
Wellcome Trust Centre for Neuroimaging
University College London
12 Queen Square
London WC1N 3BG
#!/bin/sh
#
# Command Line Interface for SPM
# SPM: http://www.fil.ion.ucl.ac.uk/spm/
#
# Copyright (C) 2017 Wellcome Trust Centre for Neuroimaging
#
# Guillaume Flandin
# $Id: spm12-mcr 7014 2017-02-13 12:31:33Z guillaume $
if [ "${MCR_HOME}" = "" ]; then
echo "Set MCR_HOME environment variable." >&2
exit 1
fi
if [ ! -d "${MCR_HOME}" ]; then
echo "MCR directory not found." >&2
exit 1
fi
if [ "${SPM_HOME}" = "" ]; then
if [ "${PLATFORM}" = "Darwin" ]; then
RL_FLAG="" # alternative needed
else
RL_FLAG="-f"
fi
SPM_HOME=$(readlink ${RL_FLAG} "$0")
while [ ! -x "${SPM_HOME}/run_spm12.sh" ]; do
if [ "${SPM_HOME}" = "$(dirname "${SPM_HOME}")" ]; then
echo "Set SPM_HOME environment variable." >&2
exit 1
fi
SPM_HOME=$(dirname "${SPM_HOME}")
done
fi
if [ ! -d "${SPM_HOME}" ]; then
echo "SPM MCR directory not found." >&2
exit 1
fi
if [ ! -x "${SPM_HOME}/run_spm12.sh" ]; then
echo "SPM MCR executable not found." >&2
exit 1
fi
${SPM_HOME}/run_spm12.sh ${MCR_HOME} $@
|