[Rcpp-devel] RcppArmadillo-based code not finding Lapack routines

Davor Cubranic cubranic at stat.ubc.ca
Tue Sep 28 01:21:56 CEST 2010


Mystery solved: the culprit was an "#include <armadillo>" which was executed before any "#include <RcppArmadillo.h>". I'm not sure how this messed things up, but my guess is that it was because there was an old installation of Armadillo library in /usr/local/include, which was before RcppArmadillo in the -I search path. This caused some funny interaction between RcppArmadillo and the Armadillo includes, and ended up not using any of the BLAS routines, which is why vecLib was not linked in -- it was not even needed. :-)

Davor


On 2010-09-27, at 3:20 PM, Davor Cubranic wrote:

> I created a clean RcppArmadillo-based package using RcppArmadillo.package.skeleton and edited the example .cpp file to call arma::eig_sym. That works with no errors. Here is the output of 'otool -L' on the generated .so file:
> 
>        /Library/Frameworks/R.framework/Versions/2.10/Resources/lib/libRlapack.dylib (compatibility version 2.10.0, current version 2.10.1)
>        /Library/Frameworks/R.framework/Versions/2.10/Resources/lib/libRblas.dylib (compatibility version 0.0.0, current version 0.0.0)
>        /usr/local/lib/libgfortran.2.dylib (compatibility version 3.0.0, current version 3.0.0)
>        /Library/Frameworks/R.framework/Versions/2.10/Resources/lib/libR.dylib (compatibility version 2.10.0, current version 2.10.1)
>        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.29.0)
>        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
>        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
>        /System/Library/Frameworks/vecLib.framework/Versions/A/vecLib (compatibility version 1.0.0, current version 268.0.1)
> 
> The package that does show this error has only one difference in the linked libraries: vecLib is missing. I'm guessing this could well be the reason for the error. But for the life of me I don't see anything that would cause this in the package building process. FWIW, Makevars and DESCRIPTION in both working and non-working package have same entries for package dependencies and link flags. Also, the final building step that creates the shared library looks the same for both packages:
> 
> g++-4.2 -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o eigsym.so rcpparma_hello_world.o /Library/Frameworks/R.framework/Versions/2.10/Resources/library/Rcpp/lib/x86_64/libRcpp.a -L/Library/Frameworks/R.framework/Resources/lib/x86_64 -lRlapack -L/Library/Frameworks/R.framework/Resources/lib/x86_64 -lRblas -lgfortran -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
> 
> g++-4.2 -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o broken.so broken.o /Library/Frameworks/R.framework/Versions/2.10/Resources/library/Rcpp/lib/x86_64/libRcpp.a -L/Library/Frameworks/R.framework/Resources/lib/x86_64 -lRlapack -L/Library/Frameworks/R.framework/Resources/lib/x86_64 -lRblas -lgfortran -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
> 
> Davor
> 
> On 2010-09-27, at 1:29 PM, Davor Cubranic wrote:
> 
>> On 2010-09-27, at 12:54 PM, Dirk Eddelbuettel wrote:
>> 
>>> On 27 September 2010 at 12:43, Davor Cubranic wrote:
>>> | After I upgraded to RcppArmadillo 0.2.6, running existing code that uses it throws the following error:
>>> | 
>>> | run-time error: eig_sym(): need LAPACK
>>> | 
>>> | Any idea what might be causing this? I'm trying to create a minimal code needed to reproduce the problem, and strangely enough, this works fine:
>>> 
>>> Hm, works here as is:
>> 
>> Right, that fragment works fine, it's the real code that bombs. I'll post a small example that reproduces the error when I have it.
>> 
>> Davor
>> _______________________________________________
>> 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