Rstudio crashes with brms function [duplicate] - r

I am currently trying to get rstan and brms running on my Fedora34 machine, and failing to do so since a couple of hours. Crucially, testing the example models or others always gives me a "Floating Point Exception". When I run the code in RStudio, it simply crashes and aborts everything, while running from the terminal does basically the same but gives me the hint of the floating point exception, as can be seen below. The error message is sadly limited to the info of "Floating Point exception".
The make command is:
make -f '/usr/lib64/R/etc/Makeconf' -f '/usr/share/R/make/shlib.mk' \
-f '/root/.R/Makevars' CXX='$(CXX14) $(CXX14STD)' \
CXXFLAGS='$(CXX14FLAGS)' CXXPICFLAGS='$(CXX14PICFLAGS)' \
SHLIB_LDFLAGS='$(SHLIB_CXX14LDFLAGS)' SHLIB_LD='$(SHLIB_CXX14LD)' \
SHLIB='filef8256c0e3305.so' OBJECTS='filef8256c0e3305.o'
make would use:
g++ -std=gnu++14 -I"/usr/include/R" -DNDEBUG -I"/usr/local/lib/R/library \
/Rcpp/include/" -I"/usr/local/lib/R/library/RcppEigen/include/" \
-I"/usr/local/lib/R/library/RcppEigen/include/unsupported" \
-I"/usr/local/lib/R/library/BH/include" \
-I"/usr/local/lib/R/library/StanHeaders/include/src/" \
-I"/usr/local/lib/R/library/StanHeaders/include/" \
-I"/usr/local/lib/R/library/RcppParallel/include/" -I"/usr/local/lib/R/library/rstan/include" \
-DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS \
-DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR \
-include '/usr/local/lib/R/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp' \
-D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1 -I/usr/local/include -fpic \
-O3 -march=native -mtune=native -fPIC \
-c filef8256c0e3305.cpp -o filef8256c0e3305.o
if test "zfilef8256c0e3305.o" != "z"; then \
echo g++ -std=gnu++14 -shared -L"/usr/lib64/R/lib" -Wl,-z,relro \
-Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld \
-o filef8256c0e3305.so filef8256c0e3305.o '/usr/local/lib/R/library/rstan/lib//libStanServices.a' \
-L'/usr/local/lib/R/library/StanHeaders/lib/' -lStanHeaders \
-L'/usr/local/lib/R/library/RcppParallel/lib/' -ltbb \
-L"/usr/lib64/R/lib" -lR; \
g++ -std=gnu++14 -shared -L"/usr/lib64/R/lib" -Wl,-z,relro \
-Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -o filef8256c0e3305.so filef8256c0e3305.o \
'/usr/local/lib/R/library/rstan/lib//libStanServices.a' \
-L'/usr/local/lib/R/library/StanHeaders/lib/' -lStanHeaders \
-L'/usr/local/lib/R/library/RcppParallel/lib/' -ltbb \
-L"/usr/lib64/R/lib" -lR; \
fi
Floating point exception
This seems weird to me, as there should be no such errors because I am not trying to do anything fancy, just running the sample models. I tried reinstalling R completely, reinstalling rstan from source, but none of it worked. Also, cmdstanr gives me the info that all my c++ chains and paths are set correctly. The MCMC of cmdstanr also run correctly, so the problem seems to be specifically with brms and rstan.
Some package information:
OS: x86_64 (Fedora 34), linux-gnu; rstan: 2.21.2; Rcpp: 1.0.6; inline: 0.3.17, R 4.0.4

Don't know what the actual problem is, but given that cmdstanr works, you can work around it your problem via
brms(..., backend="cmdstanr")
See here for a little bit of discussion of the differences between rstan and cmdstanr: among them
Running Stan via external processes results in fewer unexpected crashes, especially in RStudio.

Related

Docker, Jenkins, and rJava

Part of a Jenkins job I'm running entails installing rJava; the Jenkins job is running on a docker image over which I have control, but still I can't seem to get rJava to install.
Looking around a bit, it seems like being sure to run R CMD javareconf is pretty key in all this, and indeed I added && R CMD javareconf as the last command in my Dockerfile. Compilation of the Docker image contains:
Java interpreter : /docker-java-home/jre/bin/java
Java version : 1.8.0_171
Java home path : /docker-java-home
Java compiler : /docker-java-home/bin/javac
Java headers gen.: /docker-java-home/bin/javah
Java archive tool: /docker-java-home/bin/jar
trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
detected JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/docker-java-home/include -I/docker-java-home/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c conftest.c -o conftest.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o conftest.so conftest.o -L/docker-java-home/jre/lib/amd64/server -ljvm -L/usr/lib/R/lib -lR
JAVA_HOME : /docker-java-home
Java library path: $(JAVA_HOME)/jre/lib/amd64/server
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
Updating Java configuration in /usr/lib/R
Done.
Now, when I enter the Docker instance (docker exec -it jenkins_img bash), I can in fact manually install rJava: install.packages('rJava') works as expected; importantly, this is part of the output there:
checking Java support in R... present:
interpreter : '/docker-java-home/jre/bin/java'
archiver : '/docker-java-home/bin/jar'
compiler : '/docker-java-home/bin/javac'
header prep.: '/docker-java-home/bin/javah'
cpp flags : '-I/docker-java-home/include -I/docker-java-home/include/linux'
java libs : '-L/docker-java-home/jre/lib/amd64/server -ljvm'
However, when I run the script that's part of my Jenkins job, the corresponding output becomes:
checking Java support in R... present:
interpreter : '/usr/lib/jvm/default-java/jre/bin/java'
archiver : '/usr/lib/jvm/default-java/bin/jar'
compiler : '/usr/lib/jvm/default-java/bin/javac'
header prep.: '/usr/lib/jvm/default-java/bin/javah'
cpp flags : '-I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux'
java libs : '-L/usr/lib/jvm/default-java/jre/lib/amd64/server -ljvm'
checking whether Java run-time works... ./configure: line 3747: /usr/lib/jvm/default-java/jre/bin/java: No such file or directory
no
configure: error: Java interpreter '/usr/lib/jvm/default-java/jre/bin/java' does not work
So, it seems whichever process is running when I docker exec to bash has a different JAVA_HOME than the process which is running under my Jenkins job. To that end, I added the following directly before the line installing rJava in my script (as suggested):
export JAVA_HOME=/docker-java-home/
export PATH=$PATH:$JAVA_HOME/bin
Rscript -e 'install.packages("rJava")'
However, this fails with the same output. I have also checked that the R process running install.packages has the same JAVA_HOME by cating Sys.getenv('JAVA_HOME') and confirming that it's /docker-java-home/.
The Jenkins script doesn't have root access so I can't run R CMD javareconf there.
How can I get install.packages('rJava') to use the right JAVA_HOME?
FWIW, these days I use some variation of the following in Docker images to get rJava to build correctly:
# rJava
RUN apt-get update && apt-get install -y libudunits2-dev gnupg2 software-properties-common
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" \
| tee /etc/apt/sources.list.d/webupd8team-java.list \
&& echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" \
| tee -a /etc/apt/sources.list.d/webupd8team-java.list \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 \
&& echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" \
| /usr/bin/debconf-set-selections \
&& apt-get update \
&& apt-get install -y oracle-java8-installer \
&& update-alternatives --display java \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean \
&& R CMD javareconf
This was not particularly my own work, I basically took it from #daroczig:
https://github.com/rocker-org/rocker/issues/109
https://hub.docker.com/r/cardcorp/r-java/dockerfile/

unable to pass R CMD check in windows due to i386 build

I wish to submit my R package to CRAN that uses Rcpp and RcppGSL.My problem is that I am unable to build a package that pass R CMD check in win-builder. My understanding is that because the i386 package is built,but not installed and checked during R CMD check. The x64 package builds and passes the checks (when I run check with --no--multiarch). My understanding is a bit flawed, since I had limited time to get this windows build working at all for 64-bit.
This is the Makevars.win.gen
PKG_CPPFLAGS = $(GSL_CFLAGS) -I"$(LIB_GSL)/include" -I"$(LIB_GSL)/include/gsl" -I../inst/include -I../inst -Wall -Wno-unused-but-set-variable -Wno-long-long -Wno-sign-compare -Wno-deprecated -pedantic -pthread -fPIC -O2 -g
ARCH=x64
ifeq "$(WIN)" "64"
ARCH= i386
else
ARCH= x64
endif
RCPPGSL_LDFLAGS = `$(R_HOME)/bin/$(R_ARCH_BIN)/Rscript -e "RcppGSL:::LdFlags()"`
GRAPHM_OBJ = ./algorithm_ca.o ./algorithm_ext.o ./algorithm_fsol.o ./algorithm_iden.o ./algorithm_lp.o ./algorithm.o ./algorithm_path.o ./algorithm_qcv.o ./algorithm_rand.o ./algorithm_rank.o ./algorithm_umeyama.o ./algorithm_unif.o ./experiment.o ./graph.o ./hungarian.o ./rpc.o
GRAPHM_OBJ_REL = $(addprefix ./graphm/,$(GRAPHM_OBJ) )
PKG_LIBS = $(LDFLAGS) -L"$(LIB_GSL)\lib"$(R_ARCH_BIN) $(RCPPGSL_LDFLAGS) $(GSL_LIBS) -lgsl -lgslcblas
CXX ?= g++
SHVER= 1
VPATH= ./graphm:./graphm-0.52
SOURCES= graphmatch_rcpp.cpp RcppExports.cpp
OBJECTS= $(SOURCES:.cpp=.o) $(GRAPHM_OBJ_REL)
#all: $(SHLIB) $(OBJECTS)
$(SHLIB): $(OBJECTS)
#all: $(ALLFILES) ../inst/libgraphm.a
# cd graphm && $(MAKE)
# $(CXX) $(CXXFLAGS) $(OBJECTS) ../inst/libgraphm.a $(PKG_LIBS)
./experiment.o: experiment.cpp experiment.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c experiment.cpp -o ./experiment.o
./rpc.o: rpc.cpp rpc.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c rpc.cpp -o ./rpc.o
./graph.o: graph.cpp graph.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c graph.cpp -o ./graph.o
./hungarian.o: hungarian.cpp hungarian.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c hungarian.cpp -o ./hungarian.o
./algorithm.o: algorithm.cpp algorithm.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c algorithm.cpp -o ./algorithm.o
#graph matching algorithms
./algorithm_ca.o: algorithm_ca.cpp algorithm_ca.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c algorithm_ca.cpp -o ./algorithm_ca.o
./algorithm_path.o: algorithm_path.cpp algorithm_path.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c algorithm_path.cpp -o ./algorithm_path.o
./algorithm_ext.o: algorithm_ext.cpp algorithm_ext.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c algorithm_ext.cpp -o ./algorithm_ext.o
./algorithm_fsol.o: algorithm_fsol.cpp algorithm_fsol.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c algorithm_fsol.cpp -o ./algorithm_fsol.o
./algorithm_iden.o: algorithm_iden.cpp algorithm_iden.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c algorithm_iden.cpp -o ./algorithm_iden.o
./algorithm_lp.o: algorithm_lp.cpp algorithm_lp.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c algorithm_lp.cpp -o ./algorithm_lp.o
./algorithm_qcv.o: algorithm_qcv.cpp algorithm_qcv.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c algorithm_qcv.cpp -o ./algorithm_qcv.o
./algorithm_rand.o: algorithm_rand.cpp algorithm_rand.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c algorithm_rand.cpp -o ./algorithm_rand.o
./algorithm_rank.o: algorithm_rank.cpp algorithm_rank.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c algorithm_rank.cpp -o ./algorithm_rank.o
./algorithm_umeyama.o: algorithm_umeyama.cpp algorithm_umeyama.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c algorithm_umeyama.cpp -o ./algorithm_umeyama.o
./algorithm_unif.o: algorithm_unif.cpp algorithm_unif.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)\include" -c algorithm_unif.cpp -o ./algorithm_unif.o
ALLOBJ: $(OBJECTS) $(GRAPHM_OBJ)
ALLFILES: $(OBJECTS) $(GRAPHM_OBJ_REL) ../inst/libgraphm.a
../inst/libgraphm.a: RcppExports.o $(GRAPHM_OBJ)
ar -rvs ../inst/libgraphm.a $(GRAPHM_OBJ_REL)
clean: cleana cleanb
cleana:
rm $(OBJECTS)
cleanb:
rm $(GRAPHM_OBJ_REL)
#.PHONY: all test clean
Incidentally, I am using this configure.win to pass the right flags to Makevars.win. But this is really unnecessary ,since I removed #GSL_LIBS# from Makevars.win.gen. Is this the reason i386 build is not installed during R CMD check?
ifeq "$(WIN)" "64"
R_ARCH_BIN="/x64"
else
R_ARCH_BIN="/i386"
endif
GSL_CFLAGS=`"${R_HOME}/bin$(R_ARCH_BIN)/Rscript.exe" -e "require(RcppGSL);RcppGSL:::CFlags()"`
GSL_LIBS=`"${R_HOME}/bin$(R_ARCH_BIN)/Rscript.exe" -e "require(RcppGSL);RcppGSL:::LdFlags()"`
sed -e "s|#GSL_LIBS#|${GSL_LIBS}|" \
-e "s|#GSL_CFLAGS#|${GSL_CFLAGS}|" \
src/Makevars.win.gen > src/Makevars.win
Any auxiliary information that is relevant for building a multi-arch R package that is dependent on pre-built windows libraries would be appreciated.
Your starting assumptions are wrong, methinks, and you may be making this too hard. I think it is worth stepping back:
In order to locally build multi-arch, you actually need a proper multi-arch setup locally. That would imply 32 and 64 bit builds of the GSL.
But you don't have to build locally -- you can submit your sources to both
win-builder
R Hub
both of which can run one or several Windows builds for you! I use them before every upload.
Also note that you don't necessarily need a Makevars.win all that complicated. My RcppZiggurat package (on CRAN) just has these two instructions:
PKG_CPPFLAGS = -I. -I../inst/include
## Use the R_HOME indirection to support installations of multiple R version
PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" \
-e "RcppGSL:::LdFlags()")
(and I added the linebreak by hand).
Lastly, RcppGSL has four reverse Depends so you have four working examples to study. Eg mvabund does
## This assumes that the LIB_GSL variable points to working GSL libraries
PKG_CPPFLAGS=-std=c++0x -Wall -pedantic -I$(LIB_GSL)/include -I. -I../inst/include
PKG_LIBS=-L$(LIB_GSL)/lib -lgsl -lgslcblas
The existence of configure.win in the package source tree forces only the main architecture to be built, R CMD check fails with a message like
<package> is not installed for architecture -- i386
unless --no-multi-arch is present. Since CRAN building process for windows checks both architectures (i386, and x64) , R CMD checks fail during CRAN submission process, even though local R CMD checks with -no-multi-arch may be successful.

How do I build sqlite with static library also be compiled with -fPIC?

I have compiled using below parameters
#./configure --prefix=/usr/local CFLAGS=-fPIC --enable-static --enable-shared \
CFLAGS="-g -O2 -DSQLITE_ENABLE_FTS3=1 \
-DSQLITE_ENABLE_COLUMN_METADATA=1 \
-DSQLITE_ENABLE_UNLOCK_NOTIFY=1 \
-DSQLITE_SECURE_DELETE=1 \
-DSQLITE_ENABLE_DBSTAT_VTAB=1"
# make -j 8
# make install
After using sqlite I get below error message:
/usr/bin/g++ -o utools/utools.so -Wl,-Bsymbolic -g -O2 -shared -Wl,-z,defs utools/utools.plugin.o utools/lib/libutools.a core/lib/libunv.a fv/lib/libfv.a sb/lib/libsb.a -lz -ldl
/usr/bin/ld: /usr/local/sqlite/lib/libsqlite3.a(sqlite3.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/sqlite/lib/libsqlite3.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
scons: *** [stdarm/stdarm.so] Error 1
scons: building terminated because of errors.
inside /usr/local/lib/ directory, deleting following files worked for me
libsqlite3.a
libsqlite3.la
libsqlite3.o.0.bak
libsqlite3.so
I think these files are from the older versions of libsqlite3,
because when you type and check dpkg -L libsqlite3-dev, none goes to /usr/local/lib/
I took the reference from sqlite3 breakage

libRInside.so: cannot open shared object file: No such file or directory

I installed distributed R sucessfully in Redhat linux 6.5. I am getting " libRInside.so: cannot open shared object file: No such file or directory" exception while trying to launch distributed R library?
Welcome to Stack Overflow!
Now:
What R version did you install, and how?
Did you install RInside as well? It is an add-on package
It depends on Rcpp too
When you have all your ducks in a row, it is as simple as just saying make in one of the eight (!!) example subdirectories. In standard we have over a dozen examples alone.
To create just one:
edd#max:~/git/rinside/inst/examples/standard(master)$ make rinside_sample0
g++ -I/usr/share/R/include \
-I/usr/local/lib/R/site-library/Rcpp/include \
-I/usr/local/lib/R/site-library/RInside/include \
-g -O2 -fstack-protector-strong -Wformat -Werror=format-security \
-D_FORTIFY_SOURCE=2 -g -O3 -Wall -pipe -Wno-unused -pedantic -Wall \
rinside_sample0.cpp -Wl,--export-dynamic -fopenmp \
-L/usr/lib/R/lib -lR -lpcre -llzma -lbz2 -lz -lrt -ldl -lm \
-lblas -llapack -L/usr/local/lib/R/site-library/RInside/lib -lRInside \
-Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib -o rinside_sample0
edd#max:~/git/rinside/inst/examples/standard(master)$ ./rinside_sample0
Hello, world!
edd#max:~/git/rinside/inst/examples/standard(master)$
The paths are specific to my Debian/Ubuntu system (and I added some linebreaks here for exposition) but this will work on any other sane system.

RInside and Rcpp in c++x11

I would like to use RInside in a c++x11 code to call R routine. By default, R seems to install a c++98 version of the library and thus the linking does not success. I wonder what are the different steps I should proceed to install c++x11 version of RInside (but I guess that I need to recompile all R/R package, is it ?) and if some more simple solution exists. Thanks in advance (I work on MacOs)
Update:
I reinstalled Rcpp and RInside doing (my Makevars is empty so c++98 version)
sudo R CMD INSTALL ~/Downloads/Rcpp_0.10.4.tar.gz
sudo R CMD INSTALL ~/Downloads/RInside_0.2.10.tar.gz
Then I compile the hello world example using (no cx11) :
clang++ -I/Library/Frameworks/R.framework/Versions/2.15/Headers/ -I/Library/Frameworks/R.framework/Versions/2.15/Resources/library/RInside/include/ -I/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include/ -c ../src/Gui/test.cc -o testOut.cc.o
clang++ testOut.cc.o -o testOut -L/Library/Frameworks/R.framework/Versions/2.15/Resources/library/RInside/lib/x86_64 -L/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/lib/x86_64 -framework R -lRInside -lRcpp
That produces me:
Hello, world!
However, by adding the x11 option:
clang++ -I/Library/Frameworks/R.framework/Versions/2.15/Headers/ -I/Library/Frameworks/R.framework/Versions/2.15/Resources/library/RInside/include/ -I/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include/ -c ../src/Gui/test.cc -o testOut.cc.o -stdlib=libc++ -std=c++11
clang++ testOut.cc.o -o testOut -L/Library/Frameworks/R.framework/Versions/2.15/Resources/library/RInside/lib/x86_64 -L/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/lib/x86_64 -framework R -lRInside -lRcpp -stdlib=libc++ -std=c++11
I get (when linking):
Undefined symbols for architecture x86_64:
"RInside::parseEvalQ(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
_main in testOut.cc.o
"RInside::operator[](std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
_main in testOut.cc.o
"Rcpp::Environment::assign(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, SEXPREC*) const", referenced from:
bool Rcpp::Environment::assign<char [15]>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [15]) const in testOut.cc.o
When recompiling Rcpp and RInside using c++x11 options
clang++ -I/Library/Frameworks/R.framework/Versions/2.15/Headers/ -I/Library/Frameworks/R.framework/Versions/2.15/Resources/library/RInside/include/ -I/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include/ -c ../src/Gui/test.cc -o testOut.cc.o -stdlib=libc++ -std=c++11
clang++ testOut.cc.o -o testOut -L/Library/Frameworks/R.framework/Versions/2.15/Resources/library/RInside/lib/x86_64 -L/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/lib/x86_64 -framework R -lRInside -lRcpp -stdlib=libc++ -std=c++11
liking is ok but ./test gives me a seg fault.
Add: my clang version is : Apple clang version 4.1 (tags/Apple/clang-421.11.66)
R is compiled with a c compiler. You don't necessarily need to use the same to build packages. So it is perfectly valid to use clang to compile add on packages. I have this in my ~/.R/Makevars file to use clang and C++11 for package:
CC=clang
CXX=clang++
CXXFLAGS= -stdlib=libc++ -std=c++11
Also, you might want to have a look at Rcpp11, a C++11 centric redesign of Rcpp. It probably would not be too hard to fork RInside to use Rcpp11 instead of Rcpp.
I am not aware of different linker requirements. What you have should just work. Otherwise please show your actual linking steps and errors, preferably in a reproducible way I could look at at my end too.
Witness the following. We first build with default flags:
edd#max:~/svn/rinside/pkg/inst/examples/standard$ grep ^CXXFLAGS ~/.R/Makevars
CXXFLAGS= -g -O3 -Wall -pipe -Wno-unused -pedantic # plain C++
edd#max:~/svn/rinside/pkg/inst/examples/standard$ make rinside_sample0
ccache g++-4.7 -I/usr/share/R/include \
-I/usr/local/lib/R/site-library/Rcpp/include \
-I/usr/local/lib/R/site-library/RInside/include -g -O3 -Wall \
-pipe -Wno-unused -pedantic -Wall \
rinside_sample0.cpp -L/usr/lib/R/lib -lR -lblas \
-llapack -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp \
-Wl,-rpath,/usr/local/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 rinside_sample0
edd#max:~/svn/rinside/pkg/inst/examples/standard$ ./rinside_sample0
Hello, world!
edd#max:~/svn/rinside/pkg/inst/examples/standard$
Now I am simply adding -std=c++11 to my CXXFLAGS:
edd#max:~/svn/rinside/pkg/inst/examples/standard$ grep ^CXXFLAGS ~/.R/Makevars
CXXFLAGS= -g -O3 -Wall -pipe -Wno-unused -pedantic -std=c++11
edd#max:~/svn/rinside/pkg/inst/examples/standard$
and remake the binary:
edd#max:~/svn/rinside/pkg/inst/examples/standard$ rm rinside_sample0
edd#max:~/svn/rinside/pkg/inst/examples/standard$ make rinside_sample0
ccache g++-4.7 -I/usr/share/R/include \
-I/usr/local/lib/R/site-library/Rcpp/include \
-I/usr/local/lib/R/site-library/RInside/include \
-g -O3 -Wall -pipe -Wno-unused \
-pedantic -std=c++11 -Wall \
rinside_sample0.cpp -L/usr/lib/R/lib -lR \
-lblas -llapack -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp \
-Wl,-rpath,/usr/local/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 rinside_sample0
edd#max:~/svn/rinside/pkg/inst/examples/standard$ ./rinside_sample0
Hello, world!
edd#max:~/svn/rinside/pkg/inst/examples/standard$
To deploy C++11, you do not need a new compiler or project.
Just add a single option to your compiler flags -- it is that easy.
And just to make it more plain, we can also add these three lines to rinside_sample0.cpp to make it a C++11 program:
auto magic = 42; // C++11
R["magic"] = magic;
R.parseEvalQ("print(magic)");
and (with the required -std=c++11 flag) it too builds and runs. Stricly no change required at the Rcpp or RInside end to deploy them with a C++11-capable compiler.

Resources