Setting OSX 10.5 or 10.6 for ESP-r Jon W. Hand, ESRU 23 December 2011 INTRODUCTION Apple computers can run ESP-r and are also great computers for doing development work on ESP-r. OSX includes the scripting and security features which are found on Linux computers as well as the multi-tasking which ESP-r requires. For development work the compiler 'tool chain' is almost identical to that on Linux (GCC and Make). There are some setup tasks that are required before you can embark on creating or using the virtual physics of ESP-r. If you are setting up a new OSX machine take the opportunity to customise the initial install to include the X11 facility and then after the initial install go back to the DVD and use the XCode installer. If you are working with an existing OSX then download from Apple (or from the Install DVD) the software developers kit (XCode) and the full Apple X11 environment. You will also need some additional libraries and development header files that are most easily setup via the Fink (and optionally Fink Commander) environment or the MacPorts environment. These are discussed in a subsequent section. Follow the instructions on the Apple site to download Apple's X11 or locate it on your Install DVD. There are two parts to this: the first includes the X11 library, fonts, Xserver etc., the second includes the `include` folders and C header files needed to compile and link with X11. The OSX 10.5 developer kit XCode comes with GCC 4.0 which is suitable for use with ESP-r but there are newer versions of the GCC compiler collection which improve on this compiler. OSX 10.5 is a 32 bit environment so it is more stable (for ESP-r) than OSX 10.6. But the included GCC does not include gfortran (see links below). The OSX 10.6 developer kit XCode comes with GCC 4.2 which can be used to compile 32 bit or 64 bit executables of ESP-r. Again, gfortran tends not to be included in the XCode release and needs to be sourced elsewhere (see links below). Note that there is an issue with shading calculations on OSX 10.6 which limits the application of ESP-r on this platform if you are using the older compilers - however the GCC 4.6 compilers from the HPC Mac site (see below) in conjunction with the standard Install script produces an ish module which works. Also note that the X11 version can be compiled with the standard Install script which forces a 32bit executable. The GTK version requires the Install script to force a -m64 because the GTK libraries are 64bit. Look for Install_osx_64_10.6 in the source bin folder. FONTS On OSX 10.6 sometimes the GTK version of ESP-r will crash, in particular when attempting to display a pop-up message or display such as the wire-frame control proforma. This is usually resolved by re-freshing the font cache via the following command: sudo fc-cache -f -v It might take several minutes to do this refresh of the font cache. FINK Fink is a development environment for Open source software on OSX (see useful links). It holds information about several thousand packages and knows how to download source and then compile open source software. Fink is used to set up the tools, helper applications and compilers which ESP-r uses. Fink knows about many of the dependencies in the packages that you request and will take away many of the hassles of manually fetching dependencies. Here is a list of some of the packages which are required and or which are useful and which fink can acquire and/or build: cctools (unsure if required for developer) cups-dev (optional printing drivers) ddd (useful) debugging environment enscript (useful) generates postscript version of a text file flex (probably required) lexical analyser gfortran GNU fortran compiler (if not already installed) gawk (useful) GNU edition of Awk processing language ghostscript (useful) postscript document creation environment gimp2-dev (useful if compiling GTK version of ESP-r to get libraries and header files glib2 (probably required) library of utility functions gzip (required) compression tool imagemagick (useful) image capture/conversion/display and to get many commonly required library and header files lesstif (optional) implementation of Motif graphic libary libPNG (optional) image format library libtiff (optional) image format library m4 (required) macro language nedit or medit (useful) text editor which works well with esp-r files system-xfree86 (required) placeholder for Apple X11 tar (useful) for archiving and unarchiving esp-r models transfig (useful) for handling xfig files (can be generated by results module) xfig (useful) vector drawing/graphing tool (can be generated by results module) Most of the items above which are noted as required will be installed with the initial fink installation. Fink will place new software in the folders under /sw. A typical command to install a package (such as ddd) is (in a command terminal): fink install ddd To find out what has already been installed by fink use: fink list --installed To find out what packages are available use: fink list (an i before the item says it has been installed and a p before the item signals that it is a virtual package. MACPORTS The MacPorts environment (see useful links) is designed to assist OSX users in installing open source software. It is possible to find the GCC compiler collections 4.1 4.2 4.3 4.4 and 4.5 for OSX 10.5 and 10.6. MacPorts will tend to place newly installed software in /opt/local (so that they do not clash with other software). MacPorts package lists include information on dependencies so some of the hassles of acquiring related software packages and/or libraries are reduced. By default OS X will place user accounts under the folder /Users. The default location for ESP-r on Linux tends to be either /usr/esru or /opt/esru. You will need to adapt the install command for compiling ESP-r location to a folder which you control such as /Users/fred/esru or to create a /usr/esru or /opt/esru folder (you may need to use a sudo command to create the new folder and to gain ownership of the new folder so that you can install ESP-r there. When compiling esp-r use Install script in the ESP-r source code distribution. A typical command would be: ./Install -d /opt/esru --gcc4 --reuse_ish_calcs and agree to questions about debug and databases and example models. If you give the command ./Install --help a list of command line options will be shown. The standard Install script includes an -m32 directive that results in a 32bit set of executables on both OSX 10.5 and 10.6. RADIANCE The Radiance visual simulation suite R3.9 compiles ok on OSX 10.5 or 10.6 if during the make install you edit the ARCH=powerpc to ARCH= with a blank. You also need to create a link named genrbox pointing at genbox in /usr/local/bin (the typical location where Radiance is compiled to). Normally it is not necessary to set the RAYPATH environment variable if the Radiance library files are in /usr/local/lib/ray. USEFUL LINKS The newest compilers for OSX are not found in the XCode environment but in external locations. Here is a list of useful sites: The HPC Mac OSX site (high performance computing) http://hpc.sourceforge.net which currently offers GCC 4.6 for OSX 10.5 and 10.6 The GCC compilers are installed in /usr/local These compilers seem to be an improvement over the default GCC 4.1 that comes with the XCode install. Gfortran for OSX 10.5 is available as a OSX Installer (mpkg) file at htp://www.macresearch.org/gfortran-leopard. MacPorts site (http://www.macports.org) The Fink project site (http://www.finkproject.org/). For OSX 10.5 there is a binary installer, for 10.6 there is an alternative source compile method and you will also be asked whether you want pure 64bit or a mixed 32bit and 64bit Fink. DEPENDENCIES There are two versions of ESP-r which can be installed. The so-called X11 version is the legacy version and the GTK version is an almost complete port of ESP-r using the GTK library. There are a few functions which are not available in the GTK version (e.g. click-on-bitmap). ESP-r has a number of library dependencies for the X11 and GTK versions. If you have all of the libraries that you need then the various modules of the ESP-r suite will run. If not all of them exist then you will get an error message with the name of the library or libraries that have not been found. If you are running the X11 version of esp-r there are only a few libraries that the executables will be looking for (the version numbers may be different on your machine): otool -L ./clm ./clm: /usr/X11/lib/libX11.6.dylib (compatibility version 9.0.0, current version 9.0.0) /usr/local/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.10.0) /usr/lib/libxslt.1.dylib (compatibility version 3.0.0, current version 3.12.0) /usr/lib/libxml2.2.dylib (compatibility version 9.0.0, current version 9.16.0) /usr/local/lib/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0) /usr/local/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.5) These libraries will typically be installed with the X11 environment on Apple computers. If you are using the GTK version of ESP-r then there are additional libraries that are required. Many of these tend to be located in a /sw folder structure which is maintained by the 'fink' development packages or in /opt/lib if you are using MacPorts. % otool -L ./clm ./clm: /sw/lib/libgtk-x11-2.0.0.dylib (compatibility version 401.0.0, current version 401.9.0) /sw/lib/libgdk-x11-2.0.0.dylib (compatibility version 401.0.0, current version 401.9.0) /usr/X11R6/lib/libXrandr.2.dylib (compatibility version 2.0.0, current version 2.0.0) /usr/X11R6/lib/libXinerama.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/X11R6/lib/libXext.6.dylib (compatibility version 6.4.0, current version 6.4.0) /usr/X11R6/lib/libXft.2.dylib (compatibility version 2.1.0, current version 2.1.0) /usr/X11R6/lib/libfreetype.6.dylib (compatibility version 6.3.0, current version 6.3.0) /usr/X11R6/lib/libXrender.1.dylib (compatibility version 1.2.0, current version 1.2.0) /usr/X11R6/lib/libfontconfig.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/X11R6/lib/libX11.6.dylib (compatibility version 6.2.0, current version 6.2.0) /usr/X11R6/lib/libXcursor.1.dylib (compatibility version 1.0.0, current version 1.0.0) /sw/lib/libatk-1.0.0.dylib (compatibility version 601.0.0, current version 601.1.0) /sw/lib/libgdk_pixbuf-2.0.0.dylib (compatibility version 401.0.0, current version 401.9.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.1.11) /sw/lib/libpangoxft-1.0.0.dylib (compatibility version 601.0.0, current version 601.0.0) /sw/lib/libpangox-1.0.0.dylib (compatibility version 601.0.0, current version 601.0.0) /sw/lib/libpango-1.0.0.dylib (compatibility version 601.0.0, current version 601.0.0) /sw/lib/libgobject-2.0.0.dylib (compatibility version 601.0.0, current version 601.6.0) /sw/lib/libgmodule-2.0.0.dylib (compatibility version 601.0.0, current version 601.6.0) /sw/lib/libglib-2.0.0.dylib (compatibility version 601.0.0, current version 601.6.0) /sw/lib/libintl.1.dylib (compatibility version 2.0.0, current version 2.1.0) /sw/lib/libiconv.2.dylib (compatibility version 6.0.0, current version 6.0.0) /usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version 93.0.0)