[R] Rmpi on Linux x86_64 GNU/Linux

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jan 16 23:22:59 CET 2008


On Wed, 16 Jan 2008, Brian O'Gorman wrote:

> I'm having trouble with R CMD INSTALL Rmpi_0.5-5.tar.gz 
> --configure-args=~/lam
>
> lam is is installed locally.

That's the problem.  You need to build a shared library version, not a 
static version, to allow it to be compiled into shared objects.
(--enable-shared --disable-static, as I recall.)  Or at least ensure that 
your static library is PIC (add -fPIC to the compiler flags and rebuild 
from scratch).

When you do, you may find that linking against some library 
(perhaps -lutil?) is missing, and you need to modify the Makefiles to 
include that.  (Maybe the latest lam has that corrected: check it 
appears as a dependency of liblam.so.0.0.0.)  You will also need to ensure 
the location you install is known to ldconfig or in LD_LIBRARY_PATH.

I built Rmpi successfully on F8 last week, *provided* you only have the 
.x86_64 lam[-devel] RPMs installed and not also the .i386 ones (Rmpi looks 
in /usr/lib on x86_64 before /usr/lib64, which is incorrect).  Just in 
case anyone else meets that quirk.  (yum install will by default add both 
cputypes.)

> lamboot  -d (or lamboot-d and also recon) works. make -k check from the 
> lamtest suite passes all tests.
> Is this is problem with the -fPIC compiler as in the message? Should it be 
> modified in the Makefile?
> Any help or comments are appreciated, thanks.

[And please use R-devel for technical (non-R) programming questions.]

>
> * Installing to library 
> '/u1/uaf/ogorman/R/x86_64-unknown-linux-gnu-library/2.6'
> * Installing *source* package 'Rmpi' ...
> checking for gcc... gcc
> checking for C compiler default output file name... a.out
> checking whether the C compiler works... yes
> checking whether we are cross compiling... no
> checking for suffix of executables...
> checking for suffix of object files... o
> checking whether we are using the GNU C compiler... yes
> checking whether gcc accepts -g... yes
> checking for gcc option to accept ISO C89... none needed
> Try to find mpi.h ...
> Found in /import/home/u1/uaf/ogorman/lam/include
> Try to find libmpi.so or libmpich.a
> checking for main in -lmpi... yes
> Try to find liblam.so ...
> checking for main in -llam... yes
> checking for openpty in -lutil... yes
> checking for main in -lpthread... yes
> configure: creating ./config.status
> config.status: creating src/Makevars
> ** libs
> gcc -std=gnu99 -I/usr/local/pkg/r/r-2.6.1/lib64/R/include 
> -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -DPACKAGE_NAME=\"\" 
> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" 
> -DPACKAGE_BUGREPORT=\"\" -I/import/home/u1/uaf/ogorman/lam/include -DMPI2 
> -DLAM -fPIC -I/usr/local/include    -fpic  -g -O2 -c conversion.c -o 
> conversion.o
> gcc -std=gnu99 -I/usr/local/pkg/r/r-2.6.1/lib64/R/include 
> -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -DPACKAGE_NAME=\"\" 
> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" 
> -DPACKAGE_BUGREPORT=\"\" -I/import/home/u1/uaf/ogorman/lam/include -DMPI2 
> -DLAM -fPIC -I/usr/local/include    -fpic  -g -O2 -c internal.c -o internal.o
> gcc -std=gnu99 -I/usr/local/pkg/r/r-2.6.1/lib64/R/include 
> -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -DPACKAGE_NAME=\"\" 
> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" 
> -DPACKAGE_BUGREPORT=\"\" -I/import/home/u1/uaf/ogorman/lam/include -DMPI2 
> -DLAM -fPIC -I/usr/local/include    -fpic  -g -O2 -c RegQuery.c -o RegQuery.o
> gcc -std=gnu99 -I/usr/local/pkg/r/r-2.6.1/lib64/R/include 
> -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -DPACKAGE_NAME=\"\" 
> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" 
> -DPACKAGE_BUGREPORT=\"\" -I/import/home/u1/uaf/ogorman/lam/include -DMPI2 
> -DLAM -fPIC -I/usr/local/include    -fpic  -g -O2 -c Rmpi.c -o Rmpi.o
> gcc -std=gnu99 -shared -L/usr/local/lib64 -o Rmpi.so conversion.o internal.o 
> RegQuery.o Rmpi.o -L/import/home/u1/uaf/ogorman/lam/lib -lmpi -llam -lutil 
> -lpthread -fPIC 
> /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3/../../../../x86_64-suse-linux/bin/ld: 
> /import/home/u1/uaf/ogorman/lam/lib/libmpi.a(abort.o): relocation R_X86_64_32 
> can not be used when making a shared object; recompile with -fPIC
> /import/home/u1/uaf/ogorman/lam/lib/libmpi.a: could not read symbols: Bad 
> value
> collect2: ld returned 1 exit status
> make: *** [Rmpi.so] Error 1
> chmod: cannot access 
> `/import/home/u1/uaf/ogorman/R/x86_64-unknown-linux-gnu-library/2.6/Rmpi/libs/*': 
> No such file or directory
> ERROR: compilation failed for package 'Rmpi'
> ** Removing 
> '/import/home/u1/uaf/ogorman/R/x86_64-unknown-linux-gnu-library/2.6/Rmpi'
>
>

-- 
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




More information about the R-help mailing list