From ripley at stats.ox.ac.uk  Wed May 27 18:58:48 2009
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 27 May 2009 17:58:48 +0100 (BST)
Subject: [Rd] R package installation (PR#13726)
In-Reply-To: <20090527093510.E70DB2832188@mail.pubhealth.ku.dk>
References: <20090527093510.E70DB2832188@mail.pubhealth.ku.dk>
Message-ID: <alpine.LFD.2.00.0905271732590.21872@gannet.stats.ox.ac.uk>

This is a problem in your specification to R of the peculiarities of 
your system, not in R itself.  You have only specified some of the 
settings you need, and in particular as you are using Fortran 90 code 
and a shared R library you need more than a typical user would.

On Wed, 27 May 2009, l.bartnik at gmail.com wrote:

> Full_Name: Lukasz Andrzej Bartnik
> Version: 2.8.1

Not current.

> OS: RHELS 5.2
> Submission from: (NULL) (194.181.94.250)
>
>
> Compile R for 32 bit on a 64 bit machine:
>
> unset LD_LIBRARY_PATH
> unset R_LD_LIBRARY_PATH
> export CC="gcc -m32"
> export CXXFLAGS="-m32 -O2 -g"
> export FFLAGS="-m32 -O2 -g"
> export FCFLAGS="-m32 -O2 -g"
> export OBJCFLAGS="-m32 -O2 -g"
> export LIBnn=lib

Copied I suppose from the R-admin manual (without credit)?  The 
current version suggests

CC="gcc -m32"
F77="gfortran -m32"
FC=$(F77)
CXX="gcc -m32"
OBJC=$(CC)
LIBnn=lib

which I suspect you will find more successful.  However, you seem not 
to have studied the file config.site, which lists many settings you 
may need to specify.  Reading there, it seems that either 
SHLIB_FCLD="gfortran -m32" or SHLIB_FCLDFLAGS="-shared -m32" would be 
appropriate.

> ./configure --with-x=no --enable-R-shlib --prefix=/prefix
>
> Now try to install a package which has Fortran files inside:

Hmm, has Fortran 90 files inside: these do not use the same settings 
as 'Fortran'.

> /prefix/bin/R CMD INSTALL crawl_1.0-4.tar.gz
>
> * Installing to library '/prefix/lib/R/library'
> * Installing *source* package 'crawl' ...
> ** libs
> gfortran  -fpic -m32 -O2 -g -c  crwDriftN2ll.f90 -o crwDriftN2ll.o
> gfortran  -fpic -m32 -O2 -g -c  crwDriftPredict.f90 -o crwDriftPredict.o
> gfortran  -fpic -m32 -O2 -g -c  crwN2ll.f90 -o crwN2ll.o
> gfortran  -fpic -m32 -O2 -g -c  crwPredict.f90 -o crwPredict.o
> gfortran -shared -L/usr/local/lib -o crawl.so crwDriftN2ll.o crwDriftPredict.o
> crwN2ll.o crwPredict.o   -L/prefix/lib/R/lib -lR
> /usr/bin/ld: skipping incompatible /prefix/lib/R/lib/libR.so when searching for
> -lR
> /usr/bin/ld: cannot find -lR
> collect2: ld returned 1 exit status
> make: *** [crawl.so] Error 1
> ERROR: compilation failed for package 'crawl'
> ** Removing '/prefix/lib/R/library/crawl'
> ** Restoring previous '/prefix/lib/R/library/crawl'
>
> This error can be avoided if /prefix/lib/R/etc/Makeconf is modified:
>
> Remove: SHLIB_FCLD = gfortran
> Insert: SHLIB_FCLD = gfortran -m32
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] R package installation (PR#13726)
Prof Brian Ripley