[Rcpp-devel] Couldn't have makevars files

Dirk Eddelbuettel edd at debian.org
Thu Sep 10 19:30:41 CEST 2015


On 10 September 2015 at 09:58, Hmamouche Youssef wrote:
| Hi,
| 
| When I create a Rcpp package with the function Rcpp.package.skeleton,
| I do not have the of the makevars and makevars.win files in src, however, the package work
|  on my computer, but i have a problem when I try to install it on other
|  machines, especially with the using of the C++11, because I must add
|  the variable  "CXX_STD = CXX11" in the Makevars.win file.
|  Here is the execution result:(There is no Makevars files in the execution):
| 
| -------------------------------------------------
| > Rcpp.package.skeleton("newpackage", attributes=TRUE)
|  Creating directories ...
|  Creating DESCRIPTION ...
|  Creating NAMESPACE ...
|  Creating Read-and-delete-me ...
|  Saving functions and data ...
|  Making help files ...
|  Done.
|  Further steps are described in './newpackage/Read-and-delete-me'.
| 
|  Adding Rcpp settings
|   >> added Imports: Rcpp
|   >> added LinkingTo: Rcpp
|   >> added useDynLib directive to NAMESPACE
|   >> added importFrom(Rcpp, evalCpp) directive to NAMESPACE
|   >> added example src file using Rcpp attributes
|   >> compiled Rcpp attributes
|   >> added Rd file for rcpp_hello_world
| -------------------------------------------------
| 
| The ~/.R/Makevars file is as follow :
| -------------------------------------------------
| CXX=clang++ -arch x86_64 -ftemplate-depth-256
| CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
| CXXFLAGS= -stdlib=libc++ -std=c++11
| -------------------------------------------------
| 
| Could anybody explain me where come from this problem ?

They are not added because they are not needed for the skeleton package.

You can eiher write them by hand -- 461 CRAN packages using Rcpp provide
examples -- or use a different generator:

R> library(RcppArmadillo)
R> RcppArmadillo.package.skeleton("youssef")

Calling kitten to create basic package.
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './youssef/Read-and-delete-me'.

Adding pkgKitten overrides.
Deleted 'Read-and-delete-me'.
Done.

Consider reading the documentation for all the packaging details.
A good start is the 'Writing R Extensions' manual.

And run 'R CMD check'. Run it frequently. And think of those kittens.


Adding RcppArmadillo settings
 >> added Imports: Rcpp
 >> added LinkingTo: Rcpp, RcppArmadillo
 >> added useDynLib and importFrom directives to NAMESPACE
 >> added Makevars file with Rcpp settings
 >> added Makevars.win file with RcppArmadillo settings
 >> added example src file using armadillo classes
 >> added example Rd file for using armadillo classes
 >> invoked Rcpp::compileAttributes to create wrappers
R> system("ls -l youssef/src/")
total 16
-rw-rw-r-- 1 edd edd   48 Sep 10 12:26 Makevars
-rw-rw-r-- 1 edd edd   49 Sep 10 12:26 Makevars.win
-rw-rw-r-- 1 edd edd 1453 Sep 10 12:26 rcpparma_hello_world.cpp
-rw-rw-r-- 1 edd edd 1546 Sep 10 12:26 RcppExports.cpp
R> 

You could always remove the LinkingTo: etc for RcppArmadillo if you don't
need Armadillo ...


Also see the excellent "Writing R Extensions" manual, Section 1.2.4 entitled
 "Using C++11 code" about another way of setting C++11 via DESCRIPTION:

      Packages without a 'Makevars' file may specify that they require
   C++11 by including 'C++11' in the 'SystemRequirements' field of the
   'DESCRIPTION' file, e.g.

        SystemRequirements: C++11

Dirk



-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list