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: 0x7f53463ec100>, x = as.double(x))
<environment: 0x56092ab7c8e8>
code:
  1: module modcts
  2: double precision, parameter :: pi = 3.14159265358979
  3: double precision, parameter :: e = 2.71828182845905
  4: end
  5:  SUBROUTINE file3dcc2110177dad ( 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")

ERROR(s) during compilation: source code errors or compiler configuration errors!
make cmd is
  make -f '/home/hornik/tmp/R.check/r-devel-clang/Work/build/etc/Makeconf' -f '/home/hornik/tmp/R.check/r-devel-clang/Work/build/share/make/shlib.mk' -f '/home/hornik/.R/Makevars-clang' SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB='file3dcc212a89ed6f.so' OBJECTS='file3dcc212a89ed6f.o'

make would use
make[1]: Entering directory '/tmp/RtmpvfKdjE'
I"/home/hornik/tmp/R.check/r-devel-clang/Work/build/include" -DNDEBUG   -I/usr/local/include -D_FORTIFY_SOURCE=3   -fpic  -g -O3 -Wall -pedantic -c file3dcc212a89ed6f.cpp -o file3dcc212a89ed6f.o
if test  "zfile3dcc212a89ed6f.o" != "z"; then \
  echo  -shared -L"/home/hornik/tmp/R.check/r-devel-clang/Work/build/lib" -Wl,-O1 -o file3dcc212a89ed6f.so file3dcc212a89ed6f.o   -L"/home/hornik/tmp/R.check/r-devel-clang/Work/build/lib" -lR; \
   -shared -L"/home/hornik/tmp/R.check/r-devel-clang/Work/build/lib" -Wl,-O1 -o file3dcc212a89ed6f.so file3dcc212a89ed6f.o   -L"/home/hornik/tmp/R.check/r-devel-clang/Work/build/lib" -lR; \
fi
make[1]: Leaving directory '/tmp/RtmpvfKdjE'

Program source:
  1: #include <R.h>
  2: 
  3: 
  4: extern "C" {
  5:   void squarefn ( int * n, double * x );
  6: }
  7: 
  8: void squarefn ( int * n, double * x ) {
  9: 
 10:   for (int i=0; i < *n; i++) {
 11:     x[i] = x[i]*x[i];
 12:   }
 13: }
 14: extern "C" {
 15:   void quadfn ( int * n, double * x );
 16: }
 17: 
 18: void quadfn ( int * n, double * x ) {
 19: 
 20:   squarefn(n, x);
 21:   squarefn(n, x);
 22: 
 23: }

Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language, verbose) : 
  /bin/bash: line 1: I/home/hornik/tmp/R.check/r-devel-clang/Work/build/include: No such file or directorymake[1]: [/home/hornik/tmp/R.check/r-devel-clang/Work/build/etc/Makeconf:198: file3dcc212a89ed6f.o] Error 127 (ignored)/bin/bash: line 3: -shared: command not foundmake[1]: *** [/home/hornik/tmp/R.check/r-devel-clang/Work/build/share/make/shlib.mk:10: file3dcc212a89ed6f.so] Error 127
Calls: cfunction -> compileCode
Execution halted