Bug 16697 - NA/NaN/Inf in foreign function call
Summary: NA/NaN/Inf in foreign function call
Alias: None
Product: R
Classification: Unclassified
Component: Installation (show other bugs)
Version: R 3.2.3
Hardware: Other Linux
: P5 normal
Assignee: R-core
Depends on:
Reported: 2016-02-03 23:02 UTC by Andreas
Modified: 2016-02-05 19:57 UTC (History)
1 user (show)

See Also:

error trace (43.82 KB, text/plain)
2016-02-03 23:02 UTC, Andreas

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas 2016-02-03 23:02:28 UTC
Created attachment 2014 [details]
error trace

When building R-3.2.3 for the Guix GNU/Linux distribution on the armhf platform, the test phase currently fails with the following message:

Testing examples for package ?stats?
Error: testing 'stats' failed
Execution halted

see http://hydra.gnu.org/build/966395/log/raw
I am attaching the file
that apparently shows the error at the end:
> print(getInitial(rate ~ SSmicmen(conc, Vm, K), data = PurTrt), digits = 3)
Error in qr.qy(QR.rhs, cc) : NA/NaN/Inf in foreign function call (arg 5)
Calls: print ... <Anonymous> -> as.vector -> coef -> nls -> <Anonymous> -> qr.qy
Execution halted

I will be happy to provide further information if needed.
Comment 1 Peter Dalgaard 2016-02-05 00:42:05 UTC
This is obviously platform specific and the bug repository may not be the best way to communicate on this. Perhaps the r-devel list is more practicable.

Anyways, I'd try a little bisection first: At the point of failure, you obviously have a functioning R which can load the stats package. However, when running the file of all examples, it dies in the SSmicmen example. This raises the question whether it also fails in a plain example(SSmicmen) or even in a reduced version of it. If it does, it would be a fairly obvious idea to run the offending command under debug(). Specifically

debug(attr(SSmicmen, "initial"))
SSmcmn> print(getInitial(rate ~ SSmicmen(conc, Vm, K), data = PurTrt), digits = 3)
debugging in: (attr(object, "initial"))(mCall = mCall, data = data, LHS = LHS)
debug: {
debug: xy <- data.frame(sortedXyData(mCall[["input"]], LHS, data))
debug: if (nrow(xy) < 3) {
    stop("too few distinct input values to fit a Michaelis-Menten model")
debug: pars <- as.vector(coef(lm(1/y ~ I(1/x), data = xy)))
debug: pars <- as.vector(coef(nls(y ~ x/(K + x), data = xy, start = list(K = abs(pars[2L]/pars[1L])), 
    algorithm = "plinear")))

This is the point where your code breaks, so you might want to check that the starting value is sane. I have

Browse[2]> pars
[1] 0.0052120384 0.0002273837

also check values of xy$y and xy$x. If they all look sane, the issue is likely internal to nls(), which you can debug, etc.

A different avenue: You seem to be configuring with --with-blas=openblas". Try not doing that.
Comment 2 Andreas 2016-02-05 19:57:35 UTC
Thanks a lot for your comment! I tried to compile without openblas, and it now succeeds on armhf. It looks like this is a bug of openblas rather than r, so it can probably be closed here.