[R-SIG-Mac] Making Fortran shared objects on Mac

Kasper Daniel Hansen khansen at stat.Berkeley.EDU
Sun Dec 17 05:55:31 CET 2006

On Dec 17, 2006, at 2:55 AM, Emmanuel Sharef wrote:

> On Dec 16, 2006, at 6:50 PM, elw at stderr.org wrote:
>>> I get the following error when trying to compile some Fortran code
>>> to a shared object using R CMD SHLIB:
>>> R CMD SHLIB test3.f
>>> gfortran-4.0 -arch ppc   -fPIC  -g -O2 -c test3.f -o test3.o
>>> gcc-4.0 -arch ppc -dynamiclib -Wl,-macosx_version_min -Wl,10.3 -
>>> It looks like it's having some trouble with libtool, but I don't  
>>> know
>>> what it means. I have installed
>>> - the Apple developer tools
>>> - the gcc included with the R installer
>>> - g77 from hpc.sourceforge.net
>> where'd that gfortran come from?  last time i checked, apple wasn't
>> shipping a fortran compiler... have things changed, on that front?
> I think the gfortran is what was installed by the R 2.4.0 installer
> package. After installing it, I noticed that I didn't have a g77 yet,
> so I downloaded the one from hpc.sourceforge.net. Hm, is there some
> reason that R CMD SHLIB is calling gfortran instead of g77?

I remember an old post by Simon saying that essentially you need  
gfortran for gcc 4 and g77 for gcc 3. So based on that old remark (I  
know next to nothing about Fortran compilers) you are potentially  
doing something dangerous. The good thing is that due to the paths  
settings in R, your g77 does not get used at all, and if it was  
installed in /usr/local as usual, I fail to see how it could affect  
the R compilation unless you have done fishy stuff - at least if you  
are using the CRAN binary. If not, then I am not sure your PATH gets  
set correctly.... which may mix up versions.

That does not really explain why you get the error you get. It seems  
to complain about the -macos.. flag given to the linker. The exact  
same flag appears in the CRAN version, so I fail to see what is wrong.

So unless some of the gurus can quickly identify what is going wrong,  
I think you need to provide some details about your R installation.  
If you are able to, feel free to put up the code somewhere. I would  
not mind running it to see if I get the same error.


>> --e
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

More information about the R-SIG-Mac mailing list