Armadillo version selections in 15.0.1 and later
eddelbuettel opened this issue · comments
Armadillo upstream is now at version 15.0.1. With version 15.0.0 came two important changes:
- the minimum C++ compilation standard is now C++14
- a deprecation warning override that was active until version 14.6.3 has been removed
The first of these is a (currently) unacceptable issue as over 200 CRAN packages using RcppArmadillo use C++11 and would fail to build. The second is also problematic: deprecated code leads to a WARNING at CRAN which means the package may not get accepted at the next upload.
Now, to be perfectly plain, upstream is of course entirely in its right to pick minimum warnings and deprecation styles. At the same time, having been entrusted by over 1200 packages results in some responsibility for a managing transitions and changes. We have therefore decided to alter the package by a) also including version 14.6.3 as a fallback for either (or both) allowing C++11 or suppressing deprecation as we have until 14.6.3.
We have added logic (in a new header inst/include/RcppArmadillo/version/arma.h) that respects choices for explicitly choosing either the 'legacy' version 14.6.3 or the 'current' version (right now 15.0.1). When C++11 is detected, 'legacy' is used---however we also recommend moving on to C++14 or later which is automagic 1 once one removes the explicit selection enforcing C++11 2. We also added some sanity checks.
This currently falls back to 'legacy' unless the package author makes a selection. We signal this with a compilation message. At some point when enough packages have adapted we plan to default to 'current'. At that point those who have not converted will likely get a WARNING from CRAN. In the meantime, while version 14.6.3 is provided as a fallback, it can also be selected explicitly via -DARMA_USE_LEGACY. This will suppress deprecation warnings in the same way previous releases did.
So what is needed now from the side of the package author is an explicit selection of the 'current' version (until this becomes the default) via the define -DARMA_USE_CURRENT, possibly coupled with a removal of the C++11 standard selection. This may trigger deprecation warnings, this depends on whether such code is used in the package.
This may of course also require addressing 'deprecation' warning if any are shown. We plan to help on this front with PRs and/or examples. The very simplest is to remove arma::is_finite() with std::isfinite(). 3 We are creating sub-issues describing / illustrating package changes starting with the simplest case in #476. We also provide a simple drop-in function armadilloVersion which can be used to access and verify the underlying Armadillo version. 4
This is issue should be considered a 'live document' which we plan to edit going forward (as opposed to a fixed-per-release-at-least vignette).
Edit 2025-09-19: As of RcppArmadillo 15.0.2-2 the switch to Armadillo 15.0.2 is automatic unless C++11 is used 5 you no longer have to add -DARMA_USE_CURRENT. You may of course still use it, but it is no longer needed as it was during the very first phase of this transition.
Footnotes
-
See Writing R Extensions for which compilation standard is selected under which R version. It has been C++17 (given a suitable compiler) for the last few years. ↩ ↩2
-
There was of course a time and a place when this was the right choice: A decade+ ago when we all happily opted into more modern C++ via C++11. Now it is 2025 and C++11 is becoming legacy so let us remove the now-dated enforcement of it as a style. Also see 1. ↩
-
Yes, that could have been handled automagically in a header but upstream decided to warn. Such is life. ↩
-
In package RcppDE the function is not exported as has to be called with the three-colon form
:::. If yourNAMESPACEexports all public symbols you may have to add a quick Rd file or roxygen2 header. ↩ -
Of course, C++11 should no longer be used so the first step is to remove that declaration. ↩
R-devel now has an optional check for our fallback message, see this commit r-devel/r-svn@6c47998. We plan to rely on this to identify authors who have yet to transition to (preferably) Armadillo 15.0.* or have (for whatever reason) opted into legacy version Armadillo 14.6.3.
As an FYI, Armadillo upstream updated to 15.0.2 (adding OpenMP support for fp16 which few cpus supports, plus an enhancement for arma::cube; neither one is likely to be of great importance in use from R) and is at the basis of the update package RcppArmadillo 15.0.2-1 which contains two important corrections over 15.0.1-1 from last week. This version should serve us well for the next little while. (It also tickled a 'seven uploads in six months' note so slowing down CRAN uploads is on the agenda too.)
Following discussions with CRAN, the new version RcppArmadillo 15.0.2-2, which arrived at CRAN today, now defaults to the current Armadillo --- unless either -DARMA_USE_LEGACY is set, or C++11 is selected.
CRAN will contact maintainers for either of two desired changes
- moving away from C++11 (as they have been nudging already)
- correcting deprecation warnings now arising with Armadillo 15.0.x
I wrote a little bit more about this on the release blog post and will detail next steps here too.