[Rd] MacOS 10.4 gcc-4.0 and libcc_dynamic

Bill Northcott w.northcott at unsw.edu.au
Wed Jul 6 02:07:02 CEST 2005


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



More information about the R-devel mailing list