[Rcpp-devel] compiling an RInside and RCppEigen application using the Intel compiler, icpc

Stephen J. Barr stephenjbarr at gmail.com
Mon Aug 13 09:19:01 CEST 2012


Greetings,

Over the weekend I had wanted to compile an application using RInside and
RCppEigen using icpc. I found the following two pieces of information
helpful.

1. The order of the includes in important. In particular

#include "mpi.h"
#include <RInside.h>
#include <Rcpp.h>
#include <RcppEigen.h>

mpi.h must be first. If mpi.h is after RInside.h, you get the following
sort of errors:

-------------------------------
/usr/local/include/openmpi/ompi/mpi/cxx/datatype.h(142): error: expected a
type specifier
    virtual void Free();
                 ^

/usr/local/include/openmpi/ompi/mpi/cxx/datatype.h(142): error: expected a
")"
    virtual void Free();
                 ^

/usr/local/include/openmpi/ompi/mpi/cxx/datatype.h(142): error: expected an
identifier
    virtual void Free();
                 ^
--------------------------------

2. The compile string that I used was

icpc -I/usr/local/include -pthread -I/usr/share/R/include
-I/usr/lib/R/site-library/Rcpp/include
-I/usr/local/lib/R/site-library/RInside/include -O3 -pipe -g -Wall
 sjb_simple_smle_with_Rinside.cpp  -pthread -L/usr/local/lib -lmpi_cxx
-lmpi -ldl -lm -Wl,--export-dynamic -lrt -lnsl -lutil -L/usr/lib/R/lib -lR
-lblas -llapack -L/usr/lib/R/site-library/Rcpp/lib -lRcpp
-Wl,-rpath,/usr/lib/R/site-library/Rcpp/lib
-L/usr/local/lib/R/site-library/RInside/lib -lRInside
-Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib -o
sjb_simple_smle_with_Rinside
-I/usr/local/lib/R/site-library/RcppEigen/include

This was based on the compile string generated by the make file for the mpi
examples that come with RInside. This took me a while to figure out, so I
hope it is useful for someone else.

Best regards and have a good week!
Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20120813/4ad41ea2/attachment-0001.html>


More information about the Rcpp-devel mailing list