Strange C compiler error when installing R package on a cluster
Asked Answered
B

2

7

-- I was able to solve this problem, see last edit below ---

I am trying to use R on the computing cluster of my institute. For parallel computing issues, I would like to install the snow and the Rmpi package. So I downloaded the tar.gz files and tried to install the pacakges, for snow it worked fine, but for Rmpi something strange happens:

What I did first:

install.packages("/home/myusername/Rpackages/Rmpi_0.6-5.tar.gz", repos = NULL, type = "source", lib = "/home/myusername/Rpackages/")
* installing *source* package ‘Rmpi’ ...
** Paket ‘Rmpi’ erfolgreich entpackt und MD5 Summen überprüft
checking for gcc... gcc -m64 -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -m64 -std=gnu99 accepts -g... yes
checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
Trying to find mpi.h ...
Cannot find mpi.h header file
Please use --with-mpi=/path/to/mpi or specify the environment variable MPI_ROOT
ERROR: configuration failed for package ‘Rmpi’
* removing ‘/home/myusername/Rpackages/Rmpi’

Ok, so mpi.h seemed to be missing, I did some searching and found out what to do: specify the path to the MPI libraries:

> install.packages("/home/myusername/Rpackages/Rmpi_0.6-5.tar.gz", repos = NULL, type = "source", lib = "/home/myusername/Rpackages/", configure.args="--with-mpi=/cm/local/modulefiles/openmpi/gcc/64/1.6.3" )
* installing *source* package ‘Rmpi’ ...
** Paket ‘Rmpi’ erfolgreich entpackt und MD5 Summen überprüft
checking for gcc... gcc -m64 -std=gnu99
checking whether the C compiler works... no
configure: error: in `/tmp/Rtmp9qZ8QA/R.INSTALLad327c257ce2/Rmpi':
configure: error: C compiler cannot create executables
See `config.log' for more details

ERROR: configuration failed for package ‘Rmpi’
* removing ‘/home/myusername/Rpackages/Rmpi’
Warnmeldung:
In install.packages("/home/myusername/Rpackages/Rmpi_0.6-5.tar.gz",  :
  Installation des Pakets ‘/home/myusername/Rpackages/Rmpi_0.6-5.tar.gz’ hatte Exit-Status ungleich 0

So now there is no mpi.h error, but the C compiler appears not to work, although it did before and I only changed the mpi option in the install.packages function.

What went wrong here and how can I install the package?


Edit 2: After some help, I figured out how to find where the mpi files are located and did this:

install.packages("/home/myusername/Rpackages/Rmpi_0.6-5.tar.gz", repos = NULL, type = "source", lib = "/home/myusername/Rpackages/", configure.args=c("--with-Rmpi-libpath=/usr/mpi/gcc/openmpi-1.6.3/lib64/","--with‌​-Rmpi-type=OPENMPI", "--with-Rmpi-include=/usr/mpi/gcc/openmpi-1.6.3/include/") )

However, this still does not work and I get the following errors:

* installing *source* package ‘Rmpi’ ...
** Paket ‘Rmpi’ erfolgreich entpackt und MD5 Summen überprüft
checking for openpty in -lutil... no
checking for main in -lpthread... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I/usr/mpi/gcc/openmpi-1.6.3/include/  -DMPI2 -DOPENMPI -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c Rmpi.c -o Rmpi.o
Rmpi.c: In Funktion »mpi_bcast«:
Rmpi.c:605:2: Fehler: unbekannter Typname: »R_xlen_t«
make: *** [Rmpi.o] Fehler 1
ERROR: compilation failed for package ‘Rmpi’

Edit 3: I figured out a solution to my problem which due to incomplete information, noone here could have found I guess. On the cluster, R was only installed in version 2.15.2, but Rmpi 0.6-5 is built for R 3.0.0 or newer. The R version dependence in the Rmpi package is wrongly specified. I downloaded an older version (Rmpi 0.6-1) and was able to install this one.

Bumper answered 7/4, 2015 at 12:17 Comment(7)
are you sure that the folder /cm/local/modulefiles/openmpi/gcc/64/1.6.3/ contains the whole MPI installation? Usually MPI is not installed into the modulefiles configuration. Run locate mpi.h and locate mpirun to find the directories in which MPI is actually installed.Depolarize
No, I am not sure which folder actually contains the MPI installation, and I am also not sure if I can access this folder. Both locate mpi.h as well as locate mpirun do not give back anythingBumper
Run module list and then look for an entry that corresponds to openmpi 1.6.3 compiled for gcc (e.g. openmpi/1.6.3). Pick that entry and run module load openmpi/1.6.3 (the name of the module might be different). Then which mpirun should tell you where openmpi is installed.Depolarize
So with module available I found this one: openmpi/gcc/64/1.6.3, and then loaded it via module load /cm/local/modulefiles/openmpi/gcc/64/1.6.3 which was then also shown after module list. which mpirun gives back /usr/mpi/gcc/openmpi-1.6.3/bin/mpirun, so I tried to use this in the Rmpi package installation: install.packages("/home/myusername/Rpackages/Rmpi_0.6-5.tar.gz", repos = NULL, type = "source", lib = "/home/myusername/Rpackages/", config.args = "--with-mpi=/usr/mpi/gcc/openmpi-1.6.3/bin/mpirun"), the compiler now works, but again, mpi.his not foundBumper
Somehow I cant edit my previous comment. So I realized what might have been wrong, and I did this: install.packages("/home/myusername/Rpackages/Rmpi_0.6-5.tar.gz", repos = NULL, type = "source", lib = "/home/myusername/Rpackages/", configure.args=c("--with-Rmpi-libpath=/usr/mpi/gcc/openmpi-1.6.3/lib64/","--with-Rmpi-type=OPENMPI", "--with-Rmpi-include=/usr/mpi/gcc/openmpi-1.6.3/include/") ), however, I get the following error: Rmpi.c: In Funktion »mpi_bcast«: Rmpi.c:605:2: Fehler: unbekannter Typname: »R_xlen_t« make: *** [Rmpi.o] Fehler 1 ERROR: compilation failed for package ‘Rmpi’Bumper
instead of setting --with-mpi=/usr/mpi/gcc/openmpi-1.6.3/bin/mpirun, try setting it to --with-mpi=/usr/mpi/gcc/openmpi-1.6.3/Depolarize
Thanks for you assistance, I was able to solve the problem, see last edit in the question post.Bumper
C
2

The problem is that it cannot compile the R-package if it cannot find the library. The solution is

$ sudo apt-get install libopenmpi-dev

then re-open R, and the install should work

R> install.packages('Rmpi')
Curacy answered 2/2, 2020 at 13:9 Comment(0)
I
1

I installed libopenmpi-dev in Ubuntu and tried installing Rmpi in Rstudio. It worked!

Imbed answered 23/4, 2019 at 7:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.