[Rcpp-devel] why segmentation fault happens when I was trying to run complied examples in RInside "standard" folder

Cong Li solvercorleone at gmail.com
Tue Dec 4 16:16:49 CET 2012


Hi Dirk,

The problem has been solved after I downloaded Rcpp from svn repository,
and build it on my computer.

Thank you for your help

Cong Li

On Tue, Dec 4, 2012 at 11:52 PM, Dirk Eddelbuettel <edd at debian.org> wrote:

>
> On 4 December 2012 at 23:33, Cong Li wrote:
> | Hi, Dirk
> |
> | Ok, I see. I will try it.
> | Thank you very much.
> | And I am sorry for relying on the wrong place.
>
> Thanks -- and here is a cleaner diff from rev4047.
>
> I found/fixed that very shortly after we rolled 0.10.2 (which fixed a real
> rather than cosmetic error and had to be released).
>
> As we said, this is purely cosmetic but a little irratice. Just rebuild
> Rcpp
> with thus small change and all is well.
>
> Dirk
>
>
> Modified: pkg/Rcpp/inst/include/Rcpp/iostream/Rostream.h
> ===================================================================
> --- pkg/Rcpp/inst/include/Rcpp/iostream/Rostream.h      2012-11-27
> 01:34:59 UTC (rev 4046)
> +++ pkg/Rcpp/inst/include/Rcpp/iostream/Rostream.h      2012-11-27
> 14:21:42 UTC (rev 4047)
> @@ -38,7 +38,12 @@
>              std::ostream( new Rstreambuf(output) ),
>              buf( static_cast<Rstreambuf*>( rdbuf() ) )
>          {}
> -        ~Rostream(){ delete buf ; }
> +        ~Rostream() {
> +            if (buf != NULL) {
> +                delete buf;
> +                buf = NULL;
> +            }
> +        }
>      };
>
>      // declare global variable
>
>
> |
> | Cong Li
> |
> | On Tue, Dec 4, 2012 at 9:51 PM, Dirk Eddelbuettel <edd at debian.org>
> wrote:
> |
> |
> |     Please reply on-list.
> |
> |     On 4 December 2012 at 21:37, Cong Li wrote:
> |     | Hi Dirk
> |     |
> |     | Thank you very much for your answer. It really helps.
> |     |
> |     | I want to call R from C++ in my project. If this is only a problem
> of R
> |     version
> |     | conflict,
> |     | could I just ignore this "segmentation fault" info for the time
> being,
> |     since I
> |     | found that it seemed to impose no negative effect on c++ part,
> besides R
> |     | calling, of my program(based on my experiment)?
> |
> |     Yes indeed, see my follow-up on-list. Or you could quickly rebuild
> Rcpp
> |     using
> |     this version of the Rostream destructor:
> |
> |             ~Rostream() {
> |                 if (buf != NULL) {
> |                     delete buf;
> |                     buf = NULL;
> |                 }
> |             }
> |
> |     Dirk
> |
> |     | I am looking forward to the new version releasing, and thank you
> for your
> |     | excellent jobs.
> |     |
> |     | Best Regards
> |     |
> |     | Cong Li
> |     |
> |     | On Tue, Dec 4, 2012 at 9:12 PM, Dirk Eddelbuettel <edd at debian.org>
> wrote:
> |     |
> |     |
> |     |     Hi Cong,
> |     |
> |     |     On 4 December 2012 at 19:15, Cong Li wrote:
> |     |     | Hi guys
> |     |     |
> |     |     | I am a novice to RInside, and I met a problem when trying to
> run
> |     RInside
> |     |     | example in "standard" folder.
> |     |     |
> |     |     | It is that a segmentation fault error happened every time
> when I
> |     was
> |     |     trying to
> |     |     | execute the compiled example program in the "standard"
> folder. My
> |     OS is
> |     |     ubuntu
> |     |     | 12.04, and I am using R 2.15.2 and g++ 4.6.3.
> |     |     |
> |     |     | It seems that the executions of the examples were fine, but
> |     somehow
> |     |     errors
> |     |     | happened when then main function was trying to return.
> |     |     |
> |     |     | Can someone help me with this issue.
> |     |
> |     |     It is a change in R 2.15.2 which requires a change in RInside
> which
> |     I have
> |     |     yet to release (as another, unrelated, error) is holding this
> back.
> |      If
> |     |     you
> |     |     use R 2.15.1 it all works too.
> |     |
> |     |     Sorry for this, and the new RInside should be there "soon", or
> I
> |     should at
> |     |     least commit my fixes to SVN.
> |     |
> |     |     Dirk
> |     |
> |     |     --
> |     |     Dirk Eddelbuettel | edd at debian.org |
> http://dirk.eddelbuettel.com
> |     |
> |     |
> |
> |     --
> |     Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
> |
> |
>
> --
> Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20121205/5e749cfb/attachment-0001.html>


More information about the Rcpp-devel mailing list