Skip to content

Armadillo version selections in 15.0.1 and later #475

@eddelbuettel

Description

@eddelbuettel

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

  1. 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

  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.

  3. Yes, that could have been handled automagically in a header but upstream decided to warn. Such is life.

  4. In package RcppDE the function is not exported as has to be called with the three-colon form :::. If your NAMESPACE exports all public symbols you may have to add a quick Rd file or roxygen2 header.

  5. Of course, C++11 should no longer be used so the first step is to remove that declaration.

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions