RcppCore / RcppEigen

Rcpp integration for the Eigen templated linear algebra library
Other
110 stars 40 forks source link

RcppEigen failing to build on Debian 10, R 4.0.4 inside Docker #95

Closed mjsteinbaugh closed 3 years ago

mjsteinbaugh commented 3 years ago

Hi, I'm having trouble getting RcppEigen to build inside Docker on Debian 10.8, R 4.0.4. I'm hitting this with the R CRAN binary, R built from source, and with R-devel. I'm also hitting this issue with the older version of RcppEigen, 0.3.3.7.0. Something may be messed up in my configuration, but I can't figure it out. Here's a minimal reprex:

image='acidgenomics/r-base:4.0.4-20210216'
docker pull "$image"
docker run -it "$image"
install.packages("RcppEigen")  # 0.3.3.9.1
[...]
../inst/include/Eigen/src/Core/AssignEvaluator.h:782:18:   required from ‘void Eigen::internal::call_assignment(Dst&, const Src&) [with Dst = Eigen::Matrix<double, -1, 1>; Src = Eigen::Product<Eigen::Product<Eigen::Product<Eigen::Matrix<double, -1, -1>, Eigen::Transpose<const Eigen::Matrix<double, -1, -1> >, 0>, Eigen::Transpose<const Eigen::Map<Eigen::Matrix<double, -1, -1>, 0, Eigen::Stride<0, 0> > >, 0>, Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >, 0>]’
../inst/include/Eigen/src/Core/PlainObjectBase.h:714:32:   required from ‘Derived& Eigen::PlainObjectBase<Derived>::_set(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::Product<Eigen::Product<Eigen::Product<Eigen::Matrix<double, -1, -1>, Eigen::Transpose<const Eigen::Matrix<double, -1, -1> >, 0>, Eigen::Transpose<const Eigen::Map<Eigen::Matrix<double, -1, -1>, 0, Eigen::Stride<0, 0> > >, 0>, Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >, 0>; Derived = Eigen::Matrix<double, -1, 1>]’
../inst/include/Eigen/src/Core/Matrix.h:225:24:   required from ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::operator=(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::Product<Eigen::Product<Eigen::Product<Eigen::Matrix<double, -1, -1>, Eigen::Transpose<const Eigen::Matrix<double, -1, -1> >, 0>, Eigen::Transpose<const Eigen::Map<Eigen::Matrix<double, -1, -1>, 0, Eigen::Stride<0, 0> > >, 0>, Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >, 0>; _Scalar = double; int _Rows = -1; int _Cols = 1; int _Options = 0; int _MaxRows = -1; int _MaxCols = 1]’
fastLm.cpp:179:55:   required from here
../inst/include/Eigen/src/Core/CoreEvaluators.h:960:8: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type’ {aka ‘__vector(2) double’} [-Wignored-attributes]
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[1]: *** [/opt/koopa/app/r/4.0.4/lib/R/etc/Makeconf:181: fastLm.o] Error 1
make[1]: Leaving directory '/tmp/RtmpY8UgNM/R.INSTALLbf3500638e/RcppEigen/src'
ERROR: compilation failed for package ‘RcppEigen’
* removing ‘/opt/koopa/opt/r/site-library/RcppEigen’
Warning in install.packages("RcppEigen") :
  installation of one or more packages failed,
  probably ‘RcppEigen’

For reference, a Google search appears to indicate that the r-lib development team has been hitting this recently as well, as seen in the testthat logs.

Any help would be greatly appreciated, as a bunch of my Docker images depend on the package.

Best, Mike

Enchufa2 commented 3 years ago
g++: fatal error: Killed signal terminated program cc1plus

This usually happens when you run out of RAM. I suggest to take a look at htop at the same time to monitor whether this is the cause.

mjsteinbaugh commented 3 years ago

Thanks, that could definitely be the culprit. Will report back.

eddelbuettel commented 3 years ago

Yes I answered that resource starvation a few times over over the years. C++ compilers need some RAM.

Now, the simplest way to avoid this is sudo apt install r-cran-rcppeigen as you don't have to compile. Just use a binary.

And there is a reason I provide rocker/r-base aka r-base: you get a well maintained, Debian-based container to build on.

mjsteinbaugh commented 3 years ago

Yep, Docker was too RAM starved. That fixed the issue. @eddelbuettel rocker/r-base is a fantastic resource and I use that in some Docker images as well. Thanks for maintaining that. This is safe to close.