R can't find icc to compile packages

386 Views Asked by At

I've compiled R-mkl package in Arch Linux using the Intel OneAPI compilers. But I cannot install packages from inside R, since it cannot find icc. The path in order to bash find the executables is defined in /etc/bash.bashrc:

export PATH="$PATH:/opt/intel/oneapi/compiler/latest/linux/bin/intel64/"

When I try to compile a package, it says it cannot find icc:

> install.packages("lazyeval")
Installing package into ‘/home/juliano/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
tentando a URL 'https://cran.rstudio.com/src/contrib/lazyeval_0.2.2.tar.gz'
Content type 'application/x-gzip' length 83482 bytes (81 KB)
==================================================
downloaded 81 KB

* installing *source* package ‘lazyeval’ ...
** package ‘lazyeval’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
icc -std=gnu11 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -fpic  -O3 -fPIC -m64 -march=native -fp-model precise -fp-model source -I/opt/intel/mkl/include  -c expr.c -o expr.o
/bin/sh: linha 1: icc: command not found
make: *** [/usr/lib64/R/etc/Makeconf:169: expr.o] Erro 127
ERROR: compilation failed for package ‘lazyeval’
* removing ‘/home/juliano/R/x86_64-pc-linux-gnu-library/4.2/lazyeval’
Warning in install.packages :
  installation of package ‘lazyeval’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpPvcR2C/downloaded_packages’

How I do instruct R to read /etc/bash.bashrc or define the path to the compilers manually?

I have also tried to define the path in a file in /etc/profile.d, without success.

1

There are 1 best solutions below

1
Noorjahan - Intel On

You can try sourcing setvars.sh script to initiate the OneAPI environment.

source /opt/intel/oneapi/setvars.sh

As you said, it will work if you create a symlink to the /bin.

Refer to the below link to get more details on usage of R with Intel OneAPI https://www.intel.com/content/www/us/en/developer/articles/technical/using-onemkl-with-r.html