Skip to content

Building R from source under Mac OS X 10.8.2?

3 messages · Simon Urbanek, Dominick Samperi

#
Hello,

I'm trying to build R from source under Mac OS X 10.8.2 (Mountain Lion)
by following the FAQ and I run into a problem with the Fortran
compiler (downloaded from http://cran.r-project.org/bin/macosx/tools/),
specifically, gfortran-4.2.3. I have Xcode 4.6 installed along with
the latest command-line tools (dated Feb. 9, 2013).

When I try to run configure with or without the --enable-R-framework
options I get this diagnostic:
checking for dummy main to link with Fortran 77 libraries... none
checking for Fortran 77 name-mangling scheme... unknown
configure: WARNING: unknown Fortran name-mangling scheme
checking whether gfortran appends underscores to external names... unknown
configure: error: cannot use Fortran

I'm working with the source for R 2.15.2.

Any tips would be appreciated.

Thanks,
Dominick
#
Dominick,
On Feb 15, 2013, at 3:13 AM, Dominick Samperi wrote:

            
Have you setup flags so that the architectures match? The default in Xcode for ML is 64-bit while the default for the Fortran is 32-bit (because that was the default for Xcode at the time), so depending on which architecture you want to compile you'll have to use either -arch x86_64 or -arch i386 (see the FAQ for a quickstart guide to compiling R).

Cheers,
Simon
#
Thanks Simon,

I tried the FAQ first, specifically, the
bit about setting arch=x86_64, changing directory
to R-$arch, and running:

../R-2.15.2/configure r_arch=$arch  CC="gcc-4.2 -arch $arch" \
          CXX="g++-4.2 -arch $arch" F77="gfortran-4.2 -arch $arch" \
          FC="gfortran-4.2 -arch $arch" OBJC="gcc-4.2 -arch $arch" \
          --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib

This leads to:
checking whether the C compiler works... no
configure: error: in `/Users/dsamperi/Downloads/R-x86_64':
configure: error: C compiler cannot create executables
See `config.log' for more details

config.log shows that gcc-4.2 was not found, so I edited
the command line by replacing gcc-4.2 with gcc. configure
then failed because g++-4.2 was not found, so I removed
the "-4.2" part here as well.

Now configure finishes.

Thanks again,
Dominick

On Fri, Feb 15, 2013 at 9:04 AM, Simon Urbanek
<simon.urbanek at r-project.org> wrote: