- using R version 4.4.2 Patched (2024-12-26 r87469)
- using platform: x86_64-pc-linux-gnu
- R was compiled by
gcc-14 (Debian 14.2.0-8) 14.2.0
GNU Fortran (Debian 14.2.0-8) 14.2.0
- running under: Debian GNU/Linux trixie/sid
- using session charset: UTF-8
- checking for file ‘inline/DESCRIPTION’ ... OK
- this is package ‘inline’ version ‘0.3.20’
- checking package namespace information ... OK
- checking package dependencies ... OK
- checking if this is a source package ... OK
- checking if there is a namespace ... OK
- checking for executable files ... OK
- checking for hidden files and directories ... OK
- checking for portable file names ... OK
- checking for sufficient/correct file permissions ... OK
- checking serialization versions ... OK
- checking whether package ‘inline’ can be installed ... OK
See the install log for details.
- checking package directory ... OK
- checking for future file timestamps ... OK
- checking DESCRIPTION meta-information ... OK
- checking top-level files ... OK
- checking for left-over files ... OK
- checking index information ... OK
- checking package subdirectories ... OK
- checking code files for non-ASCII characters ... OK
- checking R files for syntax errors ... OK
- checking whether the package can be loaded ... [0s/0s] OK
- checking whether the package can be loaded with stated dependencies ... [0s/0s] OK
- checking whether the package can be unloaded cleanly ... [0s/0s] OK
- checking whether the namespace can be loaded with stated dependencies ... [0s/0s] OK
- checking whether the namespace can be unloaded cleanly ... [0s/0s] OK
- checking loading without being on the library search path ... [0s/0s] OK
- checking use of S3 registration ... OK
- checking dependencies in R code ... OK
- checking S3 generic/method consistency ... OK
- checking replacement functions ... OK
- checking foreign function calls ... OK
- checking R code for possible problems ... [5s/5s] OK
- checking Rd files ... [0s/1s] OK
- checking Rd metadata ... OK
- checking Rd line widths ... OK
- checking Rd cross-references ... OK
- checking for missing documentation entries ... OK
- checking for code/documentation mismatches ... OK
- checking Rd \usage sections ... OK
- checking Rd contents ... OK
- checking for unstated dependencies in examples ... OK
- checking examples ... [3s/5s] 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: 0x7f3857949100>, x = as.double(x))
<environment: 0x55f4b9f1e1c0>
code:
1: module modcts
2: double precision, parameter :: pi = 3.14159265358979
3: double precision, parameter :: e = 2.71828182845905
4: end
5: SUBROUTINE file29f9ca1539ac48 ( 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='file29f9ca6aba583f.so' CXX_DEFS=-DR_NO_REMAP OBJECTS='file29f9ca6aba583f.o'
make would use
make[1]: Entering directory '/home/hornik/tmp/scratch/RtmpsdyU79'
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 file29f9ca6aba583f.cpp -o file29f9ca6aba583f.o
if test "zfile29f9ca6aba583f.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 file29f9ca6aba583f.so file29f9ca6aba583f.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 file29f9ca6aba583f.so file29f9ca6aba583f.o -L"/home/hornik/tmp/R.check/r-patched-gcc/Work/build/lib" -lR; \
fi
make[1]: Leaving directory '/home/hornik/tmp/scratch/RtmpsdyU79'
Program source:
1: #include <R.h>
2: #include <Rdefines.h>
3: #include <R_ext/Error.h>
4:
5:
6: extern "C" {
7: SEXP file29f9ca6aba583f ( SEXP a, SEXP s, SEXP centre );
8: }
9:
10: SEXP file29f9ca6aba583f ( 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’
file29f9ca6aba583f.cpp: In function ‘SEXPREC* file29f9ca6aba583f(SEXP, SEXP, SEXP)’:
file29f9ca6aba583f.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: file29f9ca6aba583f.o] Error 1
Calls: cfunction -> compileCode
Execution halted
- checking for unstated dependencies in ‘tests’ ... OK
- checking tests ... [16s/21s] OK
Running ‘tinytest.R’ [16s/21s]
- checking PDF version of manual ... [4s/7s] OK
- checking HTML version of manual ... [0s/2s] OK
- checking for non-standard things in the check directory ... OK
- DONE
Status: 1 ERROR