rcaretkernlab

ERROR: compilation failed for package 'kernlab'; appears to fail when running some function 'dcauchy'


I'm getting an error while trying to install kernlab for R. My R version is 3.5.2. My OS is ChromeOS 108.0.5359.58 beta (64-bit), with Debian 10 (buster). Processor is an intel m3-8100Y (64-bit).

The error I'm getting doesn't seem to have been reported when trying to search for either problems with kernlab or dcauchy.c, though if there has been a previous question identical to mine, apologies!

> install.packages("kernlab", type="source")
Installing package into ‘/home/user/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/kernlab_0.9-31.tar.gz'
Content type 'application/x-gzip' length 1215549 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

* installing *source* package ‘kernlab’ ...
** package ‘kernlab’ successfully unpacked and MD5 sums checked
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c brweight.cpp -o brweight.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ctable.cpp -o ctable.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c cweight.cpp -o cweight.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c dbreakpt.c -o dbreakpt.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c dcauchy.c -o dcauchy.o
dcauchy.c: In function ‘dcauchy’:
dcauchy.c:110:13: error: expected ‘)’ before ‘FCONE’
     wa, &inc FCONE);
             ^~~~~~
             )
dcauchy.c:132:67: error: expected ‘)’ before ‘FCONE’
     F77_CALL(dsymv)("U", &n, &one, A, &n, s, &inc, &zero, wa, &inc FCONE);
                                                                   ^~~~~~
                                                                   )
dcauchy.c:156:67: error: expected ‘)’ before ‘FCONE’
     F77_CALL(dsymv)("U", &n, &one, A, &n, s, &inc, &zero, wa, &inc FCONE);
                                                                   ^~~~~~
                                                                   )
make: *** [/usr/lib/R/etc/Makeconf:162: dcauchy.o] Error 1
ERROR: compilation failed for package ‘kernlab’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/3.5/kernlab’

The downloaded source packages are in
        ‘/tmp/RtmpUQr5y3/downloaded_packages’
Warning message:
In install.packages("kernlab", type = "source") :
  installation of package ‘kernlab’ had non-zero exit status

I tried searching around for solutions, but nothing seems to have been posted. I would expect kernlab to install properly as it is required for certain parts of the caret package to also work properly, which I am using. Unfortunately, when I run install.packages("kernlab"), I instead get the above error. This includes trying to run R with sudo.


Solution

  • Just in case anyone has this issue in the future, I did manage to get it working. I noticed that I couldn't install kernlab on my Debian WSL on Windows either but it would work in windows Rterm. So one solution is to apparently not use linux.

    Once I identified that it seemed to be specifically linux where install.packages("kernlab") failed, I did some googling and saw that kernlab was available on the debian repos.

    sudo apt-get install r-cran-kernlab thus did the charm.