Skip to content
Prev 7204 / 15075 Next

Problem with readline when building R from source.

You are right.  Essentially you can change compilers and compiler
flags using a set of environment variables.  These variables are
common across projects where the build process is managed by automake.
 This is especially important if you want to switch between 32 and 64
bit.  My build R script goes more or less like
        ../${SRCDIR}/configure SHELL='/bin/bash' \
            CC="/usr/bin/gcc-4.2 -arch x86_64 -std=gnu99" \
            CFLAGS="-g -O2 -std=gnu99 -march=nocona" \
            CXX="/usr/bin/g++-4.2 -arch x86_64" \
            CXXFLAGS="-g -O2 -march=nocona" \
            OBJC="/usr/bin/gcc-4.2 -arch x86_64" \
            F77="/usr/bin/gfortran-4.2 -arch x86_64" \
            FFLAGS="-g -O2 -march=nocona" \
            FC="/usr/bin/gfortran-4.2 -arch x86_64" \
            FCFLAGS="-g -O2 -march=nocona" \
            --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib \
            --with-system-zlib \
            --with-blas='-framework vecLib' --with-lapack
        make -j2 || exit 1
        make check || exit 1
Note that I have the sources in one directory, but build in another
which is now recommended for many projects.

In general, all of this is more important on OS X than on Linux
because on OS X we typically have 2 compilers and 4 different
architectures.  The -arch flag makes a 64bit version.  And then there
is the whole issue of universal binaries.

Rolf: most of this can be learned from reading:
http://r.research.att.com/building.html

Now, the second set of questions.  Gfortran does not come with Xcode.
Simon has over the last years released various gfortran versions for
use with the various OS X'es.  My guess is that you have a leftover
gfortran you used under your old OS X installation, that is not smart
to use with the current Xcode.  You should remove the old gfortran and
install the new one from
  http://r.research.att.com/tools/
There are quite a few ones there.  Assuming you want to use the newest
and assuming that you have installed Xcode 3.2.2, I would recommend
  http://r.research.att.com/gfortran-42-5659.pkg
In order to uninstall the old one: you just have to remove the files.
For many versions of gfortran, SImon provided something like
gfortran-uninstall, which you may have available.  Using all the
newest stuff may mean that you cannot use binary builds of R packages
from CRAN/Bioconductor (I am not really up to date on this), but if
you build R from source you usually want to build the packages from
source.

All of this is slightly complicated.  But if you wanted it easy, you
should use the CRAN binary build of R :)

Kasper






On Fri, May 21, 2010 at 10:23 PM, Ben Madin
<lists at remoteinformation.com.au> wrote: