NEMO on MacOSX -- installation comments

First impressions last forever ?

i should say upfront that so far i feel i've had a rough start with Mac OS X. Since some of my best (and wealthier) friends got this OS, i figured something must be good about it....

Apart from being unhappy about the performance, it's been a very unstable/shacky start for me (June 2003) to get it all working. Overall, the installation of NEMO now works, but I always seem to need some tinkering, which appears to depend on the OS patch level.... My new system (baught June 2004!) fared a little better, no doubt 10.3 is better than 10.2 (and I've also been spoiled too much with Solaris and Linux....). Don't even get me started on this inferior Aqua. By now i feel Gnome has surpassed it in capabilities. At least out of the box, i'll say that. There are tons of tools to make Aqua more useful, but take out your credit card and/or be ready to babysit some downloading, installation and disk "optimizing"!

Pre-conditions

Before you install NEMO, make sure you have enough developer tools installed. Again, out of the box a Mac is pretty useless (yeah yeah, again Linux shines here :-)
  1. install the X11 installer, mine was on disc3, which wasn't installed by default on mine. These are just user tools, not the developer tools, see below. Or check with Apple's X11 pages.
  2. install the Developer Tools from the Xcode CD that came with my 10.3 disc set (3 MacOSX CD's and 1 developer CD)
  3. install the X11SDK, which wasn't installed by the previous step to my surprise.
  4. install the basic fink (this took case of the basic tools like cvs, autoconf, etc.etc) Depending on additional packages you want with NEMO, you may need to install more tools. I'll document them as MacOSX and I get along better:
    1. dlcompat (only needed with 10.2 and below presumably)
    2. ? plplot ?
    3. ? cfitsio ?
    4. ? python ?

Installation notes (mostly for powerpc 10.3)

Some trouble points for NEMO you may encounter:
  1. (only 10.2 and below) dynamic linking: dlopen() is not directly supported in darwin yet, so you need to install dlcompat (e.g. via fink) first (see also README.install for the instructions) now fixed : also, 10.3 does not seem to need it anymore
  2. configure sometimes seems to add "-lcrt1.o -lcrtbegin.o" to FLIBS, this appears to be wrong and needs to be taken out. Edit the $NEMOLIB/makedefs file for this. - if you use PGPLOT you may also need to edit YAPPLIB in NEMORC.local to rid them of these libraries. In MacOS 10.3 this became "-lcrt1.o -lcrt2.o". This is the kind of error you may see:
    /usr/lib/crt1.o definition of _NXArgc in section (__DATA,__data)
    /usr/lib/crt1.o definition of _NXArgc in section (__DATA,__data)
    
    this seems to depend on the version of autoconf, 2.57 is ok, 2.59 - which comes with mac - does not
  3. configure seems to add a useless "-rdynamic" to the CFLAGS , it should be removed, since gcc/darwin doesn't know about this flag. Edit the file $NEMOLIB/makedefs again for this. Same with -fpic, which should be -fPIC or just removed, since we don't use shared libraries in darwin. now fixed
  4. later we found that the saveFP/restFP linking problem is removed by added -lcc_dynamic to NEMO_LIBS ($NEMOLIB/makedefs) now mostly fixed, some local Makefiles remain (See also: Norman Gray's FP notes)
  5. what's that missing fmath again.... (code not detecting that you don't have a fortran compiler around).
  6. Why can't Mac's filesystem handle filenames case sensitive, viz. touch /tmp/AAA; mkdir /tmp/aaa; i can't believe i had to rename files and directories for this.... for for NEMO, now also for MIRIAD...geez. grrr.... NEMO was hacked to fix this
  7. gyrfalcON installation may currently need some manual tweeks.
        [this was done with gcc-3.3 (build 1809) on os-x 10.4.5 
         where the default compiler was actually 4.0.0 (build 4061) - 
         but this version cannot compile gyrfalcON]
    
        % cd $NEMO/usr/dehnen/falcON
        % edit Makefile
                    -shared    =>     -flat_namespace -bundle -undefined suppress
                    (see also $NEMOBIN/ldso; not sure if we can even use shared libs    
                    since their official extension is .dylib, not .so)
        % edit make/defs
                    -rdynamic   :  remove it, this flag is not needed on mac
                    -rpath      :  remove it, this flag cannot be used on mac
                                        (or: make sure you use STATIC compile only)
                    -lg2c  => -lgfortran    : but only if you wind up using gcc4
    
        % make -i CXX=g++-3.3   nemo_bins
                    some executables might fail to compile... but gyrfalcON works
    
    
I followed the advice of another friend, since i had mysterious trouble with the fortran compiler after the upgrades Mac suggested. I finally followed the instructions on Khanna's page, and installed the original Mac Development Kit, and then the g77 3.1 kit from his page. After this, i got a working fortran compiler. The error appears to have been installing the Mac Developers Kit update, just the Dec 2002 Tools should do it. Actually, using the gcc and g77 3.3 also worked, as long as you don't do the Apple upgrade.

And performance? Well, nothing is for free. So far i get just a tad (10-20%) lower performance on a G4 vs. a P4 (at the same clock speed, given that most P4's run about 2-3 faster than a G4, well... to me that's a no brainer). If you normalize that by the price, we're 4-6 times off. If you have money, and energy to reprogram your code for altivec, or use dual processors, yes, go and make my day. But i still feel that the P4's are beating the G4's. G5? Come on, they only give you about 10-20% improvement at the same clock speed....

PS: yes. i'm a tad over-reacting. I spent just way too much money on this, and finding working software (despite fink) isn't as easy as i had hoped. gosh, it makes living with rpm's look easy now!

PSPS: I'm also keeping some links on darwin as i'm learning more about this, as well as my miriad/MacOSX notes which sometimes remind me of tricks of the Mac trade. Many thanks to Gaurav Khanna, Mark Bellon and Nicolas Martin for their patience in guiding me through this new forest.


Installation notes for powerpc 10.4

The usual story of upgrades and a totally broken system... This tale will be amended as i fix it. The Xcode compiler does not come with fortran, and is thus of limited use for NEMO. It is version 4.0.1 (Apple Computer, Inc. build 5250). There is also a gcc3 [version 3.3 20030304 (Apple Computer, Inc. build 1819].
Khanna's version is located in /usr/local/bin, but comes with gfortran (version 4.2.0 20060318). I have not been able to get dlopen() to work with this.

Example installation session

Here are my own 10.3 notes, now applying to the new (VERSION 3.2.2 or above) release.
1. Download: (use tar or cvs, make sure you get the CVS/pgplot version,
   not the one via Caltech, it doesn't have the darwin config files)

   cvs -Q co nemo
   cd nemo
   (mkdir local; cd local; cvs -Q co pgplot)

2. Configure the system. Some G5 systems may have the IBM compiler, which
   can confuse configure. Setting these 3 environment variables will set
   them more reliably for the gnu compiler:

   setenv CC gcc
   setenv F77 g77
   setenv CXX g++
   ./configure --with-yapp=pgplot --with-pgplot-prefix=`pwd`/lib

   Check the output, notably if X11 was detected properly for pgplot.
   Also, consider running autoconf yourself to overwrite the configure
   script, but it currently breaks more things than it fixes.

3. Important: For MacOSX you now need to edit makedefs and NEMORC.gen (or
   NEMORC.local if it was already there) and rid them of 
   any references to -lcrt1.o -lcrt2.o and/or -lcrtbegin.o 
   in the FLIBS and YAPPLIB variable resp. (which ones you see
   seem to depend on the compiler version and/or phase of the moon):

   emacs NEMORC.gen makedefs

   Oddly enough one persons 10.3 is not another persons... My own phase 
   of the moon was clean, i had to change nothing!!

4. Set the NEMO environment for user and programmer

   source nemo_start
   make postconfig
   source NEMORC.local

   Note that NEMORC.local is a copy of NEMORC.gen, so on MacOSX make
   sure there are no references to the .o files mentioned in item 3.
   If you edited NEMORC.gen the step before, you're ok.

5. Compile the pgplot library (inside $NEMOLIB) - there may be some
   fatal errors with complaints about undefined symbols like
   restFP and saveFP, but those won't have an impact on NEMO.

   make pgplot

6. Compile the NEMO library, it will silently do this and log the
   results in install.log

   make libs
   rehash


7. Now compile two sample routines to check if a simple and a more complex
   (graphics) program compile ok:

   mknemo tsf
   mknemo tabhist

8. If this is ok, continue to install the testsuite, if not, probably
   need to tinker with NEMORC.local (source it again) and/or 
   $NEMOLIB/makedefs:

   src/scripts/testsuite -b

   There will be a few small errors still, to be resolved.

9. For MacOSX users who have an unpatched HFS+ filesystem, there could be
   a few duplicate files that were mapped on top of each other 
   (the filecase bug), you'll have to figure this out yourself. I believe
   as of April 2004 NEMO is now clean of such duplicates.

MacOSX 10.5 and 10.6

As long as you have appropriate libraries installed (for X11 e.g. -lXext) and you have the compilers (C, C++ and Fortran), the default install as described on the main page should mostly work. You might need a few patches aferwards. For example, for gyrfalcON you will need a few small patches to the makefile's
last mod: 5-sep-2009 PJT