[Rcpp-devel] Bug with table sugar and NumericVector in Rcpp 0.10.3

Kevin Ushey kevinushey at gmail.com
Fri Mar 29 07:27:57 CET 2013


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'
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130328/adc37496/attachment.html>


More information about the Rcpp-devel mailing list