HEP Computing on MacOS X (Public Beta)

G77, CERNLIB, and ROOT

Some Tips Before We Begin

It is a good idea to use gnutar instead of the system's default tar in most cases. In my case tar is aliased to /usr/bin/gnutar: the default tar overwrites directories by default and may screw up symbolic links or directories permissions. HFS+ is a case-insensitive file system, so readme and README are the same. Be careful not to overwrite existing files: I had a bad experience.

Table of Contents

STEP 1: Installation of MacOS X and Its Basic Setup
STEP 2: Installation of Developer Tools
STEP 3: Installation of X11
STEP 4: libdl (dlopen, ...) by Christoph Pfisterer
STEP 5: Rebuid Mach Kernel with Bellardo's SysV Semaphore Patches
STEP 6: CERNLIB-2000, dis45, and Topdrawer
STEP 7: ROOT V.3.00/02

STEP 1: Installation of MacOS X and Its Basic Setup

  1. Partitioning
  2. Do not insert non-HFS partitions between MacOS 9 and X partitions. I had to move LinuxPPC partitions after MacOS X.
  3. Disconnect external SCSI disks
  4. Otherwise the installer will be confused, and later on, even if installation went OK, the MacOS X session won't terminate entering an infinite loop trying to access the external disks.
  5. Stop BenH's BootX and Norton's file saver extensions before starting the MacOS X installer. Stop also the Software Update extension, to avoid trouble in invoking the "Classic" environment.
  6. Setup session
  7. Installation took about 15min, if HFS+ is used (HFS+ is recommended, though it is a case-insensitive file system and sometimes troublesome). After the installation, the system automatically reboots and enteres a setup session, where you have to supply
    Network information: IP, Mask, GW, hostname, DNS, domain, ...

    Primary user name, Passwd (root), ...
    You then have to reboot the system to activate the changes. Network setting can be modified later using the Network utility in the System Preferences folder. You need to activate AppleTalk with the Network utility in order to use network printers. Network printers can be set up using the Print Center utility in the Utilities folder.
    Note that you can login as user root with the passwd set above. User's information is stored in /etc/pw.*
  8. Dock
  9. In order to make "Dock" automatically hide and appear, modify preference using

    "Dock and Desktop Environment Preferences"
  10. Starting Up System Services/ Network Security
  11. In order to check what kind of services are available, go to
    /System/Library/StartupItems/.
    For instance, you can take a look at SSH/SSH
       # cat SSH/SSH
       .....
       ##
       # Start up secure login server
       ##
    
       if [ "${SSHSERVER:=-NO-}" = "-YES-" ]; then
    
           ConsoleMessage "Starting Secure Login Server"
    
           if [ ! -f /etc/ssh_host_key ]; then
               echo "Generating ssh host key..."
               ssh-keygen -f /etc/ssh_host_key -N "" -C "$(hostname)"
           fi
           sshd -h /etc/ssh_host_key
       fi
       ....
    from which you can see that the environmental variable SSHSERVER controls the SSH start up. Note that I added "-h /etc/ssh_host_key" to the "sshd" command otherwise "sshd" tries to use /etc/ssh_host_dsa_key for ssh2.
    The control variables are configurable in /etc/hostconfig
       # vi /etc/hostconfig
       .....
       SSHSERVER=-YES-
            
       # vi /etc/sshd_config
       ....
       Protocol 2,1
       ....
    For later convenience allow X11-forwarding,
       # vi /etc/ssh_config
       ....
       Host *
            ....
            ForwardX11 yes
            ....
    It is also a good idea to activate access controll via TCP wrapper:
       # vi /etc/hosts.deny
       ALL: ALL
       # vi /etc/hosts.allow
       ALL: LOCAL ***.**.***.
       sshd:        ALL
       sshdfwd-X11: ***.**.***.





STEP 2: Installation of Developer Tools

Apple's Standard Developer Tools

Join ADC then you will be able to access Apple's download site for developers. Get MacOS X Developer Tools distributed as a CD image. Be sure that you do not launch helper application: You can switch off helper applications by clicking on the file icon in the download  dialog of IE (since Stuffit Expander breaks the image file by errorneously expand ing it).
The CD image is actually a tgz file, so use unix's tar command:

# cd ~/Library/Desktop/
# tar -zxvf "4.0.31.DownloadSoftware 2.1"

then you will get Developer.pkg. Click on the Developer.pkg icon on the Desktop to start the installer. More developer tools are necessary to setup HEP computing environment. You can retrieve source packages from Apple's Darwin site.

Bash

At this point, you can build bash:

$ cd bash-2.03
$ cat <somewhere>/bash-2.03-macosx.patch
--- bash-2.03/configure.ORIG      Tue Dec 19 19:48:29 2000
+++ bash-2.03/configure   Tue Feb 13 18:14:42 2001
@@ -740,6 +740,7 @@
 *-aix*)                opt_gnu_malloc=no ;;    # AIX machines
 *-nextstep*)   opt_gnu_malloc=no ;;    # NeXT machines running NeXTstep
 *-rhapsody*)   opt_gnu_malloc=no ;;    # Apple Rhapsody
+*-darwin*)     opt_gnu_malloc=no ;;    # MacOSX/Darwin
 *-dgux*)       opt_gnu_malloc=no ;;    # DG/UX machines
 *-qnx*)                opt_gnu_malloc=no ;;    # QNX 4.2
 *-machten4)    opt_gnu_malloc=no ;;    # MachTen 4.x
$ patch -p1 -s < <somewhere>/bash-2.03-macosx.patch
$ ./configure --prefix=/usr/local
$ make
$ su
# mkdir -p tmp/usr/local
# make install prefix=`pwd`/tmp/usr/local
# tar -zcvf ../../tgz/bash-2.03-bin.tar.gz -C tmp usr
# tar -zxvf ../../tgz/bash-2.03-bin.tar.gz -C /

From now on, I am going to use bash uless otherwise stated.

Useful environmental variables for building Darwin software Add the following to ~/.bashrc:

 export HOSTTYPE=macintosh
 export VENDOR=apple
 export OSTYPE=macos
 export MACHTYPE=powerpc
 export MAKEFILEPATH=/Developer/Makefiles

since they are defined only in .cshrc by default. Source the following in the top directory of any source package:

 export RC_ARCHS=ppc
 export RC_CFLAGS='-arch ppc'
 export RC_OS='macos'
 export SRCROOT=`pwd`
 export TARGETS=ppc
 export HOSTS=ppc

To build darwin related modules, one should use make-3.79!!

bootstrap_cmds

$ cd bootstrap_cmds-24
$ mkdir tmp
$ su
# make install DSTROOT=`pwd`/tmp
# tar -zcvf ../../tgz/bootstrap_cmds-24-bin.tar.gz -C tmp usr
# tar -zxvf ../../tgz/bootstrap_cmds-24-bin.tar.gz -C /
# mkdir /Library/Frameworks
# cp -RpP /System/Library/Frameworks/IOKit.framework /Library/Frameworks/IOKit.framework
# mkdir /Local
# ln -s ../Library /Local/Library
# exit

xnu

$ ln -s xnu-3-1 xnu
$ cd xnu
$ vi SETUP/setup.sh
....
export SRCROOT=`pwd`
....
$ make exporthdrs
$ make
$ make install
$ ^C # quit when compilation starts

Later on, we will have to rebuild the Mach Kernel in order to support SysV-style semaphore functions, but for the moment, all we need is a set of header files that are absent from Apple's standard developer tools.

IOKitUser

$ IOKitUser-3-1-0-1
$ vi Makefile
....
NEXTSTEP_BUILD_OUTPUT_DIR = $(SRCROOT)/BUILD/dst/System/Library/Frameworks
...
$ make

Compilation abends but don't mind.

$ su
# pushd ../xnu/BUILD/dst/System/Library/Frameworks/
# tar -zcvf $SRCROOT/../../tgz/IOKit.framework.Versions.A.Headers.tar.gz IOkit.framework/Versions/A/Headers/
# tar -zxvf $SRCROOT/../../tgz/IOKit.framework.Versions.A.Headers.tar.gz -C /Library/Frameworks/
# popd
# pushd ../xnu/BUILD/dst/System/Library/Frameworks/
# tar -zcvf $SRCROOT/../../tgz/System.framework.Versions.B.Headers.libkern.tar.gz System.framework/Versions/B/Headers/libkern/
# tar -zxvf $SRCROOT/../../tgz/System.framework.Versions.B.Headers.libkern.tar.gz -C /System/Library/Frameworks/
# popd

Libm

$ cd ~/sandbox/darwin/build/Libm-18-1
$ su
# make install DSTROOT=`pwd`/tmp
# cd tmp
# tar -zcvf ../../../tgz/Libm-18-1-bin.tar.gz .
# tar -zxvf ../../../tgz/Libm-18-1-bin.tar.gz -C /
# exit

Libcurses

$ cd ../Libcurses-23
$ su
# make install DSTROOT=`pwd`/tmp
# cd tmp
# tar -zcvf ../../../tgz/Libcurses-23-bin.tar.gz .
# tar -zxvf ../../../tgz/Libcurses-23-bin.tar.gz -C /
# exit

Libcompat

$ cd ../Libcompat-14-1
$ su
# make install DSTROOT=`pwd`/tmp
# cd tmp
# tar -zcvf ../../../tgz/Libcompat-14-1-bin.tar.gz .
# tar -zxvf ../../../tgz/Libcompat-14-1-bin.tar.gz -C /
# exit

Libstreams

$ cd ../Libstreams-21-1
$ su
# make install DSTROOT=`pwd`/tmp
# cd tmp
# tar -zcvf ../../../tgz/Libstreams-21-1-bin.tar.gz .
# tar -zxvf ../../../tgz/Libstreams-21-1-bin.tar.gz -C /
# pushd /System/Library/Frameworks/System.framework/
# ln -s Versions/Current/PrivateHeaders .
# popd
# exit

Csu

$ cd ../Csu-35
$ su
# make install DSTROOT=`pwd`/tmp
# cd tmp
# tar -zcvf ../../../tgz/Csu-35-bin.tar.gz .
# tar -zxvf ../../../tgz/Csu-35-bin.tar.gz -C /
# exit

Libc

$ cd ../libc-149
$ make
$ su
# pushd /Users/Public/SandBox
# ln -s fujiik root
# popd
# make install DSTROOT=`pwd`/tmp
# cd tmp
# tar -zcvf ../../../tgz/Libc-149-bin.tar.gz .
# tar -zxvf ../../../tgz/Libc-149-bin.tar.gz -C /
# exit

cctools

$ cd ../cctools-6-1
$ cat ~/memo/setup.sh
export RC_ARCHS=ppc
export RC_CFLAGS='-arch ppc'
export RC_OS='macos'
export TARGETS=ppc
export HOSTS=ppc
export SRCROOT=`pwd`
export OBJROOT=$SRCROOT/BUILD/obj
export SYMROOT=$SRCROOT/BUILD/sym
export DSTROOT=$SRCROOT/BUILD/dst
$ mkdir -p BUILD/{obj,sym,dst}
$ source ~/memo/setup.sh
$ make install >& install.log
$ su
# cd BUILD/dst
# tar -zcvf ../../../../tgz/cctools-6-1-local-bin.tar.gz usr/local
# tar -zxvf ../../../../tgz/cctools-6-1-local-bin.tar.gz -C /
# exit
 

g77

Extract libf2c and gcc/f from the standard gcc-2.95.2 and place them in Apple's gcc-912.3-2 tree:

$ tar -zxvf gcc-912.3-2.tar.gz
$ cd gcc-2
$ pushd <somewhere>
$ tar -zxvf gcc-2.95.2-g77.tar.gz
$ popd
$ cp -RpP <somewhere>/gcc-2.95.2-g77/libf2c .
$ cp -RpP <somewhere>/gcc-2.95.2-g77/gcc/f gcc/.

and then apply my private patches and make:

$ patch -p1 -s < <somewhere>/gcc-2.95.2-libg2c.patch
$ patch -p1 -s < <somewhere>/gcc-2.95.2-macosx.patch
$ export RC_ARCHS=ppc
$ export RC_CFLAGS='-arch ppc'
$ export RC_OS='macos'
$ export TARGETS=ppc
$ export HOSTS=ppc
$ export SRCROOT=`pwd`
$ make >& make.log &
$ make install >& install.log &

Then build libg2c.a:

$ cd gcc
$ for i in ../obj/cc-ppc-on-ppc/*.h; do ln -s $i .; done
$ cd ..
$ mkdir obj/ppc/libf2c
$ cd obj/ppc/libf2c
$ CFLAGS='-traditional-cpp' $SRCROOT/libf2c/configure --srcdir=$SRCROOT/libf2c --host=ppc --target=ppc
$ make >& make.log &

Binary package can be installed as

# tar -zxvf gcc-2-macosx-with-g77.tar.gz -C /

REMARK

g77 -O0 does not work if any function call involves any literal number as its argument.

(e.g.)
 $ cat test.F
       a = abs(1.)
       end
 $ g77 test.F
 main2.F: In program `MAIN__':
 main2.F:2: internal error--unrecognizable insn:
 (insn 10 8 11 (set (reg:SF 115)
          (mem/u:SF (lo_sum:SI (reg:SI 116)
                 (symbol_ref/u:SI ("*LC0"))) 0)) -1 (nil)
      (nil))

The insn seems to be correct since it is essentailly the same as that generated by g77 on a LinuxPPC box.
----> looks like a problem with the machine description:

        gcc/config/rs6000/rs6000.md

Temporary way out is to use -fPIC and/or -O.
 
 
 
 

STEP 3: Installation of X11

There are currently two choices, Tenon's Xtools or XFree86 for darwin. Only Xtools support rootless mode, in which X11 applications and MacOS X applications can coexist in Aqua. Both Xtools and XFree86 for darwin support rooted mode (full screen mode) where XFree86 is 10-20% faster.
I noticed some problems with Xtools's rootless mode and decided to use the full screen mode. Tenon's Xtools support dynamic (shared) libraries while the current XFree86 does not.
In Xtools, middle and right mouse buttons are somehow swapped, while this problem is absent from XFree86. On the other hand, XFree86 assumes ascii key assignment which might be inconvenient for owners of Japanese key boards. In order to use a Japanese key board as an ascii one, do
 $ vi ~/.Xmodmap
 keycode 101 = grave asciitilde


Xtools

You can get a trial version (1.0b6 in my case) from

http://www.tenon.com
which can be downloaded via IE.  Once you get the installer package, clicking on the installer icon does everything for you. After the installation, do the following as root:
# cat <somewhere>/xtools.config.patch
--- /usr/X11R6/lib/X11/config/MacOSX.rules.ORIG Sat Dec 16 06:37:33 2000
+++ /usr/X11R6/lib/X11/config/MacOSX.rules      Mon Jan 15 21:21:01 2001
@@ -37,7 +37,7 @@
 #define InstallSharedLibrary(libname,rev,dest)  @@\
 install:: Concat(lib,libname.dylib)  @@\
        MakeDir($(DESTDIR)dest)   @@\
-       $(INSTALL) $(INSTLIBFLAGS) Concat(lib,libname.dylib) $(DESTDIR)dest
+       $(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat(lib,libname.dylib) $(DESTDIR)dest
 @@\ #endif /* InstallSharedLibrary */
# patch -p0 < <somewhere>/xtools.config.patch
otherwise, the installation of dynamic libraries by any Makefile generated
by xmkmf will fail.
 

XFree86

If you have already installed Xtools and want to keep it, do

# cd /etc
# mv X11 X11.tenon
# cd /usr
# mv X11R6 X11R6.tenon

You can download precompiled binary packages from

http://www.xfree86.org
or you can compile it for yourself: since the binary distribution does not provide dynamic libraries, I am planning to compile it myself in near future. Once the correct set of tar-balls are retrieved, the installation is a matter of just rununig a shell script:

# cd <somewhere>
# sh Xinstall.sh
# tar -zxpvf XAqua0.2.tgz -C /

and answering some questions. Read Install for details. For compatibility with Xtools, do

# pushd /usr/X11R6/lib/X11/config
# vi Imake.cf
.....
#if defined(__APPLE__)
# undef __APPLE__
# define MacroIncludeFile <darwin.cf>
# define MacroFile darwin.cf
# define DarwinArchitecture
# define MacOSXArchitecture  # for convenience
#endif
.....

Customization of X11

Optionally, you can add more fonts as you need: in my case, I added small fonts for my PowerBook's LCD.

# cd <somewhere>/fonts
# ls
6x12rk.pcf.gz             fonts.alias.75dpi.added   s5x8.pcf.gz
a12.pcf.gz                fonts.alias.misc.added
elisau10.pcf.gz           k12.pcf.gz
# cp *.gz /usr/X11R6/lib/X11/fonts/misc/
# mkfontdir /usr/X11R6/lib/X11/fonts/misc/
# cat fonts.alias.75dpi.added >> /usr/X11R6/lib/X11/fonts/75dpi/fonts.alias
# cat fonts.alias.misc.added >> /usr/X11R6/lib/X11/fonts/misc/fonts.alias

Motif

# cd <somewhere>
# ls    # Get the folloowin from http://dryden.biol.yorku.ca/darwin.html
Mrm-headers.tar.gz                      libUil.a.gz
Uil-headers.tar.gz                      libXm.a.gz
Xm-headers.tar.gz                       usr-include-headers.tar.gz
libMrm.a.gz
# for i in Mrm-headers.tar.gz Uil-headers.tar.gz Xm-headers.tar.gz; do tar -zxpvf $i -C /usr/X11R6/include; done
# cp libXm.a.gz libMrm.a.gz libUil.a.gz /usr/X11R6/lib
# pushd /usr/X11R6/lib
# gunzip libXm.a.gz libMrm.a.gz libUil.a.gz
# for i in libXm.a.gz libMrm.a.gz libUil.a.gz; do ranlib -s $i; done
# cd ../include/X11
# for i in ../Xm ../Mrm ../Uil; do ln -s $i .; done

Mesa

A prebuilt package available from http://dryden.biol.yorku.ca/darwin.html.

# tar -zxvf <somewhere>/mesa-darwin-bin.tar.gz -C /

Xaw3d

$ cd xc/lib/Xaw3d/
$ patch -p0 -s < ../../../Xaw3d-1.1-shlib.patch
$ patch -p4 -s < ../../../Xaw3d-1.3-glibc.patch
$ patch -p3 -s < ../../../Xaw3d-1.3-X11R6.3.patch
$ patch -p4 -s < ../../../xaw3d.patch
$ patch -p4 -s < ../../../Xaw3d-1.3-multisrc.patch
$ xmkmf
$ ln -s .. X11
$ make EXTRA_DEFINES='-DARROW_SCROLLBAR -DUSEGRAY' CC='gcc -g'
$ su
# mkdir -p tmp/usr/X11R6
# make install DESTDIR=`pwd`/tmp
# tar -zcvf ../../tgz/Xaw3d-1.5-bin.tar.gz -C tmp usr
# tar -zxvf ../../tgz/Xaw3d-1.5-bin.tar.gz -C /

If you are using Tenon's Xtools, then you can optionally do the following to give a 3D look to Xterm/Kterm:

# pushd /usr/X11R6/lib
# mv libXaw.dylib libXaw.dylib.ORIG
# ln -s libXaw3d.dylib libXaw.dylib
# popd

To switch from Xtools to XF86, or vice versa Swap

 /etc/X11
 /usr/X11R6
That's it. Be careful for key and mouse button assignments. Be also careful that /private/etc/X11 is a real directory unlike in Xtools where it is a symbolik link.
 
 
 
 
 

STEP 4: libdl (dlopen, ...) by Christoph Pfisterer

MacOS X does not support SysV style dynamic loading facility like dlopen, etc., though the source package of cctools contains a wrapper for SysV compatibility. Christoph Pfisterer improved it to allow runtime setting of library search path via LD_LIBRARY_PATH.

$ tar -zxvf dlcompat-20010123.tar.gz
$ cd dlcompat-20010123
$ cat dlcompat-20010123-makefile.patch
--- dlcompat-20010123/Makefile.ORIG     Fri Jan 19 01:30:29 2001
+++ dlcompat-20010123/Makefile  Fri Jan 26 14:44:28 2001
@@ -31,7 +31,7 @@
 CFLAGS=-Wall -O2 -DDEBUG=$(DEBUG)
 AR=ar cru
 RANLIB=ranlib
-INSTALL=install
+INSTALL=install -c OBJS = dlopen.o@@ -39,12 +39,14 @@
 all: libdl.a libdl.dylib install: all
-       if test ! -d $(prefix)/lib ; then mkdir $(prefix)/lib ; fi
-       $(INSTALL) -m 644 libdl.a $(prefix)/lib
-       $(RANLIB) $(prefix)/lib/libdl.a
-       chmod 644 $(prefix)/lib/libdl.a
-       $(INSTALL) -m 755 libdl.dylib $(prefix)/lib
-       if test ! -d $(prefix)/include ; then mkdir $(prefix)/include ; fi
+       if test ! -d $(prefix)/lib/system ; then mkdir -p $(prefix)/lib/system ; fi
+       $(INSTALL) -m 644 libdl.a $(prefix)/lib/system
+       $(RANLIB) $(prefix)/lib/system/libdl.a
+       chmod 644 $(prefix)/lib/system/libdl.a
+       ln -s system/libdl.a $(prefix)/lib/.
+       $(INSTALL) -m 755 libdl.dylib $(prefix)/lib/system
+       ln -s system/libdl.dylib $(prefix)/lib/.
+       if test ! -d $(prefix)/include ; then mkdir -p $(prefix)/include ; fi
        $(INSTALL) -m 644 dlfcn.h $(prefix)/include
$ patch -p1 -s < dlcompat-20010123-makefile.patch
$ make
$ su
# make install prefix=usr/local
# tar -zcvf dlcompat-2001023-bin.tar.gz usr
# tar -zxvf dlcompat-2001023-bin.tar.gz -C /
 
 
 
 

STEP 5: Rebuid Mach Kernel with Bellardo's SysV Semaphore Patches

The reason why my custom kernel didn't work turned out to be that  my MacOS X partition exceeded the 8GB boundary: this was actually a FAQ :-( I didn't notice this because I could install MacOS X into the partition. It looks like once the kernel being moved, BootX was never able to find it again....
Anyway this solved all of the strange things that I could not understand. Now my custom kernel works perfectly:^) I had to reinstall the whole system with a smaller partition: this limitation does not apply to New World machines with OpenFirmware versions >= 2.x. Use xnu-3-1 from Apple's Darwin 1.2 source tree.
More information on SysV Sempaphore patches is available from http://www-cse.ucsd.edu/~bellardo/xnu/sysvsem.html.

$ cd xnu
$ pushd bsd/kern
$ patch -s < ~/sandbox/xnu-patches/sysvsem_bsd_kern.patch
$ mv sysv_sem.c sysv_sem.c.ORIG
$ cp ~/sandbox/xnu-patches/sysv_sem.c .
$ cd ../sys
$ patch -s < ~/sandbox/xnu-patches/sysvsem_bsd_sys.patch
$ mv sem.h sem.h.ORIG
$ cp ~/sandbox/xnu-patches/sem.h .
$ cd ../conf/
$ patch -s < ~/sandbox/xnu-patches/sysvsem_bsd_conf.patch
$ popd
$ make installhdrs
$ make install
$ su
# cp BUILD/dst/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/bsd/sys/sem.h /System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/bsd/sys/

The resultant patched kernel is "mach_kernel.gz" in this directory. It worked on my WallStreet but might not work on yours. Use it at your own risk.
 
 
 
 

STEP 6: CERNLIB-2000, dis45, and Topdrawer

CERNLIB-2000

Compilation Conditions

 MacOS X PB
 make-3.78-1-bin.tar.gz
 gcc-2-macox-with-g77.tar.gz
 Libc-149-bin.tar.gz
 Libcomapt-14-1-bin.tar.gz
 dlcompat-20010123-bin.tar.gz
Notice that building of CERNLIB requires an older version of make, since make-3.79 does not allow null string in strip directive.

[0] Preparation

# cd /
# rm cern
# ln -s /home/cernlib cern
# cd /cern
# for i in `ls <somewhere>/src_*.tar.gz`; do tar -zxvf $i; done
# ln -s 2000 new
# ln -s 2000 pro
# mkdir -p 2000/work
# chown fujiik:jlc 2000/work
# chown fujiik:jlc 2000
# cd src
# patch -p1 -s < <somewhere>/cernlib-2000-macosx.patch

[1] Build

$ cd /cern/2000/work
$ mkdir logs
$ export CVSCOSRC=/cern/2000/src
$ cp $CVSCOSRC/scripts/cernlib ../bin
$ CVSCOSRC/config/imake_boot
$ make tree HAVE_MOTIF='YES' >& ../logs/tree.log &
$ tail -f ../logs/tree.log
^C
$ cd packlib/kuip/programs/kuipc
$ make
$ make install.bin
$ cd /cern/2000/work$ make HAVE_MOTIF='YES' >& ../logs/make.log &
$ tail -f ../logs/make.log$ cd packlib
$ make install.bin HAVE_MOTIF='YES' >& ../../logs/packlib.bin.log &
$ tail -f ../../logs/packlib.bin.log$ cd ../pawlib
$ make install.bin HAVE_MOTIF='YES' >& ../../logs/pawlib.bin.log &
$ tail -f ../../logs/pawlib.bin.log$ cd ../graflib
$ make install.bin HAVE_MOTIF='YES' >& ../../logs/graflib.bin.log &
$ tail -f ../../logs/graflib.bin.log$ cd ../scripts
$ make install.bin HAVE_MOTIF='YES' >& ../../logs/scripts.bin.log &
$ tail -f ../../logs/scripts.bin.log
$ cd ..
$ make install.include CERN_INCLUDEDIR=/cern/new/include \
  >& ../logs/install.include.log &
$ tail -f ../logs/install.include.log
$ su
# tar -zxvf <somewhere>/patchy-4.15-bin.tar.gz -C /
# exit
$ cd patchy
$ PATH=.:$PATH make install.bin HAVE_MOTIF='YES' >& ../../logs/patchy.bin.log &
$ tail -f ../../logs/patchy.bin.log

[2] Tests

$ cd ../packlib
$ make test >& ../../logs/packlib.test.log &
$ tail -f ../../logs/packlib.test.log
               ALL TESTS PASSED!
$ cd ../mathlib
$ make test >& ../../logs/mathlib.test.log &
$ tail -f ../../logs/mathlib.test.log
       ALL TESTS but C327 PASSED!
$ cd ../graflib/higz/examples
$ make higzex
$ ./higzex
             OK!
$ cd ../../../../src/pawlib/paw/demo
$ paw all.kumac
...
go
...
 OK!
$ cd ../../../../work/mclibs
$ make test >& ../../logs/mclibs.test.log &
$ tail -f ../../logs/mclibs.test.log
            ALL TESTS PASSED!
        but remember you remove lepto63 from testlibdir.
$ cd ../phtools
$ make test >& ../../logs/phtools.test.log &
$ tail -f ../../logs/phtools.test.log
      ALL TESTS PASSED!
$ cd ../geant321
$ make test >& ../../logs/geant321.test.log &
$ tail -f ../../logs/geant321.test.log
                ALL TESTS PASSED!

[3] Aftermath

# cd /home/cernlib
# chown -R root:wheel *
# mkdir 2000/tgz
# tar -zcvf 2000/tgz/cernlib-2000-bin.tar.gz 2000/bin
# tar -zcvf 2000/tgz/cernlib-2000-lib.tar.gz 2000/lib
# tar -zcvf 2000/tgz/cernlib-2000-include.tar.gz 2000/include
# tar -zcvf 2000/tgz/cernlib-2000-share.tar.gz 2000/share
 

Dis45

[0] Preparation

$ cd readline-4.1
$ ./configure Darwin
$ make
$ su
# mkdir tmp
# make install prefix=`pwd`/tmp/usr/local
# tar -zcvf <somewhere>/readline-4.1-bin.tar.gz -C tmp usr
# tar -zxvf <somewhere>/readline-4.1-bin.tar.gz -C /
# exit

$ cd ncurses-5.0
$ gzcat ../../ncurses/ncurses-5.0-19991030.patch.gz | patch -p1 -s
$ gzcat ../../ncurses/ncurses-5.0-20000122.patch.gz | patch -p1 -s
$ patch -p1 -s < ../../ncurses/ncurses-5.0-oldmajor.patch
$ patch -p1 -s < ../../ncurses/ncurses-4.2-arm.patch
$ patch -p1 -s < ../../ncurses/ncurses-5.0-setuid2.patch
$ patch -p1 -s < ../../ncurses/ncurses-5.0-xtermchanges.patch
$ patch -p1 -s < ../../ncurses/ncurses-5.0-macosx.patch
$ find . -name "*.orig" -exec rm -f {} \;$ find . -name "*~" -exec rm -f {} \;
$ ./configure darwin --with-install-prefix=`pwd`/tmp  --with-normal --without-debug --without-profile --without-cxx --without-ada
$ make HOSTCC=cc >& make.log &
$ su
# make install includedir=/usr/local/include/ncurses 1>&install.log &
# tar -zcvf <somewhere>/ncurses-5.0-bin.tar.gz -C tmp usr
# tar -zxvf <somewhere>/ncurses-5.0-bin.tar.gz -C /
# exit

[1] Compilation Procedure

$ cd dis45-v1.36
$ patch -p1 -s < <somewhere>/dis45-v1.36-macosx.patch
$ xmkmf -a
$ make
$ su
# mkdir -p tmp/usr/local/bin
# mkdir -p tmp/usr/local/man/man1
# cp dis45 tmp/usr/local/bin/
# cp doc/dis45.1 tmp/usr/local/man/man1/
# chown -R root:wheel tmp/usr
# tar -zcvf ../../../../tgz/dis45-v1.36-xf86.tar.gz -C tmp usr
# tar -zxvf ../../../../tgz/dis45-v1.36-xf86.tar.gz -C /
 

Topdrawer

$ cd tdr-1.7
$ make compile F77='g77 -O -fPIC'
$ make lib F77='g77 -O -fPIC'
$ make tdr F77='g77 -O -fPIC' MAINDIR=`pwd`
$ su
# mkdir -p tmp/usr/local/bin
# mkdir -p tmp/usr/local/man/mann
# cp tdr-1.6/tdr tmp/usr/local/bin/
# cp man/tdr.n tmp/usr/local/man/mann/
# chown -R root:wheel tmp/usr
# tar -zcvf ../../../../tgz/tdr-1.7-xf86.tar.gz -C tmp usr
# tar -zxvf ../../../../tgz/tdr-1.7-xf86.tar.gz -C /
 
 

STEP 7: ROOT V.3.00/02

[1] Compilation Conditions
 mach_kernel: xnu-3-1 with John Bellardo's sysv_sem patches
 libdl.dylib: dlcompat-20010123 by Christoph Pfisterer
 standard gcc*-2 + g77 in gcc*-2-macosx-with-g77.tar.gz
 Xtools 1.0b6 or XFree86 4.0.2
 freetype-1.3.1
[2] Compilation Procedure

$ tar -zxvf ../orig/root_v3.00.02.source.tar.gz
$ tar -zxvf ../orig/ttf_1.1.tar.gz
# mv ttf/fonts /usr/share/fonts/ttf
# pushd /cern/pro/lib
# ln -s libpythia6134.a libPythia.a
# pushd /System/Library/Frameworks/System.framework/Headers/c++
# cp -p <somewhere>/stream.h .
# cp -p <somewhere>/stdiostream.h .
$ cd root
$ export ROOTSYS=`pwd`
$ export LD_LIBRARY_PATH=$ROOTSYS/lib
$ export PATH=$ROOTSYS/bin:$PATH
$ patch -p1 -s < ../orig/root_v3.00.02-macosx-0.4.patch
$ export PATH=/usr/bin:$PATH # use standard cc and c++
$ ./configure darwin
$ make
$ cd lib
$ for i in *.dylib; do lib=`basename $i .dylib`; \
 g++ -O -bundle -undefined suppress -o $lib.so $i; done
 

According to the directory change for ttf fonts, edit ~/.rootrc as:

#Unix.*.Root.TTFontPath:     $(ROOTSYS)/ttf/fonts
Unix.*.Root.TTFontPath:     /usr/share/fonts/ttf

[3] Temporary Remedy for Custom New/Delete Problem

Found that the problem lies in /usr/local/lib/libcc_dynamic.a which defines ___builtin_new, etc. without private extern key word.
This makes ld to bind ___builtin_new not in "text" section but in "Text" section, which causes symbol collison for new and delete! This should be solved by fixing my gcc package, but for the moment I decided to avoid this problem by hiding /usr/local/lib/libcc* in /usr/local/lib/hide_cc/.
 ---> NEED MORE FUNDAMENTAL TREATMENT FOR MY GCC
With this temporary remedy, the following prescription should work:

Create lib*.dylib with

SOFLAGS       = -dylib -r -nostartfiles -install_name

and rebind them to all the executables, so as to make sure that the executables do not carry builtin new/delete in them. Then do

$ cd lib
$ for i in *.dylib; do lib=`basename $i .dylib`; lname=`echo $lib | sed -e's;^lib;;'`; g++ -O -bundle -undefined suppress -o $lib.so -L. -l$lname; done

The following is probably unnecessary when dynamic versions of X11-related libraries become available for XFree86: I haven't tested this with Xtools, anybody?

$ g++ -O -bundle -undefined suppress -o libX3d.so libX3d.dylib -L/usr/X11R6/lib -lX11
$ g++ -O -bundle -undefined suppress -o libRGL.so libRGL.dylib -L/usr/X11R6/lib -lXext -lX1

[4] Problem with Tests

vvector and vmatrix tests failed complaining that

Write vector v to database
Warning in <TClass::TClass>: no dictionary for class TFile is available
Warning in <TClass::TClass>: no dictionary for class TVector is available
Warning in <TClass::TClass>: no dictionary for class TKey is available
Warning in <TClass::TClass>: no dictionary for class TStreamerElement is availableClose database
Warning in <TClass::TClass>: no dictionary for class TList is available
Warning in <TClass::TClass>: no dictionary for class TObject is available
Warning in <TClass::TClass>: no dictionary for class TStreamerInfo is available
Warning in <TClass::TClass>: no dictionary for class TNamed is available
Warning in <TClass::TClass>: no dictionary for class TObjArray is availableOpen database in read-only mode and read vector
Error in <TKey::ReadObj>: Cannot create new object of class TList
Error in <TKey::ReadObj>: Cannot create new object of class TVectorRead vector should be same as original still in memory *** Break *** bus error
It looks like symbols imported through dylib are not visible from the main program.
Since I don't know any option like -Wl,-E or -rdynamic for DARWIN, I decided to avoid this by creating a TApplication object in the main program.
 

TBrowser did not work This was due to a bug in TButton.cxx: a data member fGroup is not initialized in its ctor.
 --------->  Fixed and now it works fine.

The problem must have been fixed in the   ROOT CVS tree.

<patch begins here>
--- 3.00.02/gui/src/TGButton.cxx.ORIG   Tue Oct 17 21:34:52 2000
+++ 3.00.02/gui/src/TGButton.cxx        Tue Feb  6 16:14:45 2001
@@ -76,6 +76,7 @@
    fMsgWindow   = p;
    fUserData    = 0;
    fTip         = 0;
+   fGroup       = 0;    fNormGC   = norm;
    fState    = kButtonUp;
<patch ends here>
 

A prebuilt binary package of root_v3.00.02 is available from here.


Back to Keisuke Fujii's HEP on X Page
fujiik@jlcuxf.kek.jp March 18, 2001