[Rcpp-devel] Building shared libs with Rcpp does not work as before after Debian update

Andreas Recke Andreas.Recke at uksh.de
Tue Mar 18 11:43:52 CET 2014


Hi,

until recently, I used a very simple mechanism to compile and link my
C++/Rcpp/RcppArmadillo code for using it in R.
Since the last update, however, something has changed with the linking,
and the Rcpp shared library is not linked to
the final libary as before.
My question is, whether I need to change the my code to take these
changes into account? Is there a compatibility problem
with earlier versions of R and Rcpp?
I would like to have at least the option to use the command line to
compile my code and to have it working even with different
versions of R and Rcpp, especially because I found a way to use the
THRUST library for parallel computing with Rcpp, Boost and R.

So here is my problem:

 ******************* test.cpp ***************
 #include <iostream>
 #include <iomanip>
 #include <cmath>
 #include <RcppArmadillo.h>

 using namespace Rcpp;

 double norm(double x, double y)
 {
     return sqrt(x*x + y*y);
 }

 RcppExport SEXP norm_wrapper(SEXP x_,SEXP y_)
 {
   // step 0: convert input to C++ types
   double x = as<double>(x_), y= as<double>(y_);
   // step 1: call the underlying C ++ function
   double res = norm (x,y);
   // step 2: return the result as a SEXP
   return wrap(res);
 }
 *******************

*************** my makevars ****************

PKG_CXXFLAGS=$(shell Rscript -e "Rcpp:::CxxFlags()") $(shell Rscript -e "RcppArmadillo:::CxxFlags()")
PKG_LIBS=$(shell Rscript -e "Rcpp:::LdFlags()") $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) -lboost_system -lboost_thread

********************************************


************* in bash, I compile with ***********
R CMD SHLIB test.cpp

****************************************************

************* in R console ****************

>dyn.load("test.so")
>.Call("norm_wrapper", x_=2, y_=3)

and I get the error message, that function "dataptr" is not provided by
package "Rcpp" ...

******************************************
looking at test.so with nm , function "dataptr" is marked as unknown

Until recently, the above described procedure worked fine. Maybe it is
possible to keep it available for
compatibility reasons.

Andreas


By the way: I have R version 3.0.3 (2014-03-06) -- "Warm Puppy" on
x86_64-pc-linux-gnu (64-bit), with Rcpp 0.11.1 from 3/12/2014

--
Dr. Andreas Recke
Facharzt
Klinik für Dermatologie, Allergologie und Venerologie
Universitätsklinikum Schleswig-Holstein, Campus Lübeck
Ratzeburger Allee 160
23538 Lübeck
Tel.: +49 451 500 2530
Fax.: +49 451 500 2981

[http://www.uksh.de/skin/uksh/tpl/infoportal/img/uk-sh_logo.gif]

Universitätsklinikum Schleswig-Holstein
Rechtsfähige Anstalt des öffentlichen Rechts der Christian-Albrechts-Universität zu Kiel und der Universität zu Lübeck

Vorstandsmitglieder: Prof. Dr. Jens Scholz (Vorsitzender), Peter Pansegrau, Christa Meyer
Vorsitzender des Aufsichtsrates: Rolf Fischer
Bankverbindungen:
Förde Sparkasse BLZ 210 501 70 Kto.-Nr. 100 206, IBAN: DE14 2105 0170 0000 1002 06 SWIFT/BIC: NOLA DE 21 KIE
Commerzbank AG BLZ 230 800 40 Kto.-Nr. 300 041 200, IBAN: DE17 2308 0040 0300 0412 00 SWIFT/BIC: DRES DE FF 230

Diese E-Mail enthält vertrauliche Informationen und ist nur für die Personen bestimmt, an welche sie gerichtet ist.
Sollten Sie nicht der bestimmungsgemäße Empfänger sein, bitten wir Sie, uns hiervon unverzüglich zu unterrichten und die E-Mail zu vernichten.
Wir weisen darauf hin, dass der Gebrauch und die Weiterleitung einer nicht bestimmungsgemäß empfangenen E-Mail und ihres Inhalts gesetzlich verboten sind und ggf. Schadensersatzansprüche auslösen können.


More information about the Rcpp-devel mailing list