Building the Fermi Science Tools from source code ------------------------------------------------- 1. Download the source code tarball from the FSSC Science Tools website: http://fermi.gsfc.nasa.gov/ssc/data/analysis/software/ This should give you a file with a name like: ScienceTools-.tar.gz The string has the form: vVrRpP-fssc-YYYYMMDD where: vVrRpP - V is the major version number, R is the release number, and P is the patch level. YYYYMMDD - Year (YYYY), month (MM), and day (DD) of the tool release. 2. Unpack the tarball in the directory where you would like the software installed. ... tar xvzf ScienceTools-.tar.gz ... You will find a new subdirectory named after the tarball, minus the ".tar.gz" suffix. Using the example in step 1, you would see a subdirectory named "ScienceTools-vVr17p0-fssc-20100818", containing the source code for the Science Tools. 3. Move into the build directory. ... cd ScienceTools-/BUILD_DIR/ ... 4. Run the configure script, which will probe your system for libraries, header files, compilers, etc., and then generate the main Makefile. To produce a default configuration, the configure script may simply be invoked by: ... ./configure ... We recommend capturing the output from configure as follows: Using C Shell or variants, e.g. csh, tcsh: ... ./configure >& configure.out ... Using Bourne shell or variants, e.g. sh, bash: ... ./configure > configure.out 2>&1 ... Do a quick scan through configure.out to see if there are any error messages. They should be fairly obvious - any errors usually result in the configure script aborting. 5. Run hmake to build the software: ... ./hmake ... We recommend capturing the output from hmake as follows: Using C Shell or variants, e.g. csh, tcsh: ... ./hmake >& hmake.out ... Using Bourne shell or variants, e.g. sh, bash: ... ./hmake > hmake.out 2>&1 ... Check your hmake.out for errors! If a problem occurs and is discovered at this point, it may be easy to correct (contact the help address: glasthelp@milkyway.gsfc.nasa.gov). By contrast, if an error occurs, but you continue with the next step, it may make resolving the problem more complex or more time-consuming. The easiest way to check your build log for errors is to look for occurrences of the string ***. (Most UNIX utilities which use regular expression matching require these to be "escaped" using backslashes, e.g. \*\*\*). 6. Since some of the Science Tools code depends on other parts of the Science Tools code already being built, a second configure/hmake pass must be performed. First, set some environment variables that allow the newly-built code to be found, then run configure and hmake again: In sh/bash, in ScienceTools/BUILD_DIR (replace as needed for your tarball): ... export BUILD_ROOT=`cd ../..;pwd` export PLATFORM=`ls ../external/BLD` export PATH=$BUILD_ROOT/ScienceTools-/external/BLD/$PLATFORM/bin:$PATH export LD_LIBRARY_PATH=$BUILD_ROOT/ScienceTools-/external/BLD/$PLATFORM/lib:$LD_LIBRARY_PATH export CPATH=$BUILD_ROOT/ScienceTools-/external/python:$CPATH ./configure >& configure.out2 ./hmake >& hmake.out2 ... In csh/tcsh, in ScienceTools/BUILD_DIR: ... setenv BUILD_ROOT `cd ../..;pwd` setenv PLATFORM `ls ../external/BLD` setenv PATH $BUILD_ROOT/ScienceTools-/external/BLD/$PLATFORM/bin:$PATH setenv LD_LIBRARY_PATH $BUILD_ROOT/ScienceTools-/external/BLD/$PLATFORM/lib:$LD_LIBRARY_PATH setenv CPATH $BUILD_ROOT/ScienceTools-/external/python:$CPATH ./configure >& configure.out2 ./hmake >& hmake.out2 ... 7. Run hmake to install the software: ... ./hmake install ... It is useful to save the output from the hmake program: In csh/tcsh: ... ./hmake install >& hmake_install.out ... In sh/bash: ... ./hmake install > hmake_install.out 2>&1 ... 8. Optionally, you may build and install the Science Tools test code: ... ./hmake test >& hmake_test.out ./hmake install-test >& hmake install_test.out ... 9. Set up the environment for your Unix shell. In the commands below, replace the string by the absolute path to the subdirectory created by unloading the tarball. The process of building the software will create a platform-specific directory under the where can be several different strings, e.g. "i686-apple-darwin8.11.1" or "x86_64-unknown-linux-gnu-libc2.3.4" For tcsh/csh, type: ... setenv FERMI_DIR / source $FERMI_DIR/fermi-init.csh ... For bash/sh, type: ... export FERMI_DIR=/ source $FERMI_DIR/fermi-init.sh ... Note: For MAC users running OSX 10.4 (Tiger) you will need to set an addtional environment variable to run the Science Tools. This will mean that IDL cannot be run in the same window as the Science Tools: For csh/tcsh: ... setenv DYLD_INSERT_LIBRARIES $FERMI_DIR/lib/libf2c.so ... For sh/bash: ... export DYLD_INSERT_LIBRARIES=$FERMI_DIR/lib/libf2c.so ... After running these commands the Fermi Science Tools will be in your path and all environment variables will be set as needed. The help files for individual tools can be accessed in two ways: * By typing fhelp * Through the Reference Manual NOTE TO MACINTOSH OS X 10.5 (SNOW LEOPARD) USERS ------------------------------------------------ Building on OS X Snow Leopard is currently problematic. Use the following procedures (in addition to the steps listed above): 1. After the code is unpacked, you must edit ScienceTools/external/BUILD_DIR/hd_config_info to add a switch (-b 64) to the configure command for the Xerces XML parser (this should be the last line in the file, or nearly the last line). The line should look like this when you are done: ... xerces_CONFIGURE_CMD="XERCESCROOT=\$HD_SRC/xerces; export XERCESCROOT; cd $XERCES_DIR; ./runConfigure -P\$exec_prefix -p\$xerces_platform -b 64" ... This hack forces the Xerces code to be built in 64-bit mode on Snow Leopard. 2. After both configure steps, two Makefiles must be edited. First, edit ScienceTools/heacore/readline/shlib/Makefile to change the definition of the SHLIB_XLDFLAGS variable to include the -dynamiclib option. It should be on or near line 86, and should end up looking like this: ... SHLIB_XLDFLAGS = -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v -dynamiclib ... Next, edit ScienceTools/external/python/Makefile to remove the compiler flag -Wno-long-double. Just use your editor to find that string, and remove it wherever you find it (there is usually only one instance of it). Note that these edits must be performed after _both_ configure steps, since the second configure script deletes these changes.