Running the Brahms Program Suite on a Macintosh using LinuxPPC

Both Brat and GBRAHMS can be run using LinuxPPC on a Macintosh computer. The other programs used for BRAHMS may also work, but I have not tested them. This document presents the problems that I encountered in getting the main programs working and my (sometimes clunky) solutions.

Contents

Tested configuration.

LinuxPPC 2000 on a PowerBook (Pismo; 500 MHz) and a B&W G3 (400 MHz) computer Also, I primarily run using bash. However, some of the setup and make files for BRAT seem to want tcsh. My global defines are done in .bashrc which, currently, looks as follows:

./bashrc

# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc

BASH_ENV=$HOME/.bashrc
HOME2=/home/sanders	

USERNAME="sanders"
CERN=$HOME2/cern
CERN_LEVEL=pro
CERN_ROOT=$CERN/$CERN_LEVEL
PLITMP=$HOME2/cern/tar
CERN_LIBDIR=$CERN_ROOT/lib
CERN_BINDIR=$CERN_ROOT/bin
CERNLIB=$HOME2/cern/pro/lib
CVSCOSRC=$HOME2/cern/pro/src
CVSROOT=/afs/rhic/brahms/BRAHMS_CVS
CVS_RSH=ssh
ROOTSYS=$HOME2/cern/root_v2.24.05
CINTSYSDIR=/home/sanders/cern/cint
MANPATH=$MANPATH:$CINTSYSDIR/doc
BRATSYS=$HOME2/brat
BRAHMS_ARCH=linux
PATH=$PATH:$HOME/bin:$HOME/phsxhw/hw/bin:/$HOME2/cern/pro/mgr:$CERN_BINDIR:$ROOTSYS/bin:/usr/arla/bin:$HOME/geant/bin/linux:$CINTSYSDIR:.
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib:$BRATSYS/lib/linux:$CINTSYSDIR
export HOME2 LD_LIBRARY_PATH USERNAME BASH_ENV PATH CERN CERNLIB ROOTSYS 
export CVSCOSRC CERN_LEVEL PLITMP CERN_LIBDIR CERN_BINDIR
export CVSROOT CVS_RSH CINTSYSDIR MANPATH LD_ELF_LIBRARY_PATH

What about AFS?

Brahms uses AFS in conjunction with CVS to maintain the software repositories. AFS allows a user to do what looks like a remote mount of the disks on which the software resides. CVS is the program used to checkout and update the software. Unfortunately, the normal AFS is a proprietary program that has not been ported to linuxppc. There is, however, a free AFS implementation called "arla". This is documented at the main Arla web site:

http://www.stacken.kth.se/projekt/arla/.

The source can be downloaded from

ftp://ftp.stacken.kth.se/pub/arla

Arla works with a kerberos (IV) implementation called KTH-Krb to maintain secure communications (this is the klog stuff...). The link to find KTH-Krb is given on the Arla site and is:

http://pdc.kth.sr/kth-krb

The files that I ended up downloading to build Arla are:

Several patches are necessary to get these programs running. You should start with krb4 since arla will require access to the krb libraries.

Patch:

:

Once Arla was built (the default build is into /usr/arla), I copied the two files

from the rcf machines (/afs/rhic/common/etc/) into /usr/arla/etc.

Start arla from su using the script:

/usr/arla/bin/startarla

At this point, switching back to normal user, it is possible to issue a klog as usual. I find that I sometimes (at least when using the powerbook) also need to issue a klog on rcf.rhic.bnl.gov for cvs access to the Brahms files. I don't know why the two tokens (one local and one on rcf) are needed.

How do I get ROOT to work properly?

Unfortunately, the port of root to linuxppc is being done with an older egcs compiler. Although this will run on a machine with the more recent compilers, there seem to be some clashes when using the libraries generated using the older compiler to link with Brat. I got around this by compiling the root source using the gcc 2.95.2 compiler.

Starting from the root home page

http://root.cern/ch

I first found and downloaded the most recent compiled libraries for the linuxppc platform (v2.24.04). I then downloaded and compiled the root src.

None of the standard Makefiles work cleanly with the newer compiler. I made my own architecture makefile, called it Makefile.linuxppc (in /src), and followed the standard directions using linuxppc for the achitecture. The makefile is as follows:

########################################################
# Makefile of ROOT for linuxppc gcc 2.95.2 and glibc

include ../Makefile.config

PLATFORM      = linux

CXX           = g++
CC            = gcc
PIC           = PIC
CXXFLAGS      = -Wall -fsigned-char -f$(PIC) -DR__GLIBC \
                -I/usr/X11/include/ $(EXTRA_CXXFLAGS)
CFLAGS        = -Wall -f$(PIC) -fsigned-char -DR__GLIBC \
                -I/usr/X11/include/ $(EXTRA_CFLAGS)
CINTCXXFLAGS  = -Wall -f$(PIC) -fsigned-char -DG__REGEXP $(EXTRA_CXXFLAGS) \
                -DG__UNIX -DG__SHAREDLIB -DG__OSFDLL -DG__ROOT -DG__REDIRECTIO
CINTCFLAGS    = -Wall -f$(PIC) -fsigned-char -DG__REGEXP -DG__UNIX -DG__SHAREDLIB \
                -DG__OSFDLL -DG__ROOT -DG__REDIRECTIO $(EXTRA_CFLAGS)
OPT           = -O2
NOOPT         =
LD            = g++
LDFLAGS       = $(OPT) $(EXTRA_LDFLAGS)
SOFLAGS       = -shared -Wl,-soname,
SOEXT         = so
SYSLIBS       = -lm -ldl -lcrypt -lext2fs 
XLIBS         = -L/usr/X11R6/lib -lX11 -lSM -lICE -lXpm
CILIBS        = -lm -ltermcap -lbsd -ldl -rdynamic
CRYPTLIBS     = -lcrypt

F77		= g77
F77LD		= g77
F77FLAGS	= -fno-automatic -fno-second-underscore -fno-f90 -fugly-complex  -fno-globals -fugly-init -Wno-globals 
F77LIBS		= -L/home/sanders/cern/pro/lib -lpacklib -lnsl -lcrypt -ldl 

##### MACROS and TARGETS #####

include Make-macros


##### DEPENDENCIES #####

include Make-depend

#####END OF MAKEFILE#####################################################

Unfortunately, this Makefile crashes at several locations where "hand fixes" are necessary:

  1. The Makefile fails while doing the make for the programs EG_DatabasePDG.cxx and EG_ParticlePDG.cxx . Compilation of the particle databases has to be done with -fPIC changed to -fpic. I'm doing this by hand by letting the make fail on each of these compilations and then reentering the compile command at the terminal with the above change.
  2. Several fortran programs need to be linked using the g77 command rather than g++. Using g++ returns an unresolved s_copy reference. s_copy resided in the libext2fs library. The above Makefile catches some of these instances, but not all. When the make crashes with reams of s_copy errors, redo the last command substituting g77 for g++.
  3. In ROOTD_rootd.cxx and PROOFD_proofd.cxx there are inconsistent casts for an intrinsic function (initgroups). The cast should be:

    extern "C" int initgroups(const char *name, unsigned int basegid);

In each case, I've allowed the make to fail, fixed the problem, and then continued with the make from where things left off.

What about CERNLIB?

I got CERNLIB (2000 version) running several months ago and so my memory may be faulty here. However, I don't remember this as being much of a challenge. There is a linuxppc build available from the cern repository. I am building the complete distribution from source using the makeall script found in the /mgr subdirectory. To build cernlib from source, the makeall script should be relocated to the /src directory. Also, the config files for Imake should be located in /src/config/. I believe I may have modified some of the files in the /src/config directory: I have fairly recent update dates on Imake.cf, linux.cf and linux-pmac.cf:

Imake.cf
/* $Id: Imake.cf,v 1.4 1998/09/25 09:23:38 mclareni Exp $
 *
 * $Log: Imake.cf,v $
 * Revision 1.4  1998/09/25 09:23:38  mclareni
 * Modifications for the Mklinux port flagged by CERNLIB_PPC
 *
 * Revision 1.3  1998/06/09 13:54:39  cernlib
 * Make sure unix is properly undefined to compile kernlib/unix
 *
 * Revision 1.2  1995/12/21 11:31:57  cernlib
 * Imake files end 1995
 *
 * Revision 1.1.1.1  1995/12/20  15:26:44  cernlib
 * X11R6 config files unmodified
 *
 *
 */
XCOMM $XConsortium: Imake.cf,v 1.19 95/01/05 19:24:32 kaleb Exp $
/*
 * To add support for another platform:
 * 
 *     1.  Identify a machine-specific cpp symbol.  If your preprocessor 
 *         does not have any built in, you will need to add the symbol to the
 *         cpp_argv table in config/imake/imakemdep.h and rebuild imake with
 *         the BOOTSTRAPCFLAGS variable set (see the macII for an example).
 *
 *     2.  Add all machine-specific cpp symbols (either defined by you or by
 *         the preprocessor or compiler) to the predefs table in 
 *         config/imake/imakemdep.h.
 *
 *     3.  But a new #ifdef block below that defines MacroIncludeFile and
 *         MacroFile for your new platform and then #undefs the machine-
 *         specific preprocessor symbols (to avoid problems with file names).
 *
 *     4.  Create a .cf file with the name given by MacroFile.
 */

#ifdef linux 
#ifdef  __PPC__
#define MacroIncludeFile 
#define MacroFile       linux-pmac.cf
#undef linux
#undef __PPC__
#define LinuxArchitecture
#define PPCArchitecture
#else
#define MacroIncludeFile 
#define MacroFile linux.cf
#undef linux
#define LinuxArchitecture
#define i386Architecture
#endif
#endif /* linux */


#ifdef unix
#undef unix
#endif /* unix */

#ifndef MacroIncludeFile
XCOMM WARNING:  Imake.cf not configured; guessing at definitions!!!
XCOMM This might mean that BOOTSTRAPCFLAGS was not set when building imake.
#define MacroIncludeFile 
#define MacroFile generic.cf
#endif

linux.cf

/* $Id: linux.cf,v 1.11 2000/01/14 15:44:36 mclareni Exp $
 *

 * $Log: linux.cf,v $
 * Revision 1.11  2000/01/14 15:44:36  mclareni
 * Add Lesstif includes from /usr/local/include
 *
 * Revision 1.10  1999/05/25 08:58:14  cernsoft
 * Remove code to build with/without Motif depending on environment variable
 *
 * Revision 1.9  1998/08/25 12:15:10  mclareni
 * Add QMGLIBC flag
 *
 * Revision 1.8  1998/02/10 10:48:59  mclareni
 * To compile herwig59 and mathlib tests need -fugly-complex option to allow REAL(DOUBLE COMPLEX arg)
 *
 * Revision 1.7  1998/01/15 14:44:01  mclareni
 * Prevent adding 2 underscores, mainly for Comis
 *
 * Revision 1.6  1997/12/15 16:20:44  mclareni
 * Changes for the Portland Group f77 compiler, inside ifdef HasPgf77
 *
 * Revision 1.5  1997/07/04 17:00:28  mclareni
 * The gcc default for backslash is required for Cernlib
 *
 * Revision 1.4  1997/07/04 16:31:44  mclareni
 * There is an official shift version for Linux
 *
 * Revision 1.3  1996/12/16 15:12:05  cernlib
 * By default inhibit Motif on Linux; can be changed via environment
 *
 * Revision 1.2  1996/11/13 13:23:15  cernlib
 * Add cernlib options for fortran etc..
 *
 * Revision 1.1.1.1  1995/12/20 15:26:45  cernlib
 * X11R6 config files unmodified
 *
 *
 */
XCOMM platform:  $XConsortium: linux.cf,v 1.11 95/01/23 18:32:03 kaleb Exp $

#define OSName			Linux
#define OSVendor		/**/
#define OSMajorVersion		2
#define OSMinorVersion		0
#define OSTeenyVersion		33

#undef unix			/* GF. this is not needed anywhere */

#ifndef UseElfFormat
#define UseElfFormat		NO
#endif
#define HasGcc			YES
#define HasGcc2			YES
#define HasGcc2ForCplusplus	YES
#define GccUsesGas		YES
#define UseGas			YES
#define GnuCpp			YES
#define HasShadowPasswd		NO
#ifndef HasLibCrypt
# define HasLibCrypt		NO
#endif
#define HasPutenv		YES
#define HasShm			YES
#define HasSockets		YES

#define AvoidNullMakeCommand	YES
#define StripInstalledPrograms	YES
#define CompressAllFonts	YES
#define Malloc0ReturnsNull	YES
#define NeedConstPrototypes	YES
#define NeedFunctionPrototypes	YES
#define NeedNestedPrototypes	YES
#define NeedVarargsPrototypes	YES
#define NeedWidePrototypes	NO

#if UseElfFormat
#define CcCmd			gcc -b i486-linuxelf
#define AsCmd			/usr/i486-linuxelf/bin/as
#define LdCmd			ld -m elf_i386
#define AsmDefines		-D__ELF__
#define CplusplusCmd		g++ -b i486-linuxelf
#else
#define CcCmd			gcc
#define AsCmd			as
#define LdCmd			ld
#define AsmDefines		-DUSE_GAS
#endif
#define CppCmd			/lib/cpp
#define YaccCmd			bison -y
#define LexCmd			flex -l
#define LexLib			-lfl
#define PreProcessCmd		CcCmd -E
#define PostIncDir		`CcCmd --print-libgcc-file-name | sed 's/libgcc.a/include/'`
#define LdCombineFlags		-r
#define OptimizedCDebugFlags	-O2 -m486 -fno-strength-reduce\
					-fomit-frame-pointer
#define StandardDefines		-Dlinux -D__i386__ -D_POSIX_SOURCE \
				-D_BSD_SOURCE -D_GNU_SOURCE -DX_LOCALE
#define XawI18nDefines		-DUSE_XWCHAR_STRING -DUSE_XMBTOWC
#define HasWChar32		YES
#define StandardCppDefines	-traditional StandardDefines
#define ServerOSDefines		XFree86ServerOSDefines -DDDXTIME
#define ExtensionOSDefines	-DXTESTEXT1
#define ServerExtraDefines	-DGCCUSESGAS XFree86ServerDefines
#define ConnectionFlags		-DUNIXCONN -DTCPCONN
#define InstUidFlags		-s -m 4755

/* Some of these man page defaults are overriden in the above OS sections */
#ifndef ManSuffix
# define ManSuffix	1x
#endif
#ifndef ManDir
# define ManDir		$(MANSOURCEPATH)1
#endif
#ifndef LibManSuffix
# define LibManSuffix	3x
#endif
#ifndef LibmanDir
# define LibmanDir	$(MANSOURCEPATH)3
#endif
#ifndef FileManSuffix
# define FileManSuffix	5x
#endif
#ifndef FileManDir
# define FileManDir	$(MANSOURCEPATH)5
#endif

#include 
#include 

#ifdef HasPgf77
#define f2cFortran              YES
#define FortranCmd              pgf77
/*
#define FortranDoesCpp          NO
#define FortranCppCmd           /lib/cpp -traditional -C
*/
#define XargsCmd                xargs
#define FortranSaveFlags        -Msave
#define OptimisedFortranFlags   -O2 -Munroll -tp p6
#define DefaultFCOptions        -Minfo -Mbackslash -Munixlogical -pc 64
#define CernlibSystem           -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QFPGF77

#else

/* Start CERNLIB changes A.Waananen 15. Apr. 1996 */
/*  Adapted to CERN style GF. 20-Sep-96 */
#define f2cFortran	        YES
#define FortranCmd		g77
#define XargsCmd		xargs
#define FortranSaveFlags	/* */ /* Everything static !? */
#define DefaultFCOptions	-fno-automatic -fno-second-underscore -fugly-complex
#define CernlibSystem	        -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QMGLIBC
#endif

#define CERNLIB_LINUX
#define CERNLIB_UNIX
#define CERNLIB_LNX
#define CERNLIB_QMGLIBC

#define X11Includes		-I/usr/X11R6/include
#define MotifIncludes           -I/usr/local/include

/*
 *  Create a Make Variable to allow building with/out Motif
 */


/* End  CERNLIB changes */


linux-pmac.cf


#ifndef OSName

#define OSName			Linux
#endif
#ifndef OSVendor
#define OSVendor		Linux PPC
#endif
#ifndef OSMajorVersion
#define OSMajorVersion		2
#endif
#ifndef OSMinorVersion
#define OSMinorVersion		0
#endif
#ifndef OSTeenyVersion
#define OSTeenyVersion		33
#endif

#undef	unix			/* GF. this is not needed anywhere */

#define HasNdbm			YES
#define DBMLibrary		-lgdbm
#define UseElfFormat		YES
#define HasGcc			YES
#define HasGcc2			YES
/* Create static and shared libraries */
#define HasSharedLibraries	YES
#define ForceNormalLib		YES
#define HasGcc2ForCplusplus	YES
#define GccUsesGas		YES
#define UseGas			YES
#define GnuCpp			YES
#define HasShadowPasswd		NO
#define HasLibCrypt		YES
#define HasPutenv		YES
#define HasShm			YES
#define HasSockets		YES
#define HasZlib                 YES 

#define AvoidNullMakeCommand	YES
#define StripInstalledPrograms	YES
#define CompressAllFonts	YES
#define Malloc0ReturnsNull	YES
#define NeedConstPrototypes	YES
#define NeedFunctionPrototypes	YES
#define NeedNestedPrototypes	YES
#define NeedVarargsPrototypes	YES
#define NeedWidePrototypes	NO
#define SetTtyGroup		YES

#define CcCmd			gcc
#define DefaultCCOptions	-fsigned-char
#define AsCmd			as
#define LdCmd			ld
#define AsmDefines		-DUSE_GAS -U__ELF__
#define MkdirHierCmd		mkdir -p
#define CppCmd			/lib/cpp
#define YaccCmd			byacc
#define LexCmd			flex -l
#define LexLib			-lfl
#define PreProcessCmd		CcCmd -E
#define PostIncDir		`CcCmd --print-libgcc-file-name | sed 's/libgcc.a/include/'`
#define LdCombineFlags		-r
#define OptimizedCDebugFlags	-O2 -fno-strength-reduce -fomit-frame-pointer
#define StandardDefines		-Dlinux -DPPC -D__powerpc__ -D_POSIX_SOURCE \
				-D_BSD_SOURCE -D_SVID_SOURCE -DX_LOCALE
#define XawI18nDefines		-DUSE_XWCHAR_STRING -DUSE_XMBTOWC
#define HasWChar32		YES
#define StandardCppDefines	-traditional StandardDefines
#define	XpmacServer		YES
#define BuildXKB		YES
#define BuildXKBLib		YES
#define ServerOSDefines		-DDDXTIME
#define ExtensionOSDefines	-DXTESTEXT1
#define ServerExtraDefines	-DGCCUSESGAS
#define ConnectionFlags		-DUNIXCONN -DTCPCONN
#define InstallXserverSetUID	YES
#define InstUidFlags		-s -m 4711

#define	ServerExtraSysLibs	
#define ExtraLibraries		-lcrypt

/* Some of these man page defaults are overriden in the above OS sections */
#ifndef ManSuffix
# define ManSuffix	1x
#endif
#ifndef ManDir
# define ManDir		$(MANSOURCEPATH)1
#endif
#ifndef LibManSuffix
# define LibManSuffix	3x
#endif
#ifndef LibmanDir
# define LibmanDir	$(MANSOURCEPATH)3
#endif
#ifndef FileManSuffix
# define FileManSuffix	5x
#endif
#ifndef FileManDir
# define FileManDir	$(MANSOURCEPATH)5
#endif

#include 
#define f2cFortran              YES
#define FortranCmd              g77
#define XargsCmd                xargs
#define FortranSaveFlags        /* */ /* Everything static !? */
#define OptimisedFortranFlags	-O2 -funroll-loops -fomit-frame-pointer
#define DefaultFCOptions        -fno-automatic \
				-fno-second-underscore \
				-fno-f90 -fugly-complex -fno-globals \
				-fugly-init -Wno-globals
#define CernlibSystem           -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX \
				-DCERNLIB_PPC -DCERNLIB_QMGLIBC

#define CERNLIB_SHIFT NO
#define CERNLIB_LINUX
#define CERNLIB_UNIX
#define CERNLIB_LNX
#define CERNLIB_PPC
#define CERNLIB_QMGLIBC

#define X11Includes             -I/usr/X11R6/include

/*
 *  Create a Make Variable to allow building with/out Motif
 */
#undef MotifDependantMakeVar
#define MotifDependantMakeVar(variable,value)                           @@\
ifneq ($(strip $(HAVE_MOTIF)),)                                         @@\
    variable=value                                                      @@\
endif                                                                   @@\
/* End  CERNLIB changes */


Why does rootcint segfault?

This occured to me when rootcint was looking for, but could not find, a glibc function soinit.c. The function, which is called when rootcint tries to write out an error does exist in glibc, so I'm not sure why is is not found. The function is called when rootcint tries to write out an error.

Why does the cernlib build complain about s_copy?

This message seems to be associated with fortran compiles where the appropriate libraries are not accessed or, as discussed above, when a fortran program is linked using g++ rather than g77. I have not had much trouble when using the recent libraries.

Why does my BRAT make fail every time I check out a new version from the repository?

This is almost always because of an inconsistent use a the const argument. Most of the development work on BRAT is being done using the egcs compiler. This compiler issues a warning, but not an error, when it detects an inconsistent use of the const argument. The gcc 2.95.2 compiler exits with error status when it discovers this problem. The const error needs to be fixed before building the program with the 2.95.2 compiler.

What is the rootmark spec for the Pismo PowerBook?

Results using .benchmark.C in the root tutorials directory .