[Rcpp-devel] Help Rcpp under ubuntu with QT4
Dirk Eddelbuettel
edd at debian.org
Mon Oct 11 21:41:29 CEST 2010
On 11 October 2010 at 20:19, Paulo Trigueiros wrote:
|
| Hi Dirk,
| |
| | Thanks for your answer. Sorry for the short answer, but I'm really
| | starting using the interface, so I'm a little bit confused:-(
| | I really want to use RInside, and call R functions from my C++ program.
| | These functions can be called from main, right?
Yes it should work provided three things are taken care of:
a) The _compile_ step: RInside.h and Rcpp.h are needed; we show in examples
how you can 'compute' the location of the header files using
Rcpp:::CxxFlags().
The Rcpp-packages vignette has details; this is essentially the same for
RInside but one has to deal with both.
b) The _link_ step: Similarly, once all object files have been compiled, you
need to link an executable so you need to supply -L (for location) and -l
(for libraries). Again, Rcpp:::LdFlags() etc help with that, and the
examples/standard directory for RInside how it can be done from a
Makefile.
An important part of the link step is that we also supply 'rpath'
arguments to the linker which embeds the path to the dynamic library in
the executable. That helps with c).
c) The _run-time_ step: We depends on shared libraries (on Linux) so we
have to tell the ld.so program where to find them.
This can be done in several ways; using rpath as in the Rcpp and RInside
example is one which I like as it is self-contained.
Another is to make the library directoties for RInside and Rcpp 'public'.
You can do that either via something like
/etc/ld.so.conf.d/local-Rcpp.conf
where the filename does not matter _as long as it ends in .conf_ to be
valid. Then run 'sudo ldconfig' to update the cache and this should work.
We do nto promote this as it involves local admin work.
Lastly, you can use LD_LIBRARY_PATH.
So let us know what you tried and what failed and we take it from there.
Dirk
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list