Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange C compiler error when installing R package on a cluster

Tags:

c

package

r

mpi

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

like image 470
user3825755 Avatar asked Apr 07 '15 12:04

user3825755


1 Answers

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

like image 88
Oliver Avatar answered Nov 15 '22 00:11

Oliver