Last updated on 2024-12-22 05:49:19 CET.
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
---|---|---|---|---|---|---|
r-devel-linux-x86_64-debian-clang | 0.3.20 | 2.56 | 47.80 | 50.36 | OK | |
r-devel-linux-x86_64-debian-gcc | 0.3.20 | 1.99 | 33.21 | 35.20 | OK | |
r-devel-linux-x86_64-fedora-clang | 0.3.20 | 78.40 | OK | |||
r-devel-linux-x86_64-fedora-gcc | 0.3.20 | 77.20 | OK | |||
r-devel-windows-x86_64 | 0.3.20 | 3.00 | 106.00 | 109.00 | OK | |
r-patched-linux-x86_64 | 0.3.20 | 2.18 | 41.14 | 43.32 | ERROR | |
r-release-linux-x86_64 | 0.3.20 | 2.31 | 42.23 | 44.54 | OK | |
r-release-macos-arm64 | 0.3.20 | 45.00 | OK | |||
r-release-macos-x86_64 | 0.3.20 | 76.00 | OK | |||
r-release-windows-x86_64 | 0.3.20 | 5.00 | 130.00 | 135.00 | OK | |
r-oldrel-macos-arm64 | 0.3.20 | 45.00 | OK | |||
r-oldrel-macos-x86_64 | 0.3.20 | 79.00 | OK | |||
r-oldrel-windows-x86_64 | 0.3.20 | 6.00 | 99.00 | 105.00 | OK |
Version: 0.3.20
Check: examples
Result: ERROR
Running examples in ‘inline-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: cfunction
> ### Title: Inline C, C++, Fortran function calls from R
> ### Aliases: cfunction setCMethod
> ### Keywords: file
>
> ### ** Examples
>
>
> x <- as.numeric(1:10)
> n <- as.integer(10)
>
> ## Not run:
> ##D ## A simple Fortran example - n and x: assumed-size vector
> ##D code <- "
> ##D integer i
> ##D do 1 i=1, n(1)
> ##D 1 x(i) = x(i)**3
> ##D "
> ##D cubefn <- cfunction(signature(n="integer", x="numeric"), code, convention=".Fortran")
> ##D print(cubefn)
> ##D
> ##D cubefn(n, x)$x
> ##D
> ##D ## Same Fortran example - now n is one number
> ##D code2 <- "
> ##D integer i
> ##D do 1 i=1, n
> ##D 1 x(i) = x(i)**3
> ##D "
> ##D cubefn2 <- cfunction(signature(n="integer", x="numeric"), implicit = "none",
> ##D dim = c("", "(*)"), code2, convention=".Fortran")
> ##D
> ##D cubefn2(n, x)$x
> ##D
> ##D ## Same in F95, now x is fixed-size vector (length = n)
> ##D code3 <- "x = x*x*x"
> ##D cubefn3 <- cfunction(sig = signature(n="integer", x="numeric"), implicit = "none",
> ##D dim = c("", "(n)"), code3, language="F95")
> ##D cubefn3(20, 1:20)
> ##D print(cubefn3)
> ##D
> ##D ## Same example in C
> ##D code4 <- "
> ##D int i;
> ##D for (i = 0; i < *n; i++)
> ##D x[i] = x[i]*x[i]*x[i];
> ##D "
> ##D cubefn4 <- cfunction(signature(n="integer", x="numeric"), code4, language = "C", convention = ".C")
> ##D cubefn4(20, 1:20)
> ##D
> ##D ## Give the function in the source code a name
> ##D cubefn5 <- cfunction(signature(n="integer", x="numeric"), code4, language = "C", convention = ".C",
> ##D name = "cubefn")
> ##D code(cubefn5)
> ## End(Not run)
>
> ## use of a module in F95
> modct <- "module modcts
+ double precision, parameter :: pi = 3.14159265358979
+ double precision, parameter :: e = 2.71828182845905
+ end"
>
> getconstants <- "x(1) = pi
+ x(2) = e"
>
> cgetcts <- cfunction(getconstants, module = "modcts", implicit = "none",
+ includes = modct, sig = c(x = "double"), dim = c("(2)"), language = "F95")
>
> cgetcts(x = 1:2)
$x
[1] 3.141593 2.718282
> print(cgetcts)
An object of class 'CFunc'
function (x)
.Primitive(".Fortran")(<pointer: 0x7f06d6d48100>, x = as.double(x))
<environment: 0x564231f491f8>
code:
1: module modcts
2: double precision, parameter :: pi = 3.14159265358979
3: double precision, parameter :: e = 2.71828182845905
4: end
5: SUBROUTINE file22b9751e5eec40 ( x )
6: USE modcts
7: IMPLICIT none
8: DOUBLE PRECISION x(2)
9: x(1) = pi
10: x(2) = e
11: RETURN
12: END
13:
>
> ## Use of .C convention with C code
> ## Defining two functions, one of which calls the other
> sigSq <- signature(n="integer", x="numeric")
> codeSq <- "
+ for (int i=0; i < *n; i++) {
+ x[i] = x[i]*x[i];
+ }"
> sigQd <- signature(n="integer", x="numeric")
> codeQd <- "
+ squarefn(n, x);
+ squarefn(n, x);
+ "
>
> fns <- cfunction( list(squarefn=sigSq, quadfn=sigQd),
+ list(codeSq, codeQd),
+ convention=".C")
>
> squarefn <- fns[["squarefn"]]
> quadfn <- fns[["quadfn"]]
>
> squarefn(n, x)$x
[1] 1 4 9 16 25 36 49 64 81 100
> quadfn(n, x)$x
[1] 1 16 81 256 625 1296 2401 4096 6561 10000
>
> ## Alternative declaration using 'setCMethod'
> setCMethod(c("squarefn", "quadfn"), list(sigSq, sigQd),
+ list(codeSq, codeQd), convention=".C")
>
> squarefn(n, x)$x
[1] 1 4 9 16 25 36 49 64 81 100
> quadfn(n, x)$x
[1] 1 16 81 256 625 1296 2401 4096 6561 10000
>
> ## Use of .Call convention with C code
> ## Multyplying each image in a stack with a 2D Gaussian at a given position
> code <- "
+ SEXP res;
+ int nprotect = 0, nx, ny, nz, x, y;
+ PROTECT(res = Rf_duplicate(a)); nprotect++;
+ nx = INTEGER(GET_DIM(a))[0];
+ ny = INTEGER(GET_DIM(a))[1];
+ nz = INTEGER(GET_DIM(a))[2];
+ double sigma2 = REAL(s)[0] * REAL(s)[0], d2 ;
+ double cx = REAL(centre)[0], cy = REAL(centre)[1], *data, *rdata;
+ for (int im = 0; im < nz; im++) {
+ data = &(REAL(a)[im*nx*ny]); rdata = &(REAL(res)[im*nx*ny]);
+ for (x = 0; x < nx; x++)
+ for (y = 0; y < ny; y++) {
+ d2 = (x-cx)*(x-cx) + (y-cy)*(y-cy);
+ rdata[x + y*nx] = data[x + y*nx] * exp(-d2/sigma2);
+ }
+ }
+ UNPROTECT(nprotect);
+ return res;
+ "
> funx <- cfunction(signature(a="array", s="numeric", centre="numeric"), code)
ERROR(s) during compilation: source code errors or compiler configuration errors!
make cmd is
make -f '/home/hornik/tmp/R.check/r-patched-gcc/Work/build/etc/Makeconf' -f '/home/hornik/tmp/R.check/r-patched-gcc/Work/build/share/make/shlib.mk' -f '/home/hornik/.R/Makevars-gcc' SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB='file22b9752e0d99da.so' CXX_DEFS=-DR_NO_REMAP OBJECTS='file22b9752e0d99da.o'
make would use
make[1]: Entering directory '/home/hornik/tmp/scratch/RtmpZ4r1jj'
g++-14 -std=gnu++17 -I"/home/hornik/tmp/R.check/r-patched-gcc/Work/build/include" -DNDEBUG -I/usr/local/include -D_FORTIFY_SOURCE=3 -fpic -g -O2 -Wall -pedantic -mtune=native -DR_NO_REMAP -c file22b9752e0d99da.cpp -o file22b9752e0d99da.o
if test "zfile22b9752e0d99da.o" != "z"; then \
echo g++-14 -std=gnu++17 -shared -L"/home/hornik/tmp/R.check/r-patched-gcc/Work/build/lib" -Wl,-O1 -o file22b9752e0d99da.so file22b9752e0d99da.o -L"/home/hornik/tmp/R.check/r-patched-gcc/Work/build/lib" -lR; \
g++-14 -std=gnu++17 -shared -L"/home/hornik/tmp/R.check/r-patched-gcc/Work/build/lib" -Wl,-O1 -o file22b9752e0d99da.so file22b9752e0d99da.o -L"/home/hornik/tmp/R.check/r-patched-gcc/Work/build/lib" -lR; \
fi
make[1]: Leaving directory '/home/hornik/tmp/scratch/RtmpZ4r1jj'
Program source:
1: #include <R.h>
2: #include <Rdefines.h>
3: #include <R_ext/Error.h>
4:
5:
6: extern "C" {
7: SEXP file22b9752e0d99da ( SEXP a, SEXP s, SEXP centre );
8: }
9:
10: SEXP file22b9752e0d99da ( SEXP a, SEXP s, SEXP centre ) {
11:
12: SEXP res;
13: int nprotect = 0, nx, ny, nz, x, y;
14: PROTECT(res = Rf_duplicate(a)); nprotect++;
15: nx = INTEGER(GET_DIM(a))[0];
16: ny = INTEGER(GET_DIM(a))[1];
17: nz = INTEGER(GET_DIM(a))[2];
18: double sigma2 = REAL(s)[0] * REAL(s)[0], d2 ;
19: double cx = REAL(centre)[0], cy = REAL(centre)[1], *data, *rdata;
20: for (int im = 0; im < nz; im++) {
21: data = &(REAL(a)[im*nx*ny]); rdata = &(REAL(res)[im*nx*ny]);
22: for (x = 0; x < nx; x++)
23: for (y = 0; y < ny; y++) {
24: d2 = (x-cx)*(x-cx) + (y-cy)*(y-cy);
25: rdata[x + y*nx] = data[x + y*nx] * exp(-d2/sigma2);
26: }
27: }
28: UNPROTECT(nprotect);
29: return res;
30:
31: warning("your C program does not return anything!");
32: return R_NilValue;
33: }
Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language, verbose) :
using C++ compiler: ‘g++-14 (Debian 14.2.0-8) 14.2.0’
file22b9752e0d99da.cpp: In function ‘SEXPREC* file22b9752e0d99da(SEXP, SEXP, SEXP)’:
file22b9752e0d99da.cpp:31:3: error: ‘warning’ was not declared in this scope; did you mean ‘Rf_warning’?
31 | warning("your C program does not return anything!");
| ^~~~~~~
| Rf_warning
make[1]: *** [/home/hornik/tmp/R.check/r-patched-gcc/Work/build/etc/Makeconf:202: file22b9752e0d99da.o] Error 1
Calls: cfunction -> compileCode
Execution halted
Flavor: r-patched-linux-x86_64