HOWTO set up the GlueX environment

From GlueXWiki
Revision as of 15:24, 26 September 2012 by Marki (Talk | contribs) (gluex_env.csh and gluex_env.sh)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Getting the scripts

The scripts mentioned in this HOWTO are available from our Subversion repository:

svn checkout https://halldsvn.jlab.org/repos/trunk/scripts/build_scripts

gluex_env.csh and gluex_env.sh

This is a generic script for defining all of the environment variables necessary to run GlueX software. gluex_env.csh is appropriate for the C-shell and its variants (e. g., csh, tcsh), gluex_env.sh for the Bourne shell and its variants (e. g., sh, bash). It provides sensible defaults and respects existing definitions of certain key variables.

Variable Default Value
GLUEX_TOP /usr/local/gluex
BMS_OSNAME taken from local operating system
BUILD_SCRIPTS $GLUEX_TOP/build_scripts
XERCESCROOT $GLUEX_TOP/xerces-c/prod
ROOTSYS $GLUEX_TOP/root/prod
CERN $GLUEX_TOP/cernlib
CERN_LEVEL 2006, except 64-bit Linux defaults to 2005
HDDS_HOME $GLUEX_TOP/hdds/prod
HALLD_HOME $GLUEX_TOP/sim-recon/prod
HALLD_MY $HOME/halld_my
JANA_HOME $GLUEX_TOP/jana/prod
JANA_CALIB_URL file://$GLUEX_TOP/calib
JANA_GEOMETRY_URL xmlfile://$HDDS_HOME/main_HDDS.xml
CLHEP $GLUEX_TOP/clhep/prod/$BMS_OSNAME

To invoke the script either

  1. define the variable BUILD_SCRIPTS to point to the directory where you checked the scripts out or
  2. have a structure so that the default definition of BUILD_SCRIPTS (see table above) is the right one.

Then the command is

source $BUILD_SCRIPTS/gluex_env.csh

for C-shell and

. $BUILD_SCRIPTS/gluex_env.sh

for Bourne shell.

This will set-up a complete GlueX environment using the defaults listed above. It will also modify the PATH and LD_LIBRARY_PATH variables so that building and running the code will succeed. If any or all of the choices used as default are not what you want, the script will honor any pre-existing values of certain key environment variables and proceed with the set-up deriving dependent variables from these key variables.

Note that these defaults assume a directory structure where the code is built. For example, JANA_HOME is assumed to be $GLUEX_TOP/jana/prod = /usr/local/gluex/jana/prod. If that is not the version you want to use (or not the directory structure you have), you can override the defaults as follows:

setenv JANA_HOME <path-to-my-preferred-jana-home>
source $BUILD_SCRIPTS/gluex_env.csh

for C-shell and

export JANA_HOME=<path-to-my-preferred-jana-home>
. $BUILD_SCRIPTS/gluex_env.sh

Commands like these can be put into a script themselves for convenience.

Another thing to note is that since gluex_env.csh respects pre-existing definitions, you have to be careful about any pre-existing definitions that may pre-exist. Practically, that means you want to use it from a clean environment (at least GlueX-wise). In other words, it will not fix a messed-up environment for you.

gluex_env_jlab.csh and gluex_env_jlab.sh

These are is wrappers around gluex_env.csh and gluex_env.sh respectively that provide defaults specific to the current production versions on the various platforms in common use at JLab. On the JLab CUE, the directory structure of the GlueX-specific code is nothing like the default structure mentioned above. Some variables are still left override-able by the user, others are hard-wired. The override-able ones are:

  • HDDS_HOME
  • HALLD_HOME
  • HALLD_MY
  • JANA_HOME

Of course, defaults for these override-able variables are still provided. Sourcing gluex_env_jlab.csh(or sh) with give a complete production level environment on the CUE. Adding pre-existing definitions will allow you to customize the environment from there.