[Rcpp-devel] Rcpp and RcppArmadillo errors on OSX Mavericks

Michael Cone coanil at posteo.org
Mon Nov 4 16:49:32 CET 2013


Am 04.11.2013 15:53 schrieb Romain Francois:
> Le 04/11/2013 15:43, Michael Cone a écrit :
>> Dear list,
>>
>> I'm fairly new to Rcpp but have been using it without any problems 
>> for a
>> few weeks.
>> Yesterday I made the unfortunate error to upgrade from OS X 10.8 to 
>> OS X
>> 10.9 (Mavericks), which
>> seriously broke something.
>
> This is not an unfortunate error. The transition is not as smooth as
> it ought to be. Partly due to Apple, partly due to R.
>
>> Using a new user account/admin account didn't
>> change anything
>> (apparently this has worked for someone once on this list).
>>
>> I know that Problems with Mavericks have been discussed on this list
>> before, but my CC and CXX in ~/.R/Makevars are set to clang and 
>> clang++
>> and I don't really know what else to do.
>
> Did you compile Rcpp from source ? If not then you are using Rcpp
> from cran that was built with another compiler (gcc 4.2 or an llvm
> emulation of it).
>
> Judging from what I see below, it is likely to be the extent of the 
> problem.
>
> Romain

Compiling Rcpp, RcppArmadillo and inline from source solved all 
problems!

Thanks Romain, this really saved my day.
(I believe I just mailed you personally by mistake - sorry, please 
ignore.)

Best regards
Michael Cone

>> I'm using the pre-built R binary CRAN provides. Nothing fancy.
>> XCode 5.0.1 is installed along with the Command Line Tools (OS X
>> Mavericks) and gfortran-4.2.3 from CRAN.)
>>
>> I ran the the unit tests for RcppArmadillo, they almost all fail:
>> http://pastebin.com/C60xcvzh
>>
>> One simple example (this is from the docs, Rcpp-modules p6):
>>
>> In a clean R session with --vanilla:
>>
>>> require(Rcpp)
>> Loading required package: Rcpp
>>> require(inline)
>> Loading required package: inline
>>
>> Attaching package: ‘inline’
>>
>> The following object is masked from ‘package:Rcpp’:
>>
>>      registerPlugin
>>
>>> inc <- '
>>     using namespace Rcpp;
>>     double norm( double x, double y ) {
>>     return sqrt( x*x + y*y );
>>     }
>>     RCPP_MODULE(mod) {
>>     function( "norm", &norm );
>>     }
>>    '
>>> fx <- cxxfunction(signature(), plugin="Rcpp", include=inc, 
>>> verbose=TRUE)
>> Compilation argument:
>>   /Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB
>> file10451508f324.cpp 2> file10451508f324.cpp.err.txt
>> clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
>> -I/usr/local/include
>> 
>> -I"/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include"
>>    -fPIC  "-mtune=native -g -O2 -Wall -pedantic -Wconversion" -c
>> file10451508f324.cpp -o file10451508f324.o
>> clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined
>> dynamic_lookup -single_module -multiply_defined suppress
>> -L/usr/local/lib -L/usr/local/lib -o file10451508f324.so
>> file10451508f324.o
>> 
>> /Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/lib/libRcpp.a
>> -L/Library/Frameworks/R.framework/Resources/lib -lRlapack
>> -L/Library/Frameworks/R.framework/Resources/lib -lRblas -lgfortran
>> -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
>> -Wl,CoreFoundation
>> Error in dyn.load(libLFile) :
>>    unable to load shared object
>> 
>> '/var/folders/9x/w2b7c7k50g3749c7gqjrdz980000gn/T//Rtmp671JcT/file10451508f324.so':
>>
>> 
>> dlopen(/var/folders/9x/w2b7c7k50g3749c7gqjrdz980000gn/T//Rtmp671JcT/file10451508f324.so,
>> 6): Symbol not found:
>> 
>> __Z8demangleRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
>>
>>    Referenced from:
>> 
>> /var/folders/9x/w2b7c7k50g3749c7gqjrdz980000gn/T//Rtmp671JcT/file10451508f324.so
>>
>>    Expected in: flat namespace
>>   in
>> 
>> /var/folders/9x/w2b7c7k50g3749c7gqjrdz980000gn/T//Rtmp671JcT/file10451508f324.so
>>
>>>
>>
>>
>> $ c++filt
>> 
>> __Z8demangleRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE
>>
>> demangle(std::__1::basic_string<char, std::__1::char_traits<char>,
>> std::__1::allocator<char> > const&)
>>
>>
>>> sessionInfo()
>> R version 3.0.2 (2013-09-25)
>> Platform: x86_64-apple-darwin10.8.0 (64-bit)
>>
>> locale:
>> [1] C/UTF-8/C/C/C/C
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> other attached packages:
>> [1] inline_0.3.13 Rcpp_0.10.6
>>
>> loaded via a namespace (and not attached):
>> [1] tools_3.0.2
>>
>> I also ran the unit tests for RcppArmadillo. Here are the results:
>> http://pastebin.com/cp29bBDJ
>>
>>> .libPaths()
>> [1] "/Library/Frameworks/R.framework/Versions/3.0/Resources/library"
>>
>>> require(devtools)
>> Loading required package: devtools
>>> has_devel()
>> '/Library/Frameworks/R.framework/Resources/bin/R' --vanilla CMD 
>> SHLIB foo.c
>>
>> clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
>> -I/usr/local/include    -fPIC  "-mtune=native -g -O2 -Wall -pedantic
>> -Wconversion" -c foo.c -o foo.o
>> clang -dynamiclib -Wl,-headerpad_max_install_names -undefined
>> dynamic_lookup -single_module -multiply_defined suppress
>> -L/usr/local/lib -L/usr/local/lib -o foo.so foo.o
>> 
>> /Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/lib/libRcpp.a
>> -L/Library/Frameworks/R.framework/Resources/lib -lRlapack
>> -L/Library/Frameworks/R.framework/Resources/lib -lRblas -lgfortran
>> -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
>> -Wl,CoreFoundation
>> [1] TRUE
>>
>>
>> Simple things work, though:
>>> require("Rcpp")
>> Loading required package: Rcpp
>>> evalCpp("1+1")
>> [1] 2
>>
>>
>> Please let me know if I forgot to include relevant information.
>>
>> I would greatly appreciate any pointers in the right direction. 
>> Thank
>> you for your help.
>>
>> Michael Cone
>>
>> _______________________________________________
>> Rcpp-devel mailing list
>> Rcpp-devel at lists.r-forge.r-project.org
>> 
>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


More information about the Rcpp-devel mailing list