Deployment failed with error: Compilation failed for package ‘RcppEigen’

Hi RStudio Community!

Wanted to see if anyone has a solution to this Shiny app deployment error that compilation had failed for package 'RcppEigen’, hoping to get to resolve this to get an app published. Appreciate your thoughts and help!

Sophia

[Connect] 2023/01/14 04:41:55.052064900 [1] "Command failed (1)\n\nFailed to run system command:\n\n\t'/usr/lib64/R/bin/R' --vanilla CMD INSTALL --preclean '/opt/rstudio-connect/mnt/tmp/RtmpguzGUF/RcppEigen' --library='/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-redhat-linux-gnu/3.6.0' --install-tests --no-docs --no-multiarch --no-demo \n\nThe command failed with output:\n* installing *source* package ‘RcppEigen’ ...\n** package ‘RcppEigen’ successfully unpacked and MD5 sums checked\n** using staged installation\n** libs\ng++ -m64 -std=gnu++11 -I\"/usr/include/R\" -DNDEBUG  -I\"/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-redhat-linux-gnu/3.6.0/Rcpp/include\" -I/usr/local/include -I../inst/include -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c RcppEigen.cpp -o RcppEigen.o\ng++ -m64 -std=gnu++11 -I\"/usr/include/R\" -DNDEBUG  -I\"/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-redhat-linux-gn
[Connect] u/3.6.0/Rcpp/include\" -I/usr/local/include -I../inst/include -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c RcppExports.cpp -o RcppExports.o\ng++ -m64 -std=gnu++11 -I\"/usr/include/R\" -DNDEBUG  -I\"/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-redhat-linux-gnu/3.6.0/Rcpp/include\" -I/usr/local/include -I../inst/include -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c fastLm.cpp -o fastLm.o\ngcc -m64 -std=gnu99 -I\"/usr/include/R\" -DNDEBUG  -I\"/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-redhat-linux-gnu/3.6.0/Rcpp/include\" -I/usr/local/include  -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c init.c -o init.o\nfastLm.cpp: In function ‘int lmsol::gesdd(Eigen::Matr
[Connect] ixXd&, Eigen::ArrayXd&, Eigen::MatrixXd&)’:\nfastLm.cpp:147:54: error: expected ‘)’ before ‘FCONE’\n     &m, Vt.data(), &n, &wrk, &mone, &iwork[0], &info FCONE);\n                                                      ^\nfastLm.cpp:151:59: error: expected ‘)’ before ‘FCONE’\n     &m, Vt.data(), &n, &work[0], &lwork, &iwork[0], &info FCONE);\n                                                           ^\nmake: *** [fastLm.o] Error 1\nERROR: compilation failed for package ‘RcppEigen’\n* removing ‘/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-redhat-linux-gnu/3.6.0/RcppEigen’"
[Connect] 2023/01/14 04:41:55.052845235 Error: Command failed (1)
[Connect] 2023/01/14 04:41:55.052862170 
[Connect] 2023/01/14 04:41:55.052919585 Failed to run system command:
[Connect] 2023/01/14 04:41:55.052923049 
[Connect] 2023/01/14 04:41:55.052943626 	'/usr/lib64/R/bin/R' --vanilla CMD INSTALL --preclean '/opt/rstudio-connect/mnt/tmp/RtmpguzGUF/RcppEigen' --library='/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-redhat-linux-gnu/3.6.0' --install-tests --no-docs --no-multiarch --no-demo 
[Connect] 2023/01/14 04:41:55.052953159 
[Connect] 2023/01/14 04:41:55.052967937 The command failed with output:
[Connect] 2023/01/14 04:41:55.052970264 * installing *source* package ‘RcppEigen’ ...
[Connect] 2023/01/14 04:41:55.052980415 ** package ‘RcppEigen’ successfully unpacked and MD5 sums checked
[Connect] 2023/01/14 04:41:55.052982964 ** using staged installation
[Connect] 2023/01/14 04:41:55.052992590 ** libs
[Connect] 2023/01/14 04:41:55.052995118 g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG  -I"/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-redhat-linux-gnu/3.6.0/Rcpp/include" -I/usr/local/include -I../inst/include -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c RcppEigen.cpp -o RcppEigen.o
[Connect] 2023/01/14 04:41:55.053009178 g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG  -I"/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-redhat-linux-gnu/3.6.0/Rcpp/include" -I/usr/local/include -I../inst/include -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c RcppExports.cpp -o RcppExports.o
[Connect] 2023/01/14 04:41:55.053011432 g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG  -I"/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-redhat-linux-gnu/3.6.0/Rcpp/include" -I/usr/local/include -I../inst/include -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c fastLm.cpp -o fastLm.o
[Connect] 2023/01/14 04:41:55.053021268 gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG  -I"/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-redhat-linux-gnu/3.6.0/Rcpp/include" -I/usr/local/include  -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c init.c -o init.o
[Connect] 2023/01/14 04:41:55.053026974 fastLm.cpp: In function ‘int lmsol::gesdd(Eigen::MatrixXd&, Eigen::ArrayXd&, Eigen::MatrixXd&)’:
[Connect] 2023/01/14 04:41:55.053041195 fastLm.cpp:147:54: error: expected ‘)’ before ‘FCONE’
[Connect] 2023/01/14 04:41:55.053048987      &m, Vt.data(), &n, &wrk, &mone, &iwork[0], &info FCONE);
[Connect] 2023/01/14 04:41:55.053065911                                                       ^
[Connect] 2023/01/14 04:41:55.053069114 fastLm.cpp:151:59: error: expected ‘)’ before ‘FCONE’
[Connect] 2023/01/14 04:41:55.053083187      &m, Vt.data(), &n, &work[0], &lwork, &iwork[0], &info FCONE);
[Connect] 2023/01/14 04:41:55.053086509                                                            ^
[Connect] 2023/01/14 04:41:55.053101897 make: *** [fastLm.o] Error 1
[Connect] 2023/01/14 04:41:55.053105173 ERROR: compilation failed for package ‘RcppEigen’

That is weird, it should be using the precompiled binary from RSPM. Are you including any sort of install command in your app's code?

Thanks for asking - Here are the lines in the app where packages are involved, all are library statements. This issue seems to happen particularly with the RcppEigen package, not sure if this is because its installation is different than others (e.g. requires C++ compilation??)

library(shiny)
library(survminer)
library(haven)
library(ggplot2)
library(dplyr)

library(survival)
library(table1)
library(shinythemes)
library(shinycssloaders)
library(networkD3)

For some reason it is not using the precompiled binary from the package manager, try forcing the use by making sure the version on your local computer is installed from a CRAN mirror and not github (reinstall if necessary), include a library call to RcppEigen at the beginning of your app's code and redeploy the app.

Update: The deployment had worked if an earlier version of RcppEigen (3.9.9.1 instead of 3.9.9.3) is used, probably due to our linux R needing upgrade? There maybe an update coming up but it's gonna be quite a while..

One related question is (happy to start a new thread if needed) - based on the deployment log, it appears that the user-level library on linux server R was being used, instead of the project-level library built by Packrat within the project directory on the linux-server R. Is there a way to deploy Shiny apps using the project-level lib instead of the user level lib?

[Connect] Building Shiny application...
[Connect] Bundle requested R version 3.6.0; using /usr/lib64/R/bin/R which has version 3.6.0
[Connect] 2023/01/17 21:30:41.829976796 Using user agent string: 'RStudio R (3.6.0 x86_64-redhat-linux-gnu x86_64 linux-gnu)' 
[Connect] 2023/01/17 21:30:42.284136980 linux distribution: Red Hat Enterprise Linux Server release 7.9 (Maipo) 
[Connect] 2023/01/17 21:30:42.285135855 # Validating R library read / write permissions --------------------------------
[Connect] 2023/01/17 21:30:42.285563254 R version: 3.6.0
[Connect] 2023/01/17 21:30:42.294836076 # Validating managed packrat installation --------------------------------------
[Connect] 2023/01/17 21:30:42.295189859 Vendored packrat archive: /opt/rstudio-connect/ext/R/packrat_0.5.0-25_448aafd176ec6cbde307f556c91b39e5a1c94f9d.tar.gz
[Connect] 2023/01/17 21:30:42.309421272 Vendored packrat SHA: 448aafd176ec6cbde307f556c91b39e5a1c94f9d
[Connect] 2023/01/17 21:30:42.311648777 Managed packrat SHA:  448aafd176ec6cbde307f556c91b39e5a1c94f9d
[Connect] 2023/01/17 21:30:42.315628827 Managed packrat version: 0.5.0.25
[Connect] 2023/01/17 21:30:42.316381010 Managed packrat is up-to-date.
[Connect] 2023/01/17 21:30:42.316656709 # Validating packrat cache read / write permissions ----------------------------
[Connect] 2023/01/17 21:30:42.585103656 Audited package hashes with local packrat installation.
[Connect] 2023/01/17 21:30:42.621346402 # Installing required R packages with `packrat::restore()` ---------------------

[Connect] 2023/01/17 21:30:44.308680575 Installing RcppEigen (0.3.3.9.1) ... 
[Connect] 2023/01/17 21:30:44.326272154 Using cached RcppEigen.
[Connect] 2023/01/17 21:30:44.326454948 	OK (symlinked cache)

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.