CRAN NOTE for package using Stan (suggest C++17)

Hi all,

I am preparing to submit a new version of my rater package to CRAN.

I’ve run into the new C++14 note and have tried to fix it using the approaches described in this thread (i.e. here)

However, I’m still getting the note in my GHA checks.

I’m out of ideas as to why the check still thinks I am specifying C++14 - any ideas or assistance greatly appreciated!

Jeffrey

@andrjohns @jonah

You also need in src/Makevars this:

PKG_CPPFLAGS += -D_HAS_AUTO_PTR_ETC=0

also make sure to have C++17 in the SystemRequirements.

1 Like

@andrjohns now that Ben reviewed and merged your PRs is there anything else you wanted to get in to the rstantools update or should I go ahead and prepare the CRAN submission?

1 Like

Actually we’re getting some GHA failures:

so we’ll have to sort that out before submitting. While we’re dealing with that I’ll run all the other checks that CRAN wants (e.g., checking on winbuilder) and get everything ready to submit as soon as we’re set.

1 Like

That error is safe to ignore for now, it’s occurring because stanc3 is emitting size without the math:: namespace qualifier - which is only an issue for the rstan 2.26 and StanHeaders 2.26 combination. I’ll open a PR to backport the stanc3 fixes to rstan 2.26, so user’s development workflows shouldn’t break

That’s also all the changes from me, thanks!

EDIT: rstan PR opened

3 Likes

Actually, there’s one more minor patch needed for the stanfunctions support that I’ve just identified while testing the patch mentioned above, will open in just a tick

EDIT: @jonah rstantools PR opened here. The GHA will still fail for 2.26 until the above rstan PR is merged and new binaries released

EDIT 2: New binaries released and GHA checks passing now

3 Likes

Thanks @andrjohns! I’m going to try to submit to CRAN later today.

I just submitted the rstantools update to CRAN. I’ll give another update here when it has been accepted. Thanks everyone for your patience and help getting this sorted out!

5 Likes

Brilliant! Thanks so much for your work on this @jonah and @andrjohns!

rstantools v2.3.0 is now on CRAN (probably the shortest submission to acceptance wait I’ve ever had):

It will probably be a few days until binaries are available but installing from source should work already.

4 Likes

Mostly @andrjohns!

4 Likes

Very happy to report that the new version of my package rater was swiftly accepted onto CRAN.

3 Likes

c++17 is still not expected to work with rstan 2.26, right? when I test this compilation just seems to get stuck…

Which 2.26.x version are you on? The latest is 2.26.17, and has been fine with all C++17 so far

2.26.17. I’ll check on m windows box when I can to see if it’s a package issue or some machine specific issue on my ubuntu box…

I can build and install ctsem’s master branch with 2.26.17 and specifying CXX_STD = CXX17 in the Makevars on MacOS

1 Like

thanks for checking, yes it’s working on windows too, on ubuntu it’s just stuck forever at

/home/dricha/R/x86_64-pc-linux-gnu-library/4.2/BH/include/boost/get_pointer.hpp: At global scope:
/home/dricha/R/x86_64-pc-linux-gnu-library/4.2/BH/include/boost/get_pointer.hpp:48:40: warning: ‘template<class> class std::auto_ptr’ is deprecated [-Wdeprecated-declarations]
   48 | template<class T> T * get_pointer(std::auto_ptr<T> const& p)
      |                                        ^~~~~~~~
In file included from /usr/include/c++/9/bits/locale_conv.h:41,
                 from /usr/include/c++/9/locale:43,
                 from /usr/include/c++/9/iomanip:43,
                 from /home/dricha/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include/RcppCommon.h:53,
                 from /home/dricha/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include/Rcpp.h:27,
                 from stan_files/ctsmgen.cc:1:
/usr/include/c++/9/bits/unique_ptr.h:53:28: note: declared here
   53 |   template<typename> class auto_ptr;
      |        

not really sure how to diagnose this one…

You’re missing a Makevars flag: -D_HAS_AUTO_PTR_ETC=0

Things like this are why I’d recommend using rstantoolsif you can

I’ve added that in already, doesn’t help, but I am going to see how it goes with rstantools again – I think CRAN has stopped checking on win32 completely which should make it viable without all my workarounds now…

I think my ubuntu test box was hitting some kind of compiler time out yesterday. confirming now that building ctsem with cpp17 works across platforms with both rstan 2.21 and 2.26. Thanks.

1 Like