[Rcpp-devel] Bug with table sugar and NumericVector in Rcpp 0.10.3
romain at r-enthusiasts.com
romain at r-enthusiasts.com
Fri Mar 29 09:11:59 CET 2013
Hello,
This is related to this change:
2013-01-15 Dirk Eddelbuettel <edd at debian.org>
* src/api.cpp (Rcpp): Commented-out coerce_to_string() for real and
complex arguments as R-devel (as of today) dislikes use of non-API
functions Rf_EncodeComplex’, ‘Rf_EncodeReal’, ‘Rf_formatComplex’
So maybe Dirk has a plan to fix it.
Romain
Le 2013-03-29 07:27, Kevin Ushey a écrit :
> Hi guys,
>
> When I attempt to 'sourceCpp' the following code, the R session
> crashes:
>
> #include <Rcpp.h>
> using namespace Rcpp;
>
> // [[Rcpp::export]]
> IntegerVector counts(NumericVector x) {
> return table(x);
> }
>
> The same code worked in Rcpp 0.10.2.
>
> A hint to the error comes if I try to compile a package with that
> source code in a .cpp file: I get the error, when attempting to load
> the package:
>
> dlopen(/Library/Frameworks/R.framework/Versions/2.15/Resources/library/anRpackage/libs/x86_64/anRpackage.so,
> 6): Symbol not found:
>
> __ZN4Rcpp8internal16coerce_to_stringILi14EEEPKcNS_6traits12storage_typeIXT_EE4typeE
> Referenced from:
>
> /Library/Frameworks/R.framework/Versions/2.15/Resources/library/anRpackage/libs/x86_64/anRpackage.so
> Expected in: flat namespace
> in
>
> /Library/Frameworks/R.framework/Versions/2.15/Resources/library/anRpackage/libs/x86_64/anRpackage.so
>
> This is with R 2.15.3 on Mac OSX 10.8.3.
>
> -----
>
> In addition, if I attempt to compile Rcpp from source (with gcc 4.8)
> I
> get the following warnings:
>
>> install.packages("Rcpp", type="source",
> INSTALL_opts="--no-multiarch")
> Installing package(s) into
> ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library’
> (as ‘lib’ is unspecified)
> trying URL 'http://cran.rstudio.com/src/contrib/Rcpp_0.10.3.tar.gz
> [1]'
> Content type 'application/x-gzip' length 2395986 bytes (2.3 Mb)
> opened URL
> ==================================================
> downloaded 2.3 Mb
>
> * installing *source* package ‘Rcpp’ ...
> ** package ‘Rcpp’ successfully unpacked and MD5 sums checked
> ** libs
> *** arch - x86_64
> g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include
> -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG
> -I../inst/include/ -I/usr/local/include -fPIC -g -O3 -Wall
> -pedantic -c Date.cpp -o Date.o
> g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include
> -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG
> -I../inst/include/ -I/usr/local/include -fPIC -g -O3 -Wall
> -pedantic -c Module.cpp -o Module.o
> In file included from ../inst/include/Rcpp/Module.h:352:0,
> from ../inst/include/Rcpp.h:63,
> from Module.cpp:22:
> ../inst/include/Rcpp/module/class.h: In member function
> ‘Rcpp::class_<Class>::self& Rcpp::class_<Class>::derives(const
> char*)’:
> ../inst/include/Rcpp/module/class.h:495:56: warning: typedef
> ‘parent_prop_class’ locally defined but not used
> [-Wunused-local-typedefs]
> typedef typename parent_class_::prop_class
> parent_prop_class ;
> <snip, snip>
>
> although the package does install successfully. Not sure if it's
> related or not.
>
> Thanks,
> -Kevin
>
> Links:
> ------
> [1] http://cran.rstudio.com/src/contrib/Rcpp_0.10.3.tar.gz
More information about the Rcpp-devel
mailing list