Dear Satoshi:
We also run SPM on HP platforms. Here is what our programmer had to do to
get this to run.
1) We compiled it using HP's ansi C compiler. You cannot use the compiler
that comes with the system. This compiler is brain dead and is only useful
for compiling the kernel. I think this is what happened to you when you
tried cc. You either have to purchase the ansi C compiler from HP or use
something like gcc. I don't know whether the modifications described below
would work in gcc. Also you should be using the spm_MAKE.sh scripts to
compile spm.
The following 3 changes were mainly to deal with compiler warnings. I don't
think they prevented the code from compiling.
2) Modified spm_add.c, note line 46 has been commented out and the last
line added
/*
----------------------------------------------------------------------------
* 17 May 99 Change assignment of NaN from 0.0/0.0 to mxGetNaN() -- R Ray
*
---------------------------------------------------------------------------
*/
int mask0flag = 0, floatflag = 0;
/* double NaN = 0.0/0.0; /* the only way to get a NaN that I know */
double NaN;
mxArray *wplane_args[3];
int maxval, minval;
int dtype;
NaN = mxGetNaN();
3) modified spm_brainwarp.c change made on line 3
/*
---------------------------------------------------------------------------
*/
/* 15 May 99 Change #endif lint so that "lint" is enclosed in comment -- R
Ray */
/*
---------------------------------------------------------------------------
*/
#ifndef lint
static char sccsid[] = "@(#)spm_brainwarp.c 2.8 (c) John Ashburner
MRCCU/FIL (& Matthew Brett MRCCU) 99/05/10";
#endif /* lint */
4) modified spm_max.c to fix redefinition of MAX. First change is on line
40, the others are on lines 262 and 272. Surrounding code included below.
/* -------------------------------------------------------------------------
* 17 May 99 Change #define MAX to #define Z_MAX to avoid re-definition
* of MAX as declared in /usr/include/sys/param.h -- R Ray
*
-------------------------------------------------------------------------
*/
#define NUM plhs[0]
#define Z_MAX plhs[1]
#define LOC plhs[2]
#define IND plhs[3]
mxFree(vol);
Z_MAX = mxCreateDoubleMatrix(1, nb_lm, mxREAL);
LOC = mxCreateDoubleMatrix(3, nb_lm, mxREAL);
NUM = mxCreateDoubleMatrix(1, nb_lm, mxREAL);
IND = mxCreateDoubleMatrix(1, nb_lm, mxREAL);
for (i = 0; i < nb_lm; i++) {
mxGetPr(NUM)[i] = (double) num[i];
}
for (i = 0; i < nb_lm; i++) {
mxGetPr(Z_MAX)[i] = (double) max[i];
}
for (i = 0; i < 3*nb_lm; i++) {
mxGetPr(LOC)[i] = (double) loc[i];
}
for (i = 0; i < nb_lm; i++) {
mxGetPr(IND)[i] = (double) ind[i];
}
mxFree(num);
mxFree(loc);
mxFree(max);
mxFree(ind);
}
5) The following changes were made to spm_MAKE.sh. Note that HP requires
compilation using the +z option to generate position independent code which
is necessary to generate shared libraries. If you need further explanation
of this check your C manuals. I don't know what the option would be for gcc.
# 05/17/99 Modified hpux cc options for
# ANSI conformance and its HP extension ( -Ae )
# Changed PIC flag from +Z to +z
# Added +DAportable so that modules will work on PA 1.1 arch--
R Ray
#__________________________________________________________________________
below are lines 81-84 in spm_MAKE.sh modified as above
# unix compile for hpux cc, and maybe aix cc
CC="cc -O +z -Ae +DAportable"
cmex5="mex COPTIMFLAGS=-O"
cmex4="mex -V4 COPTIMFLAGS=-O";;
6) Note that in spm96 using the early PA2.0 architecture we had to define
our own function called rint.c Even though rint was part of the math
libraries HP didn't seem to recognize it. We did not need to define rint on
the current systems which use I think PA2.1- if your systems are up to date
on 10.20 then you should be fine. I don't think you'll need this for your
current system.
For posterity rint.c is (this would have to be compiled before spm_make.sh
is invoked.
#include <math.h>
double rint(double x)
{
return(floor(x + .5));
}
Hope this helps and happy new year,
Darren
-------------------------------------------------------------------
Darren R. Gitelman, M.D. E-mail: [log in to unmask]
Cognitive Neurology and Voice: (312) 908-9023
the Alzheimer's Disease Center Fax: (312) 908-8789
WWW: http://www.brain.nwu.edu
Northwestern Univ., 320 E. Superior St., Searle 11-470, Chicago, IL 60611
-------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|