Cryptic CRAN check error for solaris - "call of overloaded ‘pow(int, int)’ is ambiguous"

My colleague @dbarneche and I recently submitted our package fishflux to CRAN. Even though it passed all automatic checks at first, there seems to be an error for solaris.
I then received an email asking to fix the issue if we want to keep our package on cran, with the following:

This is covered in the manual 'Writing R Extensions Why did you not use 8.65e-5?

Could anyone please help us decipher the error that seems to be related to stan? You can find the check results here.

I asked the cran team for more information and they responded this:

stanExports_getB0.h:148:50: error: call of overloaded ‘pow(int, int)’ is ambiguous
stan::math::assign(k,(8.62 * pow(10, -(5))));
And then see “Portable C and C++ code” in R-exts …

I am afraid I cannot make any sense of this. Thanks in advance for any help!

1 Like

One additional note on the package is that it seems like it’s not possible to install from CRAN without compilation.

@jonah mentioned it should be possible to install a pre-compiled version via CRAN in another thread:

I am not sure why this isn’t the case for our package. Any thoughts on this?

Hey @nschiett, sorry you’re running into these issues.

@bgoodri Any idea what’s going on here?

Do you mean that when a user does install.packages("fishflux") it starts to compile? As far as I know that should only happen in two situations:

  • the user is running linux (CRAN doesn’t build binaries for linux)
  • you’ve recently submitted a package update to CRAN and binaries haven’t been built yet (it usually takes a few days after getting an update on CRAN for binaries to be built and until then everyone has to install from source)

Is either of those the case here? If not we’ll need to look into that.

(We also just released a new version of rstantools today and will be releasing a new rstan soon, but I don’t think what you’re reporting is related to that.)

2 Likes

You should use 8.65e-5. Anytime you do operations with integers you run into sporadic bugs.

2 Likes

Ah, good point. So @nschiett that’s referring to this line of your Stan code, which is treating 10 and -5 as integers:

real k      = 8.62 * 10^-5; // Boltzmann constant (eV / K)

So you can just do real k = 8.62e-5; (I think the CRAN people made a typo and put 8.65 instead of 8.62 in their comment)

3 Likes

Thank you so much for catching that! I had no idea what he was talking about.

Hi @jonah!
Thanks for your response.

Yes indeed. In the case of Windows, installation now works without compilation. However, on Mac, it starts to compile upon installation.
Looking at the CRAN page it says the following for macOS binaries:

r-release: not available, r-oldrel: fishflux_0.0.1.tgz

When it says “not available”, does that mean it is still building? This may indeed explain why it is building from source from the moment on mac even though it has been 4 days. Otherwise there may be another issue here.

So just to make sure I add the right installation instructions: linux users need a c++ compiler to install the package both via Github and CRAN. Windows and Mac users only need a c++ compiler if they want to install the latest development version from source. Is that correct?

Hmm, I’m not sure if “not available” means it is still building or if there’s a problem (@bgoodri do you know?) , but 4 days is usually enough time.

Checking your CRAN page at CRAN - Package fishflux it does look like it built the Mac binary for the previous R version (r-oldrel) but not for the latest (r-release). I just tried installing your package on a Mac running R 3.6.1 (oldrel) and it didn’t need to compile anything, so I can confirm that the r-oldrel binary for Mac works. As expected based on the “not available” on the CRAN website, my other Mac running R 4.0 needed to install from source.

Checking https://cran.r-project.org/web/checks/check_results_fishflux.html it doesn’t look like it has been checked on Mac with r-release, so that may be why there’s no binary for R >= 4.0. I’m not sure what’s up with that, but I don’t think it’s related to your package containing Stan models. If it hasn’t built in a few more days you might try asking somewhere online that offers general R help (stackoverflow, R mailing list, probably other places). Sorry I can’t be of more help!

Yeah I think that’s right.

If you really do want people to also be able to install binaries from GitHub then there are a few options available, but the simplest is probably to use drat.

2 Likes

Thanks a lot for your answer and for testing the installation from CRAN.
Indeed, it seems like it hasn’t been checked on Mac for r-release.
I’ll follow your advice and check on stackoverflow.

That’s good to know, thanks!

I just checked and it looks like the Mac binary did eventually get built. Is everything working properly now?

1 Like

Indeed, everything is working fine now. Seemed like it just took a long time to build for r-release.
Thanks!

1 Like