<div dir="ltr">Hi Pratibha,<div><br></div><div>I highly doubt that the segfault is related to the optimization level. FWIW, I still cannot replicate the segfault as you described -- Ubuntu 14.04, gcc 4.8.2, and...</div><div>
<br></div><div>Kevin<br></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Sep 3, 2014 at 12:34 PM, Pratibha Rana <span dir="ltr"><<a href="mailto:prana@vertica.com" target="_blank">prana@vertica.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think I got to the bottom of the issue. I was using the -O0 option<br>
instead of the -O2 option while compiling the code. Including the -O2<br>
option resolved the issue.<br>
<br>
Thanks<br>
Pratibha<br>
<br>
On 09/02/2014 04:49 PM, Dirk Eddelbuettel wrote:<br>
> Hi,<br>
><br>
> On 2 September 2014 at 20:16, Pratibha Rana wrote:<br>
> | Hi Dirk,<br>
> |<br>
> | Yes I work for Vertica which is apparent from my email. But I do not<br>
> | work on the distributedR project. I work on the vertica-R integration.<br>
><br>
> You could tell us about that too ...<br>
><br>
> | I acknowledge that it is a local issue because the same code works fine<br>
> | in the RInside's example directory on the same machine with the same<br>
> | libraries that I installed from sources. I verified the dll's being<br>
> | loaded in both the cases. The back trace doesn't help either. I am out<br>
> | of ideas as to what can be wrong. I am stumped as to why Rcpp::List<br>
> | works fine but Rcpp::DataFrame causes a segfault. Any suggestion on<br>
> | debugging the cause are greatly appreciated.<br>
><br>
> So you may be doing something different in the build process for your local<br>
> directory.  You need to work out what is different.<br>
><br>
> Can you please post this __on the list__ for a continued thread there?<br>
><br>
> Dirk<br>
><br>
> |<br>
> | Thanks<br>
> | Pratibha<br>
<div class="HOEnZb"><div class="h5">> | > Dear Pratibha,<br>
> | ><br>
> | > On 2 September 2014 at 19:22, Pratibha Rana wrote:<br>
> | > | I have a custom application that uses Rcpp and Rinside to execute R code. All<br>
> | ><br>
> | > [ Random thought: I might make people a bit more sympathetic for your cause<br>
> | > and questions if you pointed out that a) you are selling a db solution, b)<br>
> | > that these days Vertica is part of HP and c) the code for the R integration<br>
> | > is apparently on GitHub: <a href="https://github.com/vertica/DistributedR" target="_blank">https://github.com/vertica/DistributedR</a> (or at least<br>
> | > that is where I think it may be).  Why you guys never announced that here<br>
> | > is a bit of a mystery to me. ]<br>
> | ><br>
> | > | was well until I was using R-3.0.0, Rcpp 0.10.2 and RInside 0.2.10 but now its<br>
> | > | time to upgrade to the latest version and I can't get even the Rinside samples<br>
> | > | to work in place of my application. My machine has Ubuntu14.04.  The code<br>
> | ><br>
> | > Well, consider that<br>
> | ><br>
> | >   a) I (and others) develop on Ubuntu 14.04. Things work on Ubuntu 14.04<br>
> | ><br>
> | >   b) CRAN tests all packages on several backends, including Ubuntu, Debian,<br>
> | >      FC, OS X and Windows and would tell me (as maintainer) in no uncertain<br>
> | >      terms if it didn't work.<br>
> | ><br>
> | >   c) So if it fails to work for you, maybe assume a local issue first?<br>
> | ><br>
> | > | compiles fine but when I run it, I get a segfault during Rinside<br>
> | > | initialization.  I tried to troubleshoot by replacing my code by one of the<br>
> | > | examples rinside_sample0. The example runs fine as is but if I add just a<br>
> | > | single line "Rcpp::DataFrame p; " it segfaults again. Here is the complete<br>
> | > | code. The same code works fine inside the Rinside examples directory.<br>
> | > |<br>
> | > |<br>
> | > | #include <RInside.h><br>
> | > |<br>
> | > | int main(int argc, char *argv[])<br>
> | > | {<br>
> | > |<br>
> | > |  std::getchar();<br>
> | ><br>
> | > That line makes little sense. I omitted it.<br>
> | ><br>
> | > |<br>
> | > |  RInside R(argc, argv);<br>
> | > |<br>
> | > |  R["txt"] = "Hello, world!\n";<br>
> | > |  Rcpp::DataFrame pf;             <-------- Runs fine if I comment out this line.<br>
> | > |  R.parseEvalQ("cat(txt)");<br>
> | > |<br>
> | > |  exit(0);<br>
> | > | }<br>
> | ><br>
> | > Works fine here:<br>
> | ><br>
> | > edd@max:~/git/rinside/inst/examples/standard$ cat rinside_vertica.cpp<br>
> | ><br>
> | > #include <RInside.h><br>
> | ><br>
> | > int main(int argc, char *argv[])<br>
> | > {<br>
> | ><br>
> | >   RInside R(argc, argv);<br>
> | ><br>
> | >   R["txt"] = "Hello, world!\n";<br>
> | >   Rcpp::DataFrame pf;    //         <-------- Runs fine if I comment out this line.<br>
> | >   R.parseEvalQ("cat(txt)");<br>
> | ><br>
> | >   exit(0);<br>
> | > }<br>
> | > edd@max:~/git/rinside/inst/examples/standard$ make rinside_vertica<br>
> | > ccache g++-4.8 -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 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -O3 -Wall -pipe -Wno-unused -pedantic -Wall    rinside_vertica.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_vertica<br>

> | > edd@max:~/git/rinside/inst/examples/standard$ ./rinside_vertica<br>
> | > Hello, world!<br>
> | > edd@max:~/git/rinside/inst/examples/standard$<br>
> | ><br>
> | ><br>
> | > I maybe running github versions of Rcpp and/or RInside, but the only thing<br>
> | > that may matter is that you probably should<br>
> | ><br>
> | >  a) install Rcpp from source<br>
> | >  b) install RInside from source<br>
> | ><br>
> | > and then build these examples.<br>
> | ><br>
> | > A reproducible issue may help.  This was not reproducible.  Or rather, this<br>
> | > may not even have been a bug.<br>
> | ><br>
> | > Regards,  Dirk<br>
> | ><br>
> | ><br>
> | > | Here is the backtrace of the segfault<br>
> | > |<br>
> | > |<br>
> | > | Program received signal SIGSEGV, Segmentation fault.<br>
> | > | 0x00007ffff7597767 in reset_current_error() () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so<br>
> | > | (gdb) bt -10<br>
> | > | #261636 0x00007ffff7597769 in reset_current_error() () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so<br>
> | > | #261637 0x00007ffff7597769 in reset_current_error() () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so<br>
> | > | #261638 0x00007ffff7597769 in reset_current_error() () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so<br>
> | > | #261639 0x00007ffff7597769 in reset_current_error() () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so<br>
> | > | #261640 0x00007ffff7598530 in Rcpp::Rcpp_eval(SEXPREC*, SEXPREC*) () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so<br>
> | > | #261641 0x00007ffff7599542 in Rcpp::Language_Impl<Rcpp::PreserveStorage>::eval() const () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so<br>
> | > | #261642 0x00007ffff75969c7 in RInside::autoloads() () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so<br>
> | > | #261643 0x00007ffff7595fd3 in RInside::initialize(int, char const* const*, bool, bool, bool) () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so<br>
> | > | #261644 0x00007ffff7595a4a in RInside::RInside(int, char const* const*, bool, bool, bool) () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so<br>
> | > | #261645 0x000000000040361e in main (argc=1, argv=0x7fffffffdc88) at rinside_sample0.cpp:14<br>
> | > | (gdb)<br>
> | > |<br>
> | > |<br>
> | > |<br>
> | > |<br>
> | > | I also looked at the libraries that were being loaded at runtime and they are<br>
> | > | exactly the same for both the rinside examples and my app. Pasted below for<br>
> | > | completeness. I am out ofdebugging tricks to get this to work. Any ideas as to<br>
> | > | what's wrong. what am I missing?<br>
> | > |<br>
> | > |<br>
> | > | prana:trunk/third-party/install/lib/R/library/RInside/examples/standard $ cat /proc/21915/maps | awk '{print $6}' | grep '\.so' | sort | uniq<br>
> | > | /home/prana/trunk/third-party/install/lib/R/lib/libRblas.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/lib/libRlapack.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/lib/libR.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/library/graphics/libs/graphics.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/library/grDevices/libs/grDevices.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/library/methods/libs/methods.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/library/Rcpp/libs/Rcpp.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/library/stats/libs/stats.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/library/utils/libs/utils.so<br>
> | > | /lib/x86_64-linux-gnu/<a href="http://ld-2.19.so" target="_blank">ld-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libc-2.19.so" target="_blank">libc-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libdl-2.19.so" target="_blank">libdl-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/libgcc_s.so.1<br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libm-2.19.so" target="_blank">libm-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libnsl-2.19.so" target="_blank">libnsl-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libnss_compat-2.19.so" target="_blank">libnss_compat-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libnss_files-2.19.so" target="_blank">libnss_files-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libnss_nis-2.19.so" target="_blank">libnss_nis-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libpthread-2.19.so" target="_blank">libpthread-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://librt-2.19.so" target="_blank">librt-2.19.so</a><br>
> | > | /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0<br>
> | > | /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0<br>
> | > | /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0<br>
> | > | /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19<br>
> | > |<br>
> | > |<br>
> | > | prana:trunk/myapp $ cat /proc/21730/maps | awk '{print $6}' | grep '\.so' | sort | uniq<br>
> | > | /home/prana/trunk/third-party/install/lib/R/lib/libRblas.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/lib/libRlapack.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/lib/libR.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/library/graphics/libs/graphics.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/library/grDevices/libs/grDevices.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/library/methods/libs/methods.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/library/Rcpp/libs/Rcpp.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/library/stats/libs/stats.so<br>
> | > | /home/prana/trunk/third-party/install/lib/R/library/utils/libs/utils.so<br>
> | > | /lib/x86_64-linux-gnu/<a href="http://ld-2.19.so" target="_blank">ld-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libc-2.19.so" target="_blank">libc-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libdl-2.19.so" target="_blank">libdl-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/libgcc_s.so.1<br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libm-2.19.so" target="_blank">libm-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libnsl-2.19.so" target="_blank">libnsl-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libnss_compat-2.19.so" target="_blank">libnss_compat-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libnss_files-2.19.so" target="_blank">libnss_files-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libnss_nis-2.19.so" target="_blank">libnss_nis-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://libpthread-2.19.so" target="_blank">libpthread-2.19.so</a><br>
> | > | /lib/x86_64-linux-gnu/<a href="http://librt-2.19.so" target="_blank">librt-2.19.so</a><br>
> | > | /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0<br>
> | > | /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0<br>
> | > | /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0<br>
> | > | /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19<br>
> | > |<br>
> | > |<br>
> | > |<br>
> | > |<br>
> | > | Thanks<br>
> | > | Pratibha<br>
> | > | _______________________________________________<br>
> | > | Rcpp-devel mailing list<br>
> | > | <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
> | > | <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
> | ><br>
> |<br>
><br>
<br>
_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
</div></div></blockquote></div><br></div>