RcppCore / RcppArmadillo

Rcpp integration for the Armadillo templated linear algebra library
193 stars 55 forks source link

RcppArmadillo not available for R 4.3.2 + compilation errors #434

Closed dbontemps closed 9 months ago

dbontemps commented 9 months ago

Hi,

On linux, R 4.3.2 installed via guix, I tried to install RcppArmadillo. install.packages() does not find it:

Warning message: package 'RccpArmadillo' is not available for this version of R

so I downloaded RcppArmadillo_0.12.8.0.0.tar.gz from CRAN, and tried install.packages("RcppArmadillo_0.12.8.0.0.tar.gz", repos=NULL). I got errors. Here the end of the messages:

/gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16/bin/bash: warning: setlocale: LC_ALL: cannot change locale (fr_FR.UTF-8) In file included from ~/.guix-profile/include/c++/bits/move.h:57, from ~/.guix-profile/include/c++/bits/stl_pair.h:59, from ~/.guix-profile/include/c++/bits/stl_algobase.h:64, from ~/.guix-profile/include/c++/bits/specfun.h:45, from ~/.guix-profile/include/c++/cmath:1935, from /gnu/store/7mc11w8di7wadsb15bkmxyn04miqmrqb-profile/site-library/Rcpp/include/Rcpp/platform/compiler.h:100, from /gnu/store/7mc11w8di7wadsb15bkmxyn04miqmrqb-profile/site-library/Rcpp/include/Rcpp/r/headers.h:62, from /gnu/store/7mc11w8di7wadsb15bkmxyn04miqmrqb-profile/site-library/Rcpp/include/RcppCommon.h:30, from ../inst/include/RcppArmadillo/interface/RcppArmadilloForward.h:25, from ../inst/include/RcppArmadillo.h:29, from RcppArmadillo.cpp:21: ~/.guix-profile/include/c++/type_traits:732:26: error: expected identifier before '(' token 732 | _GLIBCXX20_DEPRECATED("use is_standard_layout && is_trivial instead") | ^ ~/.guix-profile/include/c++/type_traits:732:27: error: expected unqualified-id before string constant 732 | _GLIBCXX20_DEPRECATED("use is_standard_layout && is_trivial instead") | ^~~~~~~~~~ ~/.guix-profile/include/c++/type_traits:732:27: error: expected ')' before string constant 732 | _GLIBCXX20_DEPRECATED("use is_standard_layout && is_trivial instead") | ~^~~~~~~~~~ | ) ~/.guix-profile/include/c++/type_traits:1497:12: error: expected identifier before 'is_nothrow_convertible' 1497 | struct is_nothrow_convertible | ^~~~~~~~ ~/.guix-profile/include/c++/type_traits:1497:12: error: expected unqualified-id before 'is_nothrow_convertible' ~/.guix-profile/include/c++/type_traits:3058:66: error: template argument 2 is invalid 3058 | is_nothrow_convertible<typename _Result::type, _Ret>> | ^~ ~/.guix-profile/include/c++/type_traits:3153:25: error: expected unqualified-id before string constant 3153 | _GLIBCXX20_DEPRECATED("use is_standard_layout_v && is_trivial_v instead") | ^~~~~~~~~~~~~~ ~/.guix-profile/include/c++/type_traits:3153:25: error: expected ')' before string constant 3153 | _GLIBCXX20_DEPRECATED("use is_standard_layout_v && is_trivial_v instead") | ~^~~~~~~~~~~~~~ | ) In file included from ~/.guix-profile/include/c++/bits/locale_conv.h:41, from ~/.guix-profile/include/c++/locale:43, from ~/.guix-profile/include/c++/iomanip:43, from /gnu/store/7mc11w8di7wadsb15bkmxyn04miqmrqb-profile/site-library/Rcpp/include/RcppCommon.h:53: ~/.guix-profile/include/c++/bits/unique_ptr.h:486:15: error: expected identifier before 'remove_cv' 486 | using remove_cv = typename remove_cv<_Up>::type; | ^~~ ~/.guix-profile/include/c++/bits/unique_ptr.h:486:27: error: expected '(' before '=' token 486 | using remove_cv = typename remove_cv<_Up>::type; | ^ | ( ~/.guix-profile/include/c++/bits/unique_ptr.h:486:27: error: expected type-specifier before '=' token ~/.guix-profile/include/c++/bits/unique_ptr.h:486:27: error: expected unqualified-id before '=' token ~/.guix-profile/include/c++/bits/unique_ptr.h:492:69: error: wrong number of template arguments (1, should be 2) 492 | not_<is_same<remove_cv<_Tp>, remove_cv<_Up>>> >; | ^~ ~/.guix-profile/include/c++/type_traits:614:12: note: provided for 'template<class, class> struct std::is_same' 614 | struct is_same; | ^~~ ~/.guix-profile/include/c++/bits/unique_ptr.h:492:71: error: template argument 1 is invalid 492 | not_<is_same<remove_cv<_Tp>, __remove_cv<_Up>>> >; | ^ ~/.guix-profile/include/c++/bits/unique_ptr.h:492:73: error: template argument 2 is invalid 492 | not_<is_same<remove_cv<_Tp>, __remove_cv<_Up>>> >; | ^ /gnu/store/mad9hccdj4xajpw2kkf96kc7vidh3bdn-r-minimal-4.3.2/lib/R/etc/Makeconf:200 : la recette pour la cible « RcppArmadillo.o » a échouée make: *** [RcppArmadillo.o] Erreur 1 ERROR: compilation failed for package 'RcppArmadillo'

  • removing '~/R/x86_64-unknown-linux-gnu-library/4.3/RcppArmadillo' sh: warning: setlocale: LC_ALL: cannot change locale (fr_FR.UTF-8) Warning message: In install.packages("RcppArmadillo_0.12.8.0.0.tar.gz", repos = NULL) : installation of package 'RcppArmadillo_0.12.8.0.0.tar.gz' had non-zero exit status
eddelbuettel commented 9 months ago

I cannot help you with guix or nix, try their respective communities.

RcppArmadillo was updated this morning, so you may have a temporary mirror synchronization hole. It is however on CRAN; I happen to also be its Debian maintainer and have updated the package via a download from CRAN source (to, of course, the same machine where I originally wrote RcppArmadillo ...) so there is no issue.

eddelbuettel commented 9 months ago

For added colour:

edd@rob:/tmp$ rm -f RcppArmadillo_0.12.8.0.0.tar.gz 
edd@rob:/tmp$ wget -q https://cloud.r-project.org/src/contrib/RcppArmadillo_0.12.8.0.0.tar.gz
edd@rob:/tmp$ ls -l RcppArmadillo_0.12.8.0.0.tar.gz 
-rw-rw-r-- 1 edd edd 1405254 Feb  8 08:40 RcppArmadillo_0.12.8.0.0.tar.gz
edd@rob:/tmp$ md5sum RcppArmadillo_0.12.8.0.0.tar.gz 
e53d861655e764df0f7d6ea8f965a9c7  RcppArmadillo_0.12.8.0.0.tar.gz
edd@rob:/tmp$ 

The cloud.r-p.o address is a globally mirrored content delivery network which will in general provide you with the fastest (most local) download. You can of course also hit the main server in Vienna.

eddelbuettel commented 9 months ago

If your compiler throws up, a) tell me compiler your used (g++ --version or clang++ --version helps) and make sure you have a recent one. As I just update the package at CRAN we have a pretty view of where it builds. This is currently still a mix of the previous and current version:

image

It will update to 0.12.8.0.0 in the next few days. That version, like all the previous ones, passed the CRAN incoming on normal current systems. I think any C++11 capable compiler should do.

dbontemps commented 9 months ago

Thanks for your answer. First, I am on a server of my university, possibly a "stable" debian, so I have to use guix to install up-to-date software in my home directory. Anyway, g++ (gcc) 13.2.0 and clang 3.8.1-24. In the meantime, the R command guix.install("RcppArmadillo") worked, but I had the same errors from RcppArmadillo at the compilation of my own package. I removed the CRAN version and tried the one you suggested (RcppArmadillo_0.12.8.0.0.tar.gz, possibly the same one as CRAN), and I got again the same compilations errors.

eddelbuettel commented 9 months ago

I am not a guix user so I cannot help you with that. The 'outer server without admin rights' issue is a real problem that is hard to circumvent. (Rcpp)Armadillo is not that demanding (other packages need C++14, C++17, even C++20) so maybe you can work with your admins.

And/or maybe you can work with Docker, or the root-less podman?

Anyway, there is no issue with RcppArmadillo here, and while I sympathise with your issue ("been there...") there is not much I can do for you here.

dbontemps commented 9 months ago

PS: I have no objection to install the previous 0.12.6.6.1 version listed above, but I have to confess I do not know how to.

eddelbuettel commented 9 months ago

There is relatively little change between them. From your logs, I suspect R setup issues under guix. R needs consistent compiler info to pass it on. Maybe the guix folks can help you. If they have an update RcppArmadillo for you then some things clearly work. Good luck.

(The narrow answer to 'how do I install older version' is to download its source tarball and point R CMD INSTALL (or the equivalent command from inside R) at it.)

Good luck.

dbontemps commented 9 months ago

OK. Anyway, the previous version has indeed the same problem on my system. I will wait a bit and maybe the command install.packages("RcppArmadillo") will just work. If not, I go and ask to guix people! Thanks again.

eddelbuettel commented 9 months ago

What error exactly are you having? I move some headers around after careful testing of over 1100 packages on CRAN using RcppArmadillo were not affected. Yours could be different -- it is a low-probabilty chance but not impossible. In that case 0.12.6.6.1 may help.

But what you showed above are compiler setup errors, not a missing / not found header...

dbontemps commented 9 months ago

I do not known how to understand the error messages, but all have at their core the following, with the parenthesis colored.

In file included from ~/.guix-profile/include/c++/bits/move.h:57, (...) ~/.guix-profile/include/c++/type_traits:732:26: error: expected identifier before '(' token 732 | _GLIBCXX20_DEPRECATED("use is_standard_layout && is_trivial instead") | ^ ~/.guix-profile/include/c++/type_traits:732:27: error: expected unqualified-id before string constant

Anyway, the administrator of the server is quite sensible and responsive, so my first step will be to ask for a more recent R (>=4.1.0) in the system itself, forget guix, and install RcppArmadillo and my other dependencies inside R with install.packages(). Ubuntu 22.04 and probably debian testing have R 4.1.0 so it should be easier. Hopefully, I will also get Rstudio :-)

eddelbuettel commented 9 months ago

Good approach.

For Ubuntu 22.04 also see https://eddelbuettel.github.io/r2u which is great: All 22400 CRAN packages as binaries with full dependencies. Also 400 BioC packages. As I sometimes quip: "#r2u. Fast. Easy. Reliable. Pick all three."

dbontemps commented 9 months ago

Hi,

For information, the problem was indeed from guix. The administrator of the server found the solution on https://issues.guix.gnu.org/ I had to run unset CPLUS_INCLUDE_PATH in bash before loading R.

eddelbuettel commented 9 months ago

Perfect -- and thanks for reporting back. You may need that for other package compilations for R too.

dbontemps commented 9 months ago

I put it in my .profile :-)

Le sam. 10 févr. 2024, 16:07, Dirk Eddelbuettel @.***> a écrit :

Perfect -- and thanks for reporting back. You may need that for other package compilations for R too.

— Reply to this email directly, view it on GitHub https://github.com/RcppCore/RcppArmadillo/issues/434#issuecomment-1937037395, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJKYGHDMCJFRP4DV3WRVXLTYS6ELFAVCNFSM6AAAAABDAAO5IOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZXGAZTOMZZGU . You are receiving this because you authored the thread.Message ID: @.***>