[R] compiling gap on mac os x

Bill Northcott w.northcott at unsw.edu.au
Sat Jun 25 04:51:07 CEST 2005


On 24/06/2005, at 8:00 PM, Kenny Ye wrote:
> Hi, I am having trouble compiling package gap
> http://www.hgmp.mrc.ac.uk/~jzhao/r-progs.htm on Tiger. I have  
> installed
> XcodeTools 2.1. The binary version of gap currently available on CRAN
> has some bug and is fixed in the latest version.
> ........
> '/Library/Frameworks/R.framework/Versions/2.1.0/Resources/library/gap'
>     npackage installation failed
> ld: warning multiple definitions of symbol _i1mach_
> pfc.sim.o definition of _i1mach_ in section (__TEXT,__text)
> /Library/Frameworks/R.framework/R(i1mach.lo) definition of _i1mach_
> ld: 2ld.o has external relocation entries in non-writable section
> (__TEXT,__text) for symbols:
> restFP
> saveFP
> make: *** [gap.so] Error 1
> ERROR: compilation failed for package 'gap'

This is caused by using a gcc Fortran compiler build from FSF code  
with a gcc C compiler built from Apple code.

The Apple gcc library has the restFP, saveFP symbols and these are  
used by the Apple compiler.  So if you try link Fortran code built  
with an FSF compiler, with an Apple C code library, it will fail  
because the FSF gcc library included in the link by the Fortran  
compiler does not have these symbols to satisfy the undefined symbols  
in the C library.  For the full story see:
http://www.astro.gla.ac.uk/users/norman/note/2004/restFP/

There are two possible fixes:
1.  Use a gcc Fortran compiler built with Apple code such as the one  
available at www.swarm.org.  You might also try recent builds from  
hpc.sourceforge.net.
or
2.  Include the Apple gcc library in the link.  The standard way of  
doing this was via a symlink at /usr/lib/libcc_dynamic.a which linked  
to libgcc.a in the Apple compiler.  Then -lcc_dynamic was included in  
the LDFLAGS.  I think this link was dropped in recent versions of  
MacOS X, around the time they stopped shipping gcc 2.95.
You can put in the symlink yourself if its not there, and add the ld  
flag to the R configuration.

Bill Northcott




More information about the R-help mailing list