Hi all,

I have been playing with Rcpp, and gotten the Rcpp installed just fine.

However, when I set up the default "example" package with Rcpp.package.skeleton(), e.g.

Rcpp.package.skeleton(name="RcppSkeleton")

...I can't get the package to install via any of the usual methods. During compilation of the C++ code, it hits a "file not found" error, I think because RcppSkeleton is not being produced, or not being placed in the appropriate directory.

Any help welcome! SessionInfo() and various attempts pasted below


ATTEMPT #1

####################################################
# (First, I ran this inside R:)
setwd("/Dropbox/_njm/__packages/")
Rcpp.package.skeleton( "RcppSkeleton" , force=TRUE, example_code=TRUE, module=TRUE)


# Then, I tried to install from command-line with R CMD INSTALL:
####################################################
vlsb-4151a-2:__packages nickm$ R CMD INSTALL /Dropbox/_njm/__packages/RcppSkeleton

Loading ~/.Rprofile...
Currently viewed PATH:
/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin:/GIS/MRTSwath/bin:/GIS/MRTSwath/bin:/usr/texbin
* installing to library ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library’
* installing *source* package ‘RcppSkeleton’ ...
** libs
*** arch - i386
g++ -arch i386 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" -fPIC -g -O2 -c rcpp_hello_world.cpp -o rcpp_hello_world.o g++ -arch i386 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" -fPIC -g -O2 -c rcpp_module.cpp -o rcpp_module.o g++ -arch i386 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o RcppSkeleton.so rcpp_hello_world.o rcpp_module.o Loading ~/.Rprofile... Currently viewed PATH: /opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin:/GIS/MRTSwath/bin:/GIS/MRTSwath/bin:/usr/texbin:/GIS/MRTSwath/bin:/usr/texbin /Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/lib/i386/libRcpp.a -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation i686-apple-darwin11-llvm-g++-4.2: Loading: No such file or directory i686-apple-darwin11-llvm-g++-4.2: ~/.Rprofile...: No such file or directory i686-apple-darwin11-llvm-g++-4.2: Currently: No such file or directory i686-apple-darwin11-llvm-g++-4.2: viewed: No such file or directory i686-apple-darwin11-llvm-g++-4.2: PATH:: No such file or directory i686-apple-darwin11-llvm-g++-4.2: /opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin:/GIS/MRTSwath/bin:/GIS/MRTSwath/bin:/usr/texbin:/GIS/MRTSwath/bin:/usr/texbin: No such file or directory
make: *** [RcppSkeleton.so] Error 1
ERROR: compilation failed for package ‘RcppSkeleton’
* removing ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RcppSkeleton’

vlsb-4151a-2:__packages nickm$

####################################################




















####################################################
# sessionInfo()
####################################################

vlsb-4151a-2:__packages nickm$ r

R version 2.14.1 (2011-12-22)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Loading ~/.Rprofile...
Currently viewed PATH:
/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin:/GIS/MRTSwath/bin:/GIS/MRTSwath/bin:/usr/texbin
[Previously saved workspace restored]

> sessionInfo()
R version 2.14.1 (2011-12-22)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats grDevices utils datasets graphics methods base

####################################################











####################################################
# ATTEMPT #2 -- inside R
####################################################
> require(Rcpp)
Loading required package: Rcpp

> setwd("/Dropbox/_njm/__packages/")

> Rcpp.package.skeleton( "RcppSkeleton" , force=TRUE, example_code=TRUE, module=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 './RcppSkeleton/Read-and-delete-me'.

Adding Rcpp settings
 >> added RcppModules: yada
 >> added Depends: Rcpp
 >> added LinkingTo: Rcpp
 >> added useDynLib directive to NAMESPACE
 >> added example header file using Rcpp classes
 >> added example src file using Rcpp classes
 >> added example R file calling the C++ example
 >> added Rd file for rcpp_hello_world
 >> copied the example module
>


> install.packages("/Dropbox/_njm/__packages/RcppSkeleton", lib="/Library/Frameworks/R.framework/Resources/library/", NULL, type='source', INSTALL_opts=c("--debug"))
Loading ~/.Rprofile...
Currently viewed PATH:
/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin:/GIS/MRTSwath/bin:/GIS/MRTSwath/bin:/usr/texbin:/GIS/MRTSwath/bin:/usr/texbin
processing ‘/Dropbox/_njm/__packages/RcppSkeleton’
a directory
* build_help_types=
* DBG: 'R CMD INSTALL' now doing do_install()
* created lock directory ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/00LOCK-RcppSkeleton’
* installing *source* package ‘RcppSkeleton’ ...
** libs
*** arch - i386
about to run R CMD SHLIB -o RcppSkeleton.so rcpp_hello_world.cpp rcpp_module.cpp g++ -arch i386 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" -fPIC -g -O2 -c rcpp_hello_world.cpp -o rcpp_hello_world.o g++ -arch i386 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" -fPIC -g -O2 -c rcpp_module.cpp -o rcpp_module.o g++ -arch i386 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o RcppSkeleton.so rcpp_hello_world.o rcpp_module.o Loading ~/.Rprofile... Currently viewed PATH: /opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin:/GIS/MRTSwath/bin:/GIS/MRTSwath/bin:/usr/texbin:/GIS/MRTSwath/bin:/usr/texbin:/GIS/MRTSwath/bin:/usr/texbin /Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/lib/i386/libRcpp.a -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation i686-apple-darwin11-llvm-g++-4.2: Loading: No such file or directory i686-apple-darwin11-llvm-g++-4.2: ~/.Rprofile...: No such file or directory i686-apple-darwin11-llvm-g++-4.2: Currently: No such file or directory i686-apple-darwin11-llvm-g++-4.2: viewed: No such file or directory i686-apple-darwin11-llvm-g++-4.2: PATH:: No such file or directory i686-apple-darwin11-llvm-g++-4.2: /opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin:/GIS/MRTSwath/bin:/GIS/MRTSwath/bin:/usr/texbin:/GIS/MRTSwath/bin:/usr/texbin:/GIS/MRTSwath/bin:/usr/texbin: No such file or directory
make: *** [RcppSkeleton.so] Error 1
ERROR: compilation failed for package ‘RcppSkeleton’
* removing ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RcppSkeleton’
Warning message:
In install.packages("/Dropbox/_njm/__packages/RcppSkeleton", lib = "/Library/Frameworks/R.framework/Resources/library/", : installation of package ‘/Dropbox/_njm/__packages/RcppSkeleton’ had non-zero exit status
>

###########################################

I get the same error when trying to install from inside R.app as well.

Presumably I have to change something inside the Makevars file (?), but as I'm just using the default example package, it seems like it ought to work out of the box.

But here's the current (default) Makevars file:

############################################################

## Use the R_HOME indirection to support installations of multiple R version
PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"`

## As an alternative, one can also add this code in a file 'configure'
##
##    PKG_LIBS=`${R_HOME}/bin/Rscript -e "Rcpp:::LdFlags()"`
##
##    sed -e "s|@PKG_LIBS@|${PKG_LIBS}|" \
##        src/Makevars.in > src/Makevars
##
## which together with the following file 'src/Makevars.in'
##
##    PKG_LIBS = @PKG_LIBS@
##
## can be used to create src/Makevars dynamically. This scheme is more ## powerful and can be expanded to also check for and link with other
## libraries.  It should be complemented by a file 'cleanup'
##
##    rm src/Makevars
##
## which removes the autogenerated file src/Makevars.
##
## Of course, autoconf can also be used to write configure files. This is ## done by a number of packages, but recommended only for more advanced users
## comfortable with autoconf and its related tools.

############################################################


Any help appreciated!

Cheers!
Nick





PS: From command line, R CMD BUILD, R CMD CHECK gives the same error:

===========================
vlsb-4151a-2:__packages nickm$ R CMD BUILD /Dropbox/_njm/__packages/RcppSkeleton
Loading ~/.Rprofile...
Currently viewed PATH:
/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin:/GIS/MRTSwath/bin:/GIS/MRTSwath/bin:/usr/texbin
* checking for file ‘/Dropbox/_njm/__packages/RcppSkeleton/DESCRIPTION’ ... OK
* preparing ‘RcppSkeleton’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building ‘RcppSkeleton_1.0.tar.gz’

vlsb-4151a-2:__packages nickm$ R CMD CHECK /Dropbox/_njm/__packages/RcppSkeleton
Loading ~/.Rprofile...
Currently viewed PATH:
/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin:/GIS/MRTSwath/bin:/GIS/MRTSwath/bin:/usr/texbin
* using log directory ‘/Dropbox/_njm/__packages/RcppSkeleton.Rcheck’
* using R version 2.14.1 (2011-12-22)
* using platform: x86_64-apple-darwin9.8.0 (64-bit)
* using session charset: UTF-8
* checking for file ‘RcppSkeleton/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘RcppSkeleton’ version ‘1.0’
* 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 whether package ‘RcppSkeleton’ can be installed ... ERROR
Installation failed.
See ‘/Dropbox/_njm/__packages/RcppSkeleton.Rcheck/00install.out’ for details. vlsb-4151a-2:__packages nickm$ open /Dropbox/_njm/__packages/RcppSkeleton.Rcheck/00install.out
===========================


The file:

/Dropbox/_njm/__packages/RcppSkeleton.Rcheck/00install.out
===========================
Loading ~/.Rprofile...
Currently viewed PATH:
/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin:/GIS/MRTSwath/bin:/GIS/MRTSwath/bin:/usr/texbin:/GIS/MRTSwath/bin:/usr/texbin
* installing *source* package ‘RcppSkeleton’ ...
** libs
*** arch - i386
g++ -arch i386 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" -fPIC -g -O2 -c rcpp_hello_world.cpp -o rcpp_hello_world.o g++ -arch i386 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" -fPIC -g -O2 -c rcpp_module.cpp -o rcpp_module.o g++ -arch i386 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o RcppSkeleton.so rcpp_hello_world.o rcpp_module.o Loading ~/.Rprofile... Currently viewed PATH: /opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin:/GIS/MRTSwath/bin:/GIS/MRTSwath/bin:/usr/texbin:/GIS/MRTSwath/bin:/usr/texbin:/GIS/MRTSwath/bin:/usr/texbin /Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/lib/i386/libRcpp.a -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation i686-apple-darwin11-llvm-g++-4.2: Loading: No such file or directory i686-apple-darwin11-llvm-g++-4.2: ~/.Rprofile...: No such file or directory i686-apple-darwin11-llvm-g++-4.2: Currently: No such file or directory i686-apple-darwin11-llvm-g++-4.2: viewed: No such file or directory i686-apple-darwin11-llvm-g++-4.2: PATH:: No such file or directory i686-apple-darwin11-llvm-g++-4.2: /opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin:/GIS/MRTSwath/bin:/GIS/MRTSwath/bin:/usr/texbin:/GIS/MRTSwath/bin:/usr/texbin:/GIS/MRTSwath/bin:/usr/texbin: No such file or directory
make: *** [RcppSkeleton.so] Error 1
ERROR: compilation failed for package ‘RcppSkeleton’
* removing ‘/Dropbox/_njm/__packages/RcppSkeleton.Rcheck/RcppSkeleton’
===========================








On 5/9/12 1:38 PM, Bob Carpenter wrote:
Thanks again, Dirk, for being so responsive to
our newbie queries. There's some more inline below.

On 5/8/12 11:34 PM, Dirk Eddelbuettel wrote:
 >
 > On 8 May 2012 at 23:17, Jiqiang Guo wrote:
 > | Suppose I have a function in CPP as
 > |
 > | void cppfun(Rcpp::List lst) {
 > | ......
 > | }
 > |
 > | Then I would like to call this cppfun in R code as say
 > | cppfun(list(a=a, b=b, c=c, ...)), in which
 >
 > (Well you need a SEXP somefun(SEXP ...) interface from R)

We (I'm working with Jiqiang) were hoping to
let Rcpp do the heavy wrapping here following
the std::vector example in the Rcpp modules doc (last
full example).

 > | a, b, c could be of different types and their type
might be different as this
 > | function gets called another time. So I would like to
know the type of a, b,
 > | c in the CPP code. Could someone help me out or point
to me some other
 > | approaches? Thanks.
 >
 > It's a good question. I have at time thought about that a
little, but have no
 > immediate solution for you.
 >
 > One could possible use something C++-ish via traits.

We are using traits/policies all over our own code,
but this isn't a compile-time type/behavioral config issue. The
types someone passes us in a call that takes a list
could be anything, and we need to check they're compatible
with what we're expecting and handle the error if they're
not.

 > One could also use C level macros from the R API which
simply test for types
 > as after all each element of a List must be a SEXP, so we
use the SEXP-style
 > macros.

This could work. We just don't know what's in an
SEXP or how to get the SEXP from the Rcpp::List entries.

What we (I'm working with Jiqiang) need is to be able to

1. access the value of an Rcpp list entry by name.
2. recover the basic type, integer or floating point
3. recover the dimensions
4. recover the values as a vector

Presumably that's available somewhere in the Rcpp::List
if you can use it to communicate back and forth
losslessly with R.

 > In the end I always went with more explicit code design:
only use a List for
 > transfer to / from R, and otherwise use explicit C++ types.

I completely agree with Dirk's last point -- we only
want to use Rcpp as transport to/from R.

Is there a place to find the API doc somewhere,
like what methods are available on an Rcpp::List?
Otherwise, I can just look at the code. I'm about to
try to look through the source now, so maybe I'll be
able to answer our own question.

- Bob



_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel



--
====================================================
Nicholas J. Matzke
Ph.D. Candidate, Graduate Student Researcher

Huelsenbeck Lab
Center for Theoretical Evolutionary Genomics
4151 VLSB (Valley Life Sciences Building)
Department of Integrative Biology
University of California, Berkeley

Graduate Student Instructor, IB200B
Principles of Phylogenetics: Ecology and Evolution
http://ib.berkeley.edu/courses/ib200b/
http://phylo.wikidot.com/


Lab websites:
http://ib.berkeley.edu/people/lab_detail.php?lab=54
http://fisher.berkeley.edu/cteg/hlab.html
Dept. personal page: http://ib.berkeley.edu/people/students/person_detail.php?person=370 Lab personal page: http://fisher.berkeley.edu/cteg/members/matzke.html
Lab phone: 510-643-6299
Dept. fax: 510-643-6264

Cell phone: 510-301-0179
Email: mat...@berkeley.edu

Mailing address:
Department of Integrative Biology
1005 Valley Life Sciences Building #3140
Berkeley, CA 94720-3140

-----------------------------------------------------
"[W]hen people thought the earth was flat, they were wrong. When people thought the earth was spherical, they were wrong. But if you think that thinking the earth is spherical is just as wrong as thinking the earth is flat, then your view is wronger than both of them put together."

Isaac Asimov (1989). "The Relativity of Wrong." The Skeptical Inquirer, 14(1), 35-44. Fall 1989.
http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm
====================================================
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to