JAGS (Just Another Gibbs Sampler) Installation.

For those fascinated by the world of analysis of Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC) simulation (and let's face it, who isn't?), there is a delightful program called JAGS. Unfortunately it is a little stubborn to install.

Download the latest version from our friends at Sourceforge and extract in a sensible place (e.g., /usr/local/src/JAGS.

Now witness some example failures to install, which a reasonable person would assume would be sufficient.


../config
configure: error: "You need to install the LAPACK library"
module load lapack
configure: error: "You need to install the LAPACK library"
./configure --prefix=/usr/local/jags/3.3.0/ --with-lapack=/usr/local/lapack/3.4.1/
configure: error: "You need to install the LAPACK library"

Loading the lapack environment modules doesn't help. What actually worked was the following:

LDFLAGS="-L/usr/local/blas/1.0.248/lib -L/usr/local/atlas/3.8.4-gcc/lib" F77=gfortran ./configure --prefix=/usr/local/jags/3.3.0/ --with-lapack=/usr/local/lapack/3.4.2/lib/liblapack.so

Then you can engage in the usual installation process.


make
make check
make install
make installcheck

Create a modulefile for the version and symlink.


cd /usr/local/Modules/modulefiles/jags
ln -s .base 3.4.0

The .base module looks like:


#%Module1.0#####################################################################
##
## $name modulefile
##
set ver [lrange [split [ module-info name ] / ] 1 1 ]
set name [lrange [split [ module-info name ] / ] 0 0 ]
set loading [module-info mode load]
set desc [join [read [ open "/usr/local/Modules/modulefiles/$name/.desc" ] ] ]
proc ModulesHelp { } {
puts stderr "\tThis module sets the envinronment for $name v$ver"
}
module-whatis "$desc (v$ver)"
prepend-path --delim " " CFLAGS -I/usr/local/$name/$ver/include
prepend-path --delim " " CPPFLAGS -I/usr/local/$name/$ver/include
prepend-path --delim " " LDFLAGS -L/usr/local/$name/$ver/lib
prepend-path LD_LIBRARY_PATH /usr/local/$name/$ver/lib
prepend-path PATH /usr/local/$name/$ver/bin
prepend-path MANPATH /usr/local/$name/$ver/share/man