r - linking with RcppArmadillo (lapack) fails: undefined symbol: dgesdd_ -


i writing r package packagefoo rcpparmadillo. however, have problems compiling package in linux. glad if me. not know wrong.

i have single cpp file following header:

#include <stdio.h> #include <string> #include <bitset> #include <fstream> #include <algorithm> #include <iostream> #include <cmath> #include <rcpparmadillo.h> // [[rcpp::depends(rcpparmadillo)]]  using namespace rcpp; 

when devtools::load_all() following:

* installing *source* package ‘packagefoo’ ... ** libs g++ -i/usr/share/r/include -dndebug   -i"/home/user/r/x86_64-pc-linux-gnu-library/3.2/rcpp/include" -i"/home/user/r/x86_64-pc-linux-gnu-library/3.2/rcpparmadillo/include"   -fpic  -g -o2 -fstack-protector --param=ssp-buffer-size=4 -wformat -werror=format-security -d_fortify_source=2 -g  -c rcppexports.cpp -o rcppexports.o g++ -i/usr/share/r/include -dndebug   -i"/home/user/r/x86_64-pc-linux-gnu-library/3.2/rcpp/include" -i"/home/user/r/x86_64-pc-linux-gnu-library/3.2/rcpparmadillo/include"   -fpic  -g -o2 -fstack-protector --param=ssp-buffer-size=4 -wformat -werror=format-security -d_fortify_source=2 -g  -c functions.cpp -o functions.o g++ -shared -l/usr/lib/r/lib -wl,-bsymbolic-functions -wl,-z,relro -o packagefoo.so rcppexports.o functions.o -l/usr/lib/r/lib -lr installing /tmp/rtmpvf8b08/devtools_install_63383fe5bd9a/packagefoo/libs * done (packagefoo) loading required package: matrix error in dyn.load(dllfile) :    unable load shared object '/home/user/documents/packagefoo/src/packagefoo.so':   /home/user/documents/packagefoo/src/packagefoo.so: undefined symbol: dgesdd_ 

i googled around , found dgesdd_ part of lapack. checking linking ldd of packagefoo.so doesn't show linked lapack libraries.

    linux-vdso.so.1 =>  (0x00007ffc3615f000)     libr.so => /usr/lib/libr.so (0x00007f696e061000)     libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f696dd5d000)     libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f696da57000)     libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f696d841000)     libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f696d47c000)     libblas.so.3 => /usr/lib/libblas.so.3 (0x00007f696d1ff000)     libreadline.so.6 => /lib/x86_64-linux-gnu/libreadline.so.6 (0x00007f696cfb9000)     libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f696cd7b000)     liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f696cb59000)     libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f696c949000)     libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f696c730000)     librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f696c528000)     libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f696c324000)     libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f696c115000)     libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f696bef7000)     /lib64/ld-linux-x86-64.so.2 (0x00007f696e831000)     libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f696bcce000) 

my makevars file looks this:

pkg_libs = $(lapack_libs) $(blas_libs) $(flibs)  

as described in rcpparmadillo documentation. , running r cmd config lapack_libs returns -llapack

i running r 3.2.5 rcpp_0.12.4, rcpparmadillo_0.6.700.3.0, , devtools_1.11.0

the issue name of makevars file. specifically, change name of makevars makevars (unix / linux) or makevars.win (windows) , make sure placed within src/ directory.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -