From w.northcott at unsw.edu.au  Wed Jul  6 02:07:02 2005
From: w.northcott at unsw.edu.au (Bill Northcott)
Date: Wed, 6 Jul 2005 10:07:02 +1000
Subject: [Rd] MacOS 10.4 gcc-4.0 and libcc_dynamic
In-Reply-To: <mailman.7.1120557600.7414.r-devel@r-project.org>
References: <mailman.7.1120557600.7414.r-devel@r-project.org>
Message-ID: <AD569AA7-FC12-4591-95E6-B069EDD93BDC@unsw.edu.au>

Around line 527 of configure.ac in R-2.1.1 appears the following:

   darwin*)
     ## MacOS 10.3 and 10.4 do
     AM_CONDITIONAL(BUILD_DLFCN_DARWIN, false)
     ## SI says we want '-lcc_dynamic' on Darwin, although currently
     ## http://developer.apple.com /documentation/MacOSX/ has nothing
     ## official.
     AC_CHECK_LIB(cc_dynamic, main)
     ;;
   *)
     AM_CONDITIONAL(BUILD_DLFCN_DARWIN, false)
     AC_CHECK_LIB(dl, dlopen)
     ;;

The purpose of this is to add -lcc_dynamic to the link options when  
linking Fortran code built with an FSF g77 with C libraries built  
with Apple's gcc-3.xx compilers.  (see http://www.astro.gla.ac.uk/ 
users/norman/note/2004/restFP/ for the full story.).

The fixed worked because /usr/lib/libcc_dynamic.dylib was a symlink  
to /usr/lib/gcc/powerpc-apple-darwin/$VERSION/libgcc.a.

I write 'was' because as of gcc-4.0 on Tiger (10.4) this has  
changed.  gcc-4.0 is the default compiler for Tiger, and it does not  
have the symlink.  This is for the very good reason that it would not  
work.  I have tried it.  If gcc_select is used to changed the default  
compiler, the symlink is created, but it is destroyed again if the  
default is set back to 4.0.

As far as I can see at this point, there are two ways to build R on  
MacOS X 10.4 Tiger:
1.  use gcc-3.3 with g77 and ensure that -lcc_dynamic is in the link  
options.
or
2. use gcc-4.0 with gfortran in which case -lcc_dynamic is not  
required and the configure.ac test above is redundant.

AFAIK gcc-4.0 cannot be used with g77.

Apple have been adding 'APPLE LOCAL' mods to gfortran and it can now  
be built from current Apple sources simply by adding f95 to the -- 
enable-languages on line 102 of the build_gcc script.  I suspect that  
in the not too distant future gfortran will become part of the Xcode  
packages.

Bill Northcott



[Rd] MacOS 10.4 gcc-4.0 and libcc_dynamic
Bill Northcott