Closed pati-ni closed 1 year ago
Cannot reproduce, and would of course have heard from CRAN too if it was generalizable. Eg in a standard container that is Debian based:
edd@rob:~$ docker run --rm -ti r-base R
R version 4.2.3 (2023-03-15) -- "Shortstop Beagle"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> install.packages("RcppEigen")
install.packages("RcppEigen")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependency ‘Rcpp’
trying URL 'https://cloud.r-project.org/src/contrib/Rcpp_1.0.10.tar.gz'
Content type 'application/x-gzip' length 2936173 bytes (2.8 MB)
==================================================
downloaded 2.8 MB
trying URL 'https://cloud.r-project.org/src/contrib/RcppEigen_0.3.3.9.3.tar.gz'
Content type 'application/x-gzip' length 1470790 bytes (1.4 MB)
==================================================
downloaded 1.4 MB
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -ffile-prefix-map=/build/r-base-4.2.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c api.cpp -o api.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -ffile-prefix-map=/build/r-base-4.2.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c attributes.cpp -o attributes.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -ffile-prefix-map=/build/r-base-4.2.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c barrier.cpp -o barrier.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -ffile-prefix-map=/build/r-base-4.2.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c date.cpp -o date.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -ffile-prefix-map=/build/r-base-4.2.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c module.cpp -o module.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -ffile-prefix-map=/build/r-base-4.2.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c rcpp_init.cpp -o rcpp_init.o
g++ -std=gnu++14 -shared -L/usr/lib/R/lib -Wl,-z,relro -o Rcpp.so api.o attributes.o barrier.o date.o module.o rcpp_init.o -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/00LOCK-Rcpp/00new/Rcpp/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (Rcpp)
* installing *source* package ‘RcppEigen’ ...
** package ‘RcppEigen’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -I../inst/include -fpic -g -O2 -ffile-prefix-map=/build/r-base-4.2.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c RcppEigen.cpp -o RcppEigen.o
[...
a million lines with noise compiler messages removed .
...]
gcc -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -fpic -g -O2 -ffile-prefix-map=/build/r-base-4.2.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c init.c -o init.o
g++ -std=gnu++14 -shared -L/usr/lib/R/lib -Wl,-z,relro -o RcppEigen.so RcppEigen.o RcppExports.o fastLm.o init.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/00LOCK-RcppEigen/00new/RcppEigen/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (RcppEigen)
The downloaded source packages are in
‘/tmp/Rtmpc992c4/downloaded_packages’
>
Try editing PKG_CXXFLAGS = -I../inst/include
in src/Makevars
to make it PKG_CPPFLAGS = -I../inst/include
. You can see in my build log that the -I../inst/include
(that we need) is there C++14 use.
I very strongly suspect it is something with Arch, but I cannot put my finger on it. When I use this quick settings file ~/.R/Makevars
to force g++-13
(as you have) and C++17 (as your build uses) it still works:
XTRAFLAGS=-Wno-ignored-attributes
CXXFLAGS= $(DEBUG_OPTIM) -Wall -pipe $(PEDANTIC) $(XTRAFLAGS) $(LTO)
VER=-13
CC=gcc$(VER)
CXX=g++$(VER) -std=c++17
as we can see:
root@e13e6aea57a3:/tmp/RcppEigen# rm src/*.so src/*.o
root@e13e6aea57a3:/tmp/RcppEigen# R CMD INSTALL .
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘RcppEigen’ ...
** package ‘RcppEigen’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘gcc-13 (Debian 13.1.0-6) 13.1.0’
using C++ compiler: ‘g++-13 (Debian 13.1.0-6) 13.1.0’
g++-13 -std=c++17 -I"/usr/share/R/include" -DNDEBUG -I'/usr/lib/R/site-library/Rcpp/include' -I../inst/include -fpic -Wall -pipe -Wno-ignored-attributes -c RcppEigen.cpp -o RcppEigen.o
g++-13 -std=c++17 -I"/usr/share/R/include" -DNDEBUG -I'/usr/lib/R/site-library/Rcpp/include' -I../inst/include -fpic -Wall -pipe -Wno-ignored-attributes -c RcppExports.cpp -o RcppExports.o
g++-13 -std=c++17 -I"/usr/share/R/include" -DNDEBUG -I'/usr/lib/R/site-library/Rcpp/include' -I../inst/include -fpic -Wall -pipe -Wno-ignored-attributes -c fastLm.cpp -o fastLm.o
gcc-13 -I"/usr/share/R/include" -DNDEBUG -I'/usr/lib/R/site-library/Rcpp/include' -fpic -g -O2 -ffile-prefix-map=/build/r-base-O3lIg6/r-base-4.3.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c init.c -o init.o
g++-13 -std=c++17 -shared -L/usr/lib/R/lib -Wl,-z,relro -o RcppEigen.so RcppEigen.o RcppExports.o fastLm.o init.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/00LOCK-RcppEigen/00new/RcppEigen/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (RcppEigen)
root@e13e6aea57a3:/tmp/RcppEigen#
That still uses the (current) rocker/r-base
container to which I added g++-13 gfortan-13 r-cran-rcpp
. (The latter only to no have had to build it, it's quick as seen above.)
Try editing
PKG_CXXFLAGS = -I../inst/include
insrc/Makevars
to make itPKG_CPPFLAGS = -I../inst/include
. You can see in my build log that the-I../inst/include
(that we need) is there C++14 use.
Yes, this was Arch related and also affected other packages with similar include errors. Adding PKG_CXXFLAGS = -I../inst/include
to .R/Makevars fixed it. Thanks for the help
Thanks for confirming. Given that I am also the R maintainer for Debian: any idea what happened and how R (accidently) got built on Arch in a way that made the PKG_CXXFLAGS
from src/Makevars
be ignored?
Sorry for the delayed reply.
Actually the problem was system specific. In my ~/.R/Makevars
I had PKG_CXXFLAGS = -O3 -g
. It seems as if this overrides the package-specific options src/Makevars
. I did not know that. No problem with the upstream distributions of R as far as I can tell.
That would do it -- in general do not set variable named PKG_*
in ~/.R/Makevars
. Everything named PKG_*
belongs in the version in the package.
In ~/.R/Makevars
only set (and specialise) what R has in its own $R_HOME/etc/Makeconf
.
I can't install RcppEigen in the latest R 4.3.1. It complains about the RcppEigen.h file
Here is the log:
Here is my sessionInfo():