Installing Fink Cernlib And G77 For Mac

  1. I have recently become frustrated with the new clang compiler included with Xcode 5. I was wondering what the best way to install GNU GCC on OS X would be. Things to consider: I don't want to use MacPorts, fink, homebrew or any other third party package manager. I would like to use the latest GCC, compiled from source, if possible.
  2. The purpose of this fork is to bring up support for building CERNLIB on modern Linux systems with modern GNU compiler toolchain. This setup has been tested on Ubuntu 12.04, gfortran 4.6.3. Dependencies sudo apt-get install xutils-dev libmotif-dev libxt-dev libxft-dev 32-bit build. Run build32 choosing which version to build - 2005 or 2006.

B.8 Installation on Mac OSX 10.3 in 2003.

For those with older systems, here are a few details for Mac OS X users based on my experienceinstalling SCHEDon a Mac iBook G4 system in Dec 2003 with OS X version 10.3 (Panther). Notethat, for OSX 10.5, the installation was somewhat smoother with the main issue being a need to switchfrom g77 to gfortran. PGPLOT could be downloaded from the Fink. For OSX 10.3, before installingSCHED, the code tools had to be installed (the installation package was already on disk, but not yetinstalled) and X windows had to be installed from the OS X installation CD 3 (not CD 2 assome documentation stated). The code tools include gcc, but not g77 (why?). A binaryversion of g77 compatible with Panther was obtained from hpc.sourceforge.net. It installeditself on download and simply worked. PGPLOT was installed. There was no PGPLOTconfiguration file (.conf file) provided for OS X (there probably is one now). I made a local.conffile starting with the one from ../src/sys_bsd/g77_gcc.conf. The following two lines weredifferent:

Fink now has a working version of gfortran. To get it, you must install the fink gcc43 package. Another option is g95, and this can often be used as a drop-in replacement for g77. For example, I was able to get fftw, pgplot, and a few other things that required g77 to compile and work with g95, just by doing a global search and replace. 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. MacPorts is one great source for linux software on your mac; it builds things for your machine, so installing can take some time. Once you've installed the macports binaries, you can type 'sudo port install gcc46 +gfortran' to install the newest gcc and gfortran compilers. Binaries are available at the HPC for Mac OS X website.

FFLAGD='-fno-backslash'
LIBS='-L/usr/lib -lgcc -L/usr/X11R6/lib -lX11'

The routine that makes the font file (pgpack) caused some trouble while I was messing with variousvariants on the above, but eventually worked. I suspect problems with big vs little endian byteorders, but I’m not sure. Note that pgplot version 5.3 has OS X as a standard OS type. Thisversion was not released as of Aug 2008 (may never be), but might be available if you asknicely.

Once the X windows environment, gcc/g77, and PGPLOT were ready, SCHED compiled and ran withthe Makefile set up for Linux/g77 and the and the following two modified lines (one just depends on thelocation of PGPLOT and the other helps it find the gcc libraries): XLD = -L/usr/lib -lgcc-L/usr/X11R6/lib -lX11 # Mac OS X (ie DARWIN) LPGPLOT = /usr/local/pgplot The architecturestill claimed to be LINUX and the g77 compiler flags were the same. That’s all it took! Itcompiled and passed the verification tests. If you are using FINK, some details may bedifferent.

If you run into problems with some missing .h files, you might have a mismatched OS version andXCODE version, as I did.

I now have SCHEDon a Powerbook G4 (OSX 10.3 still) and that is now one of the SCHEDdevelopmentplatforms.

Preparation:lapack

To build cernlib from the source files you need to install, the imake command, the motif and the compatibility libraries.
$ su
# apt-get update

# apt-get install imake openMotif-devel Libcompat
# apt-get clean
If you just want to use precompiled binary packages, go directly to Installation subsection.

CERNLIB-2006Building Procedure

Compilation Conditions
MacOS X Release 10.11
gcc-5.3.0-1osx10.11
imake-1.0.5-10.11hepx4a
Libcompat-14.1-10.11hepx3a
motif-2.3.4-1osx10.11
My gfortran-related changes have been sent to a CERNLIB maintainerand adopted in CERNLIB v.2006 so the building of CERNLIB on MacOS Xis now much easier than before.In order to compile it in 64-bit mode, however, we need extra paches.The patches for 64-bit support are largely due to Harald Vogt at DESY.Thanks to Remi Mommsen, the main cernlib mainteainer of Fink Project, these 64-bit paches have been assmbled with various MacOSX patches. The first patch I will use below is the result of hard work by these people.

Installing Fink Cernlib And G77 For Macbook Pro

[0] Preparation

In the following, <somewhere> stands for a directory intowhich you downloaded necessary tarballs or patches, while <username> means your login name. Replace them as needed according toyour environment.

# cd /
# rm cern
# mkdir /Users/cernlib
# ln -s /Users/cernlib cern
# cd /cern
# tar -zxvf 2006_src.tar.gz
# ln -s 2006 new

# ln -s 2006 pro
# mkdir -p 2006/work
# chown <user name> 2006/work
# chown <user name> 2006
# cd 2006/src
# patch -p1 -s < <somewhere>/cernlib2006-2006b-14.patch
# patch -p1 -s < <somewhere>/cernlib-2006-macosx10.9.patch
# exit
where the 2nd patch is to work around some remaining problems. It is probably worth mentioning that the addtion of '-Wl,-no_pie' to LDFLAGS was essentail to making paw work properly).

[1] Build

$ cd /cern/2006/
$ mkdir lib

$ ln -s /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib lib/liblapack3.a
$ ln -s /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib lib/libblas.a

$ cd ../work

$ export CVSCOSRC=/cern/2006/src
$ mkdir ../bin

$ cp $CVSCOSRC/scripts/cernlib ../bin/
$ $CVSCOSRC/config/imake_boot
$ export PATH=$PATH:/cern/2006/bin
$ mkdir ../logs
$ make tree HAVE_MOTIF='YES' >& ../logs/tree.log &
$ tail -f ../logs/tree.log
^C
$ pushd packlib/kuip/programs/kuipc
$ make
$ make install.bin
$ popd
$ make HAVE_MOTIF='YES' >& ../logs/make.log &

$ tail -f ../logs/make.log
^C
$ cd packlib

$ make install.bin HAVE_MOTIF=YES PACKAGE_LIB='/cern/pro/lib/libpacklib.a' EXTRA_LOAD_FLAGS='-L/opt/osxws/lib -lgfortran' >& ../../logs/packlib.bin.log &
$ tail -f ../../logs/packlib.bin.log
$ cd ../pawlib

$ make install.bin HAVE_MOTIF=YES PACKAGE_LIB='/cern/pro/lib/libpawlib.a' EXTRA_INCLUDES='-I/cern/2006/src/pawlib/comis' >& ../../logs/pawlib.bin.log &
$ tail -f ../../logs/pawlib.bin.log
$ cd ../graflib

$ make install.bin HAVE_MOTIF=YES PACKAGE_LIB='/cern/pro/lib/libgraflib.a' >&../../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

[2] Tests

$ cd packlib
$ make test PACKAGE_LIB='/cern/pro/lib/libpacklib.a' >& ../../logs/packlib.test.log &
$ tail -f ../../logs/packlib.test.log
ALL TESTS PASSED
$ cd ../mathlib
$ make test PACKAGE_LIB='/cern/pro/lib/libmathlib.a' >& ../../logs/mathlib.test.log &
$ tail -f ../../logs/mathlib.test.log
ALL TESTS PASSED
$ cd ../graflib/higz/examples
$ make higzex PACKAGE_LIB='/cern/pro/lib/libgraflib.a'
$ ./higzex
OK!
$ cd ../../../../src/pawlib/paw/demo
$ paw all.kumac
...
go
...
OK!
$ cd ../../../../work/mclibs
$ FC='gfortran -O0' make test >& ../../logs/mclibs.test.log &
$ tail -f ../../logs/mclibs.test.log
ALL test PASSED
$ cd ../phtools
$ make test >& ../../logs/phtools.test.log &
$ tail -f ../../logs/phtools.test.log
ALL TESTSPASSED
$ cd ../geant321

$ make test EXTRA_LOAD_FLAGS='-undefined dynamic_lookup' >& ../../logs/geant321.test.log &
$ tail -f ../../logs/geant321.test.log
ALL TESTSPASSED

Installation of Binary Packages

CERNLIB

# apt-get update
# apt-get install cernlib
# apt-get clean

# ln -s 2006 /cern/pro

By default cernlib will be installed under /cern. Add /cern/pro/binto your PATH in order to use PAW, PAW++, etc.

Dis45

# apt-get update
# apt-get install dis45
# apt-get clean

Topdrawer

# apt-get update
# apt-get install tdr
# apt-get clean
FinkG77Installing Fink Cernlib And G77 For Mac
or
# apt-get update
# apt-get install topdraw
# apt-get clean

Installing Fink Cernlib And G77 For Mac Download


Installing Fink Cernlib And G77 For Mac Osx

Back to Keisuke Fujii's HEP on X Pagekeisuke.fujii@kek.jp Feb. 20, 2016