Reputation: 1
I'm trying to create R package from cpp code using RCPP package but i found the error below. I'm using macOS sierra, Rstudio, R on latest version.
I did steps as following....
1.using Rcpp.package.skeleton("mypackage") but the Makevars or Makevars.win was not generated.
2.run compileAttributes to generates RcppExport.cpp
3.run sourceCpp(rcpp_script.cpp) and then error dyn.load as below.
Error in dyn.load("/private/var/folders/p4/hx950qdj5hb8zrvzc74_rpr40000gn/T/RtmpX9AU6m/sourceCpp-x86_64-apple-darwin15.6.0-0.12.11/sourcecpp_11cc996e86d/sourceCpp_93.so") :
unable to load shared object '/private/var/folders/p4/hx950qdj5hb8zrvzc74_rpr40000gn/T/RtmpX9AU6m/sourceCpp-x86_64-apple-darwin15.6.0-0.12.11/sourcecpp_11cc996e86d/sourceCpp_93.so':
dlopen(/private/var/folders/p4/hx950qdj5hb8zrvzc74_rpr40000gn/T/RtmpX9AU6m/sourceCpp-x86_64-apple-darwin15.6.0-0.12.11/sourcecpp_11cc996e86d/sourceCpp_93.so, 6): Symbol not found: __ZN23stream_clustering_class3nanER11data_readerRK13config_reader
Referenced from: /private/var/folders/p4/hx950qdj5hb8zrvzc74_rpr40000gn/T/RtmpX9AU6m/sourceCpp-x86_64-apple-darwin15.6.0-0.12.11/sourcecpp_11cc996e86d/sourceCpp_93.so
Expected in: flat namespace
in /private/var/folders/p4/hx950qdj5hb8zrvzc74_rpr40000gn/T/RtmpX9AU6m/sourceCpp-x86_64-apple-darwin15.6.0-0.12.11/sourcecpp_11cc996e86d/sourceCpp_93.so
After find out about this error and i've found many suggestions with Makevars file. Can i create this file by myself?
Any suggestions would be appreciated. Thank you in advanced.
Upvotes: 0
Views: 440
Reputation: 368389
Your question, even after editing, is a little hard to make sense of.
Your linking error indicates that you reference an external function you are not supplying in code or linking instructions. Such code is no longer the simplest possible use case for Rcpp, but rather more advanced.
But we have a entire vignette about this: Rcpp-package. Have a look at it, it should answer your questions.
For better questions on StackOverflow, please see How to make a great R reproducible example.
Upvotes: 1