[Rcpp-devel] R CMD check failing on skeletonc Rcpp module

Bob Carpenter carp at alias-i.com
Fri Mar 23 20:42:46 CET 2012


With latest Rcpp (0.9.10) and latest R (2.14.2),
I generated an Rcpp module skeleton, but it
blows up with a memory error "pointer being freed was not
allocated" when I run "R CMD check" for x86_64.

An Rcpp skeleton created with module=FALSE works just fine.

Here's what I did step-by-step:

1.  Updated R to 2.14.2

2.  Fired up 64-bit R

~/stan> R

R version 2.14.2 (2012-02-29)
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)


3.  Installed Rcpp

R> setwd('stan')
R> install.packages('Rcpp')
--- Please select a CRAN mirror for use in this session ---
trying URL 
'http://cran.at.r-project.org/bin/macosx/leopard/contrib/2.14/Rcpp_0.9.10.tgz'
Content type 'application/x-gzip' length 7636884 bytes (7.3 Mb)
opened URL
==================================================
downloaded 7.3 Mb


4. Generated a package skeleton with module=TRUE

R> Rcpp.package.skeleton(name='mypkg2',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 './mypkg2/Read-and-delete-me'.


5.  Built the package

~/stan> R CMD build mypkg2
* checking for file ‘mypkg2/DESCRIPTION’ ... OK
* preparing ‘mypkg2’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building ‘mypkg2_1.0.tar.gz’


6. Check the package

~/stan> R CMD check mypkg2
* using log directory ‘/Users/carp/stan/mypkg2.Rcheck’
* using R version 2.14.2 (2012-02-29)
* using platform: x86_64-apple-darwin9.8.0 (64-bit)
* using session charset: UTF-8
* checking for file ‘mypkg2/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘mypkg2’ 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 ‘mypkg2’ can be installed ... ERROR
Installation failed.
See ‘/Users/carp/stan/mypkg2.Rcheck/00install.out’ for details.


7. Look at the error log

~/stan> cat /Users/carp/stan/mypkg2.Rcheck/00install.out
* installing *source* package ‘mypkg2’ ...
** 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 mypkg2.so rcpp_hello_world.o rcpp_module.o 
/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
ld: warning: in /usr/local/lib/libstdc++.dylib, file was built for 
unsupported file format which is not the architecture being linked (i386)
installing to /Users/carp/stan/mypkg2.Rcheck/mypkg2/libs/i386
*** arch - x86_64
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include 
-I/Library/Frameworks/R.framework/Resources/include/x86_64 
-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 x86_64 -I/Library/Frameworks/R.framework/Resources/include 
-I/Library/Frameworks/R.framework/Resources/include/x86_64 
-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 x86_64 -dynamiclib -Wl,-headerpad_max_install_names -undefined 
dynamic_lookup -single_module -multiply_defined suppress 
-L/usr/local/lib -o mypkg2.so rcpp_hello_world.o rcpp_module.o 
/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/lib/x86_64/libRcpp.a 
-F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework 
-Wl,CoreFoundation
installing to /Users/carp/stan/mypkg2.Rcheck/mypkg2/libs/x86_64
** R
** preparing package for lazy loading
** help
Warning: /Users/carp/stan/mypkg2/man/mypkg2-package.Rd:30: All text must 
be in a section
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
*** arch - i386
*** arch - x86_64
R(2493) malloc: *** error for object 0x7fff704bd500: pointer being freed 
was not allocated
*** set a breakpoint in malloc_error_break to debug
sh: line 1:  2493 Abort trap 
'/Library/Frameworks/R.framework/Resources/bin/R' --arch=x86_64 
--no-save --slave < 
/var/folders/ju/juD0VflHENew03RUV+bbPU+++TM/-Tmp-//RtmpEs9sCx/file971c5161ca
ERROR: loading failed for ‘x86_64’
* removing ‘/Users/carp/stan/mypkg2.Rcheck/mypkg2’



Any clues as to what's going on would be greatly appreciated.

Thanks.

- Bob Carpenter
   Columbia University, Deptartment of Statistics




More information about the Rcpp-devel mailing list