How I Built HEASOFT (v6.16) and ISIS (v1.6.2-30) on my Apple Laptop ===================================================================== (Running OS X 10.9.4), Such That They Play Nicely Together ========================================================= General Comments: Getting a consistent set of astrophysical software working on an Apple machine can be tricky. It is often made more complicated by users having downloaded a number of different packages (via Fink, Macports, various different astrophysical packages, etc.) that may include incompatible versions of libraries. Problems are more likely to arise if links to these software packages/libraries are automatically placed in a user's path when starting up a terminal window. A general rule of thumb is this: be aware of what you have downloaded, know where it has been placed on your computer, and don't automatically place these packages into your path until you actually need them. For example, when I open a terminal window on my laptop, I do not automatically place any of the HEASOFT or CIAO software into my paths. Instead I have a command: %> setxspec which invokes: #! /bin/csh -f setenv HEADAS /usr/local/heasoft-6.16/x86_64-apple-darwin13.2.0 source $HEADAS/headas-init.csh setenv LMODDIR /usr/local/xspec_lmodels/heasoft_6.16 The same is true for when I use the CIAO software. (In the above, and in what follows below, %> refers to a command line prompt in an Xterm terminal window.) The advice below is written for Apple Mavericks. %%%%%% 1. Getting started: Make sure that your Apple Xcode is up to date, and that you have installed *all* of the Xcode developer tools and Xcode command line tools. The command line tools are not automatically installed when installing Xcode. After downloading the latest Xcode image, open it up, and go through the update procedure. You then still have to install the command line tools. Do this by opening a terminal window, and typing: %> xcode-select --install and then agreeing to the command line tool update. Currently, I am running Xcode v.5.1.1. Likewise, Apple no longer ships with an Xterm program, so make sure that you have Xquartz installed: http://xquartz.macosforge.org/landing/ I am currently running Xquartz v2.7.6. Note that after upgrading from Mountain Lion to Mavericks, I had to reinstall Xquartz. (I didn't have to delete the old version, rather I just needed to reinstall it.) Further, make sure that you have a working set of compilers. The ones that you need will be the Apple version of gcc and g++, found in /usr/bin: %> /usr/bin/gcc --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.3.0 Thread model: posix %> /usr/bin/g++ --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.3.0 Thread model: posix For Fortran, I had been used to using the versions provided by: http://hpc.sourceforge.net/; however, these failed miserably for me. Instead, I used gfortran 4.9.0 which I build from source code obtained via Fink. Side note on Fink: In upgrading from Mountain Lion to Mavericks, I had to erase my old installation of Fink, and reinstall it from scratch. (This is opposed to Macports, which I just updated. Note: I have not tried using the Fortran compilers from Macports, so I have no idea how well they work.) With those preliminaries out of the way, you can now begin to build XSPEC, S-lang, and ISIS. %%%%%% 1. Download the XSPEC source code from: http://heasarc.gsfc.nasa.gov/lheasoft/download.html On this web page under "STEP 1- Select the type of software:" choose "Source code distribution". Then, underneath "STEP 2 - Download the desired packages:", select *All*. As opposed to previous versions of HEASOFT, HEASOFT 6.16 can be built 64bit on Apple machines. Then click "Submit". This will create a gzipped tar file on your machine with a name, e.g., "heasoft-6.16src.tar.gz". %%%%%% 2. Move and unpack this tar file into a directory. On my laptop, I build in directories only accessible to the root account, so I first switch into the root account (%> sudo su), and then I switch to using the csh (%> csh). The software can just as easily be built in a bash shell. Usually this means replacing "%> setenv CC /usr/bin/gcc" with "%> export CC=/usr/bin/gcc" in the instructions below. *** WARNING: If you do build as root in the /usr/local directory, be be very careful, especially when unpacking and deleting files. For example, I often add the -i option when deleting, e.g., %> rm -i heasoft-6.16src.tar.gz, when working in the root directory. I try to stay away from using the wild card, *, in any commands, etc. You can build this software in other directories, usually by adding paths to the ./configure options below. Running the command %>./configure --help will show you what options are available. *** For my set up, I have unpacked the software into a directory: /usr/local/ E.g., %> cd /usr/local/ %> mv /Users/mnowak/Desktop/heasoft-6.16src.tar.gz . %> tar zxvf heasoft-6.16src.tar.gz You can, of course, unpack the software into any directory you wish. %%%%%% 3. Explicitly set the compilers that you will use for the build. In this case, these are the Apple gcc & c++, and the Fink gfortran v4.9.0. %> setenv CC /usr/bin/gcc %> setenv CXX /usr/bin/g++ %> setenv FC /sw/bin/gfortran %%%%%% 4. Move to the BUILD_DIR directory: %> cd /usr/local/heasoft-6.16/BUILD_DIR and then build XSPEC via the instructions outlined below. Note that you have to explicitly identify the paths to the X11 libraries. Each step below may take a while to run. *** Be sure that the previous command has finished before starting the next command. *** (To see if a command has finished, type, for example, "%> tail build.log". You should see a statement saying "Finished" if the command has successfully completed.) %> ./configure --x-libraries=/usr/X11/lib --x-includes=/usr/X11/include >& config.out & %> make >& build.log & %> make install >& install.log & The above build should have automatically occurred in 64-bit, and should have been placed in a directory such as: /usr/local/xspec_only/heasoft-6.16/x86_64-apple-darwin13.3.0 If you see "i386" anywhere in that path name, something has gone wrong and you have accidentally built a 32-bit version of the library! (The name of the created directory might be slightly different on your machine, but should have x86_64 as part of it, *not* i386 nor i686) %%%%%% 5. We are now going to make use of some of the libraries that we just built in this version of XSPEC, so set up an environment variable pointing to this build (CHECK FOR THE NAME OF THE PATH ON YOUR SPECIFIC MACHINE): %> setenv HEADAS /usr/local/heasoft-6.16/x86_64-apple-darwin13.3.0 %%%%%% 6. Now we build S-lang. The source code can be obtained from http://jedsoft.org/slang/ The current version is 2.2.4 (do *not* get any "pre-release" version), which on my machine I have unpacked into the directory: /usr/local/slang-2.2.4 Changing to that directory, we first run a configure script, using readline from the XSPEC build, and making sure to explicitly point to the X11 libraries. (I am also building without a number of libraries that are not necessary for use in ISIS. A number of these are very useful libraries for more advanced scripting using S-lang.) We then build and install the S-lang library. %> cd /usr/local/slang-2.2.4 %> ./configure --without-pcre --without-z --without-iconv %> --with-readline=$HEADAS --with-png=/usr/local/orwhereeveryourpngis --x-libraries=/usr/X11/lib --x-includes=/usr/X11/include %> make %> make install %> make clean You can also install s-lang with a --without-png option, but this will prohibit you from using both isisscripts and slxfig %%%%%% 7. Now we install ISIS. The current version, 1.6.2-30, can be found here: http://space.mit.edu/ASC/ISIS/download.html ISIS is updated frequently, so don't worry if it's several sub-minor versions different than -30 when you download it. Such minor sub-versions are usually small enhancements to the functionality, or very minor bug fixes. Nothing should change that affects the build properties. On my machine, I have unpacked the program into the directory: /usr/local/isis-1.6.2-30 The build is very similar to the S-lang build in that we have to make sure we explicitly point to the X11 libraries, and use the readline, PGPLOT, and CFITSIO libraries found in the XSPEC build. %> cd /usr/local/isis-1.6.2-30 %> ./configure --x-libraries=/usr/X11/lib --x-includes=/usr/X11/include --with-readline=$HEADAS --with-headas=$HEADAS %> make %> make install %> make clean And you're done! You should now have a working, 64 bit version of both XSPEC and ISIS. The ISIS executable will be in /usr/local/bin, while XSPEC can be added to your path via: %> setenv HEADAS /usr/local/xspec_only/heasoft-6.16/x86_64-apple-darwin13.3.0 %> source $HEADAS/headas-init.csh %%%%%% 8. Getting help: If you run into any problems installing ISIS, please send an e-mail to the ISIS users mail group: isis-users@space.mit.edu Please give as much detail as possible about how you attempted to build the code, and please include copies of your /usr/local/isis-1.6.2-26/config.log and /usr/local/isis/-1.6.2-26/config.status files.