[R-pkg-devel] Using Rcpp to set up a package

James Owen Ramsay, Dr. j@me@@r@m@@y @end|ng |rom mcg|||@c@
Tue May 5 21:58:27 CEST 2020


I’m working on max OS-X 10.15.3, using R 4.0.0, and updated Xcode as well as updated tools:

Here’s my setup of a package called Data2LD2. (An update of an existing package Data2LD already on Iran):

code_files = c("~/Documents/R/Data2LDRcpp/R/Atensorfn.R",
              "~/Documents/R/Data2LDRcpp/R/BAtensorfn.R",
              "~/Documents/R/Data2LDRcpp/R/Btensorfn.R",
              "~/Documents/R/Data2LDRcpp/R/checkModel.R",
              "~/Documents/R/Data2LDRcpp/R/Data2LD.opt.R",
              "~/Documents/R/Data2LDRcpp/R/Data2LD.R",
              "~/Documents/R/Data2LDRcpp/R/fun.explinear.R",
              "~/Documents/R/Data2LDRcpp/R/fun.Dexplinear.R",
              "~/Documents/R/Data2LDRcpp/R/getForceterm.R",
              "~/Documents/R/Data2LDRcpp/R/getHomoTerm.R",
              "~/Documents/R/Data2LDRcpp/R/inprod.TPbasis.R",
              "~/Documents/R/Data2LDRcpp/R/make.Fterm.R",
              "~/Documents/R/Data2LDRcpp/R/make.Xterm.R",
              "~/Documents/R/Data2LDRcpp/R/make.Variable.R",
              "~/Documents/R/Data2LDRcpp/R/modelList2Vec.R",
              "~/Documents/R/Data2LDRcpp/R/modelVec2List.R",
              "~/Documents/R/Data2LDRcpp/R/printMatrix.R",
              "~/Documents/R/Data2LDRcpp/R/printModel.R")

cpp_files = c("~/Documents/R/Data2LDRcpp/src/DASarrayFnCpp",
             "~/Documents/R/Data2LDRcpp/src/DBSarrayFnCpp",
             "~/Documents/R/Data2LDRcpp/src/DRarrayFnCpp",
             "~/Documents/R/Data2LDRcpp/src/loopJuanCpp",
             "~/Documents/R/Data2LDRcpp/src/RmatFnCpp",
             "~/Documents/R/Data2LDRcpp/src/SmatFnCpp")

Rcpp.package.skeleton(name="Data2LD2", 
                     code_files=code_files,
                     cpp_files =cpp_files,
                     author="James Ramsay",
                     maintainer="James Ramsay",
                     force=TRUE)

Here’s the bad news from R CMD check:

Error: package or namespace load failed for ‘Data2LD2’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/jimramsay/Documents/R/Data2LD2.Rcheck/00LOCK-Data2LD2/00new/Data2LD2/libs/Data2LD2.so':
 dlopen(/Users/jimramsay/Documents/R/Data2LD2.Rcheck/00LOCK-Data2LD2/00new/Data2LD2/libs/Data2LD2.so, 6): Symbol not found: _DASarrayFnCpp
 Referenced from: /Users/jimramsay/Documents/R/Data2LD2.Rcheck/00LOCK-Data2LD2/00new/Data2LD2/libs/Data2LD2.so
 Expected in: flat namespace
in /Users/jimramsay/Documents/R/Data2LD2.Rcheck/00LOCK-Data2LD2/00new/Data2LD2/libs/Data2LD2.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/jimramsay/Documents/R/Data2LD2.Rcheck/Data2LD2’

I’m getting this failure after many iterations of this setup, this being the simplest and most direct that I know.

Sure would like some help (or some sympathy at least)

Jim Ramsay


More information about the R-package-devel mailing list