Mac port of STAR offline software

Progress report on a port of STAR offline software to Mac OS X. Analysis chains using StMuDSTMaker are running fine; full bfc chains and simulations abort when I try to gexec the geometry. I’ve attached unified diffs of my Mac-related patches for each top-level directory in case we want to incorporate them into the STAR CVS repository.

Introduction

I’ve been working on porting STAR’s offline software to the Mac in my spare time for quite awhile now. Some of the important details for this port are

  • Apple only supports gcc 4.0 for its current operating systems. STAR is using gcc 3.4.6 in its SL 4.4 builds. This difference has not proven to be a major hurdle.

  • Apple does not officially support any Fortran compiler. Several groups out there provide Mac builds of g77 and gfortran, such as hpc.sourceforge.net, Fink, and the R Project. In my experience, the R build of gfortran available at this link is the best choice (caveat: I haven’t actually gotten all the Fortran STAR software to run correctly, just compile and link…).

  • We still have a pretty even mix of PowerPC and Intel Macs in our research group at MIT, so we need libraries for both architectures. The Apple way to do this is to build so-called “Universal Binaries” that contain object code for both architectures in a single file. Building Universal Binaries requires minor modifications to some parts of the ROOT build system, as well as some configuration changes in cons. Nothing too challenging. Confirming that all STAR codes actually run correctly on the big-endian PPC architecture is another matter entirely.

Precursors … CERNLIB, OPTSTAR, ROOT

Jerome has started to put together some nice instructions on installing the STAR software stack. I haven’t followed all those instructions verbatim, but used them as a guide.

First item is CERNLIB. CERN provides a preinstalled distribution kit for Intel Macs (2006+), but we want both PowerPC and Intel. I used Fink to build libraries for PowerPC and then lipo to combine these with the Intel Mac ones from CERN. Both were built using gfortran.

I ignored most of the detailed OPTSTAR installation instructions at my peril. From my perspective, the only programs really necessary for the build were MySQL (5.0.45), log4cxx (0.9.7), and Pythia (6.4.14). OS X does come with most of the other stuff pre-installed, and I preferred to use the system libraries when available.

The details of the ROOT build changes are probably a topic for a separate page. All seems to be working fine.

STAR patches

A variety of patches are necessary to get everything compiled. I’ve attached unified diffs for each top-level directory against today’s DEV so they can be reviewed for eventual inclusion in STAR CVS. In general OS-dependent modifications to source code are protected by #ifdef __APPLE__, PowerPC fixes are protected by #ifdef __ppc__, and cons changes are protected by if ($STAR_HOST_SYS =~ /^osx/) { ... }.

Current Status

I have an experimental build completed (using gcc/g++ 4.0.1, gfortran 4.2.1) that only skips Jprof (Linux only), StEventDisplayMaker, and St_geom_Maker (no QT yet), in addition to the SKIP_DIRS recommended by Jerome. Analysis chains based on StMuDSTMaker appear to work just fine. starsim starts up OK, but if I do

gexec $STAR_LIB/geometry.so

it dies with

***** FOR EXPERTS ONLY: LOOK UP GEOMETRY.G FOR DETAIL *******
===> Datacard assign I.CONFIG ( 1) = 1 in CVCF bank selected with 1.000
***********************************************************
*** FATAL ERROR in CAVEGEO ***
*** geant3.def file was changed, delete your *.sl files ***
STOP ***********************************************************

I dug into this a bit, but without too much success. The message comes from the AGSPUSH subroutine and is printed out if AG_MARK.NE.'V00'. Perhaps there’s some problem with the AGCPARA common block. All the geometry objects in pams/geometry do appear to set AG_MARK='V00' if I look in the Fortran source generated by agetof.