[Rcpp-devel] Compiler seg fault with Rcpp 0.9.7

Ian Fellows ian.fellows at stat.ucla.edu
Wed Oct 5 20:32:00 CEST 2011


Hi All,

I am getting a compiler seg fault with 0.9.6 and 0.9.7, however the error does not occur in 0.9.4.

When running R CMD INSTALL the following error is given:

util.h: In function 'Rcpp::XPtr<Class, standard_delete_finalizer<Class> > gergm::unwrap_robject(SEXPREC* const&) [with T = gergm::BinaryNet<gergm::Directed>]':
util.h:30: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make: *** [rcpp_module.o] Error 1
ERROR: compilation failed for package 'gergm'
* removing '/Library/Frameworks/R.framework/Versions/2.13/Resources/library/gergm'
* restoring previous '/Library/Frameworks/R.framework/Versions/2.13/Resources/library/gergm'


The offending function:

template<class T>
XPtr<T> unwrap_robject(const SEXP& sexp){
	RObject ro(sexp);
	if(ro.isObject()){
		Language call("as.environment",sexp);
		SEXP ev = call.eval();
		Language call1("get",".pointer",-1,ev);
		SEXP ev1 = call1.eval();
		XPtr<T > xp(ev1);
		return xp;
	}else{
		XPtr<T > xp(sexp);
		return xp;
	}
}


Any thoughts on what could be causing this?

R version 2.13.0 Patched (2011-05-19 r55960)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)


Best,
Ian




On Oct 5, 2011, at 3:00 AM, rcpp-devel-request at r-forge.wu-wien.ac.at wrote:

> Send Rcpp-devel mailing list submissions to
> 	rcpp-devel at lists.r-forge.r-project.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
> 
> or, via email, send a message with subject or body 'help' to
> 	rcpp-devel-request at lists.r-forge.r-project.org
> 
> You can reach the person managing the list at
> 	rcpp-devel-owner at lists.r-forge.r-project.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Rcpp-devel digest..."
> 
> 
> Today's Topics:
> 
>   1. inheritance (Richard Downe)
>   2. C++ code for ordinary differential equations (Douglas Bates)
>   3. Re: inheritance (Dirk Eddelbuettel)
>   4. Re: inheritance (Richard Downe)
>   5. Re: inheritance (Dirk Eddelbuettel)
>   6. Re: inheritance (Richard Downe)
>   7. Re: inheritance (Dirk Eddelbuettel)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Tue, 4 Oct 2011 16:29:21 -0500
> From: Richard Downe <richard-downe at uiowa.edu>
> Subject: [Rcpp-devel] inheritance
> To: <rcpp-devel at lists.r-forge.r-project.org>
> Message-ID: <4E8B7AB1.9060705 at uiowa.edu>
> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed
> 
> Is it possible to have a class wrapped in rcpp inherit directly from a 
> superclass?
> E.g., I have
> 
>     class_<tcfaIndices>( "tcfaIndices" )
> 
>         .constructor<long>()
> 
>         .method("SetTCFADefinition", &tcfaIndices::SetTCFADefinition)
>         .method("getTCFALabels", &tcfaIndices::getTCFALabels)
> 
>         ;
> 
> and
> 
>     class_<morphologyIndices>( "morphologyIndices" )
> 
>     .constructor<long>()
> 
>         .method("getCentroidLumen", &morphologyIndices::getCentroidLumen)
>         .method("getCentroidAdventitia", 
> &morphologyIndices::getCentroidAdventitia)
> 
>         ;
> 
> where the c++ class tcfaIndices inherits from c++ class morphologyIndices.
> I get compiler errors that suggest this is impossible (they seem to show 
> up surrounding the cascade of calls to constructors), but was curious as 
> to if there's a way to do this (other than, say, introducing 1 more 
> level of abstraction, and then inserting a member variable rather than a 
> parent class...)
> --rd
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Tue, 4 Oct 2011 17:05:49 -0500
> From: Douglas Bates <bates at stat.wisc.edu>
> Subject: [Rcpp-devel] C++ code for ordinary differential equations
> To: rcpp-devel <Rcpp-devel at r-forge.wu-wien.ac.at>
> Message-ID:
> 	<CAO7JsnSzTMapTaeNurkaWG2AES1J=LkgtfBDmy_M2kcGJ8wKwQ at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> I am working with pharmacokinetic/pharmacodynamic models, some of
> which can only be represented as the solutions of ordinary
> differential equations.  I am looking for ODE sofware written in C++.
> The deSolve package for R has lots of wonderful functions but I may
> want to take things apart a bit and I really don't have the patience
> for wading through Fortran code to try to discover what it is doing.
> 
> I can, of course, google likely phrases but if anyone has experience
> with such solvers and can make any recommendations I would appreciate
> it (off-list responses are probably better than on-list)
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Tue, 4 Oct 2011 17:23:42 -0500
> From: Dirk Eddelbuettel <edd at debian.org>
> Subject: Re: [Rcpp-devel] inheritance
> To: Richard Downe <richard-downe at uiowa.edu>
> Cc: rcpp-devel at r-forge.wu-wien.ac.at
> Message-ID: <20107.34670.298660.71093 at max.nulle.part>
> Content-Type: text/plain; charset=us-ascii
> 
> 
> Richard,
> 
> Welcome!
> 
> On 4 October 2011 at 16:29, Richard Downe wrote:
> | Is it possible to have a class wrapped in rcpp inherit directly from a 
> | superclass?
> | E.g., I have
> | 
> |      class_<tcfaIndices>( "tcfaIndices" )
> | 
> |          .constructor<long>()
> | 
> |          .method("SetTCFADefinition", &tcfaIndices::SetTCFADefinition)
> |          .method("getTCFALabels", &tcfaIndices::getTCFALabels)
> | 
> |          ;
> | 
> | and
> | 
> |      class_<morphologyIndices>( "morphologyIndices" )
> | 
> |      .constructor<long>()
> | 
> |          .method("getCentroidLumen", &morphologyIndices::getCentroidLumen)
> |          .method("getCentroidAdventitia", 
> | &morphologyIndices::getCentroidAdventitia)
> | 
> |          ;
> | 
> | where the c++ class tcfaIndices inherits from c++ class morphologyIndices.
> | I get compiler errors that suggest this is impossible (they seem to show 
> | up surrounding the cascade of calls to constructors), but was curious as 
> | to if there's a way to do this (other than, say, introducing 1 more 
> | level of abstraction, and then inserting a member variable rather than a 
> | parent class...)
> 
> Rcpp itself is open to mulitple inheritance.
> 
> Rcpp modules, which your question appears to be concerned with, currently
> cannot as discussed a few times on this list.  You find perusing the list
> archives informative.
> 
> Hth, Dirk
> 
> -- 
> New Rcpp master class for R and C++ integration is scheduled for 
> San Francisco (Oct 8), more details / reg.info available at
> http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Tue, 4 Oct 2011 17:29:09 -0500
> From: Richard Downe <richard-downe at uiowa.edu>
> Subject: Re: [Rcpp-devel] inheritance
> To: Dirk Eddelbuettel <edd at debian.org>
> Cc: rcpp-devel at r-forge.wu-wien.ac.at
> Message-ID: <4E8B88B5.9080006 at uiowa.edu>
> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed
> 
> I'm fairly sure I'm not doing anything at all with multiple 
> inheritance.  This is a single instance of single inheritance.
> I will peruse the list; what I had seen in my searches so far had 
> suggested no conclusive answer.
> --rd
> 
> On 10/04/2011 05:23 PM, Dirk Eddelbuettel wrote:
>> Richard,
>> 
>> Welcome!
>> 
>> On 4 October 2011 at 16:29, Richard Downe wrote:
>> | Is it possible to have a class wrapped in rcpp inherit directly from a
>> | superclass?
>> | E.g., I have
>> |
>> |      class_<tcfaIndices>( "tcfaIndices" )
>> |
>> |          .constructor<long>()
>> |
>> |          .method("SetTCFADefinition",&tcfaIndices::SetTCFADefinition)
>> |          .method("getTCFALabels",&tcfaIndices::getTCFALabels)
>> |
>> |          ;
>> |
>> | and
>> |
>> |      class_<morphologyIndices>( "morphologyIndices" )
>> |
>> |      .constructor<long>()
>> |
>> |          .method("getCentroidLumen",&morphologyIndices::getCentroidLumen)
>> |          .method("getCentroidAdventitia",
>> |&morphologyIndices::getCentroidAdventitia)
>> |
>> |          ;
>> |
>> | where the c++ class tcfaIndices inherits from c++ class morphologyIndices.
>> | I get compiler errors that suggest this is impossible (they seem to show
>> | up surrounding the cascade of calls to constructors), but was curious as
>> | to if there's a way to do this (other than, say, introducing 1 more
>> | level of abstraction, and then inserting a member variable rather than a
>> | parent class...)
>> 
>> Rcpp itself is open to mulitple inheritance.
>> 
>> Rcpp modules, which your question appears to be concerned with, currently
>> cannot as discussed a few times on this list.  You find perusing the list
>> archives informative.
>> 
>> Hth, Dirk
>> 
> 
> 
> 
> ------------------------------
> 
> Message: 5
> Date: Tue, 4 Oct 2011 17:52:40 -0500
> From: Dirk Eddelbuettel <edd at debian.org>
> Subject: Re: [Rcpp-devel] inheritance
> To: Richard Downe <richard-downe at uiowa.edu>
> Cc: rcpp-devel at r-forge.wu-wien.ac.at
> Message-ID: <20107.36408.998788.138533 at max.nulle.part>
> Content-Type: text/plain; charset=us-ascii
> 
> 
> On 4 October 2011 at 17:29, Richard Downe wrote:
> | I'm fairly sure I'm not doing anything at all with multiple 
> | inheritance.  This is a single instance of single inheritance.
> 
> My bad, sloppy language here.  
> 
> I think I meant to say that Rcpp modules does what is in the vignette: easy
> access to simple data structures, so no inheritance whatsoever at the moment.
> That is of course a bit of a restriction...
> 
> | I will peruse the list; what I had seen in my searches so far had 
> | suggested no conclusive answer.
> 
> Thanks. I also inadvertently dropped a 'may' in my reply.
> 
> Dirk
> 
> | --rd
> | 
> | On 10/04/2011 05:23 PM, Dirk Eddelbuettel wrote:
> | > Richard,
> | >
> | > Welcome!
> | >
> | > On 4 October 2011 at 16:29, Richard Downe wrote:
> | > | Is it possible to have a class wrapped in rcpp inherit directly from a
> | > | superclass?
> | > | E.g., I have
> | > |
> | > |      class_<tcfaIndices>( "tcfaIndices" )
> | > |
> | > |          .constructor<long>()
> | > |
> | > |          .method("SetTCFADefinition",&tcfaIndices::SetTCFADefinition)
> | > |          .method("getTCFALabels",&tcfaIndices::getTCFALabels)
> | > |
> | > |          ;
> | > |
> | > | and
> | > |
> | > |      class_<morphologyIndices>( "morphologyIndices" )
> | > |
> | > |      .constructor<long>()
> | > |
> | > |          .method("getCentroidLumen",&morphologyIndices::getCentroidLumen)
> | > |          .method("getCentroidAdventitia",
> | > |&morphologyIndices::getCentroidAdventitia)
> | > |
> | > |          ;
> | > |
> | > | where the c++ class tcfaIndices inherits from c++ class morphologyIndices.
> | > | I get compiler errors that suggest this is impossible (they seem to show
> | > | up surrounding the cascade of calls to constructors), but was curious as
> | > | to if there's a way to do this (other than, say, introducing 1 more
> | > | level of abstraction, and then inserting a member variable rather than a
> | > | parent class...)
> | >
> | > Rcpp itself is open to mulitple inheritance.
> | >
> | > Rcpp modules, which your question appears to be concerned with, currently
> | > cannot as discussed a few times on this list.  You find perusing the list
> | > archives informative.
> | >
> | > Hth, Dirk
> | >
> | 
> 
> -- 
> New Rcpp master class for R and C++ integration is scheduled for 
> San Francisco (Oct 8), more details / reg.info available at
> http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php
> 
> 
> ------------------------------
> 
> Message: 6
> Date: Tue, 4 Oct 2011 19:53:13 -0500
> From: Richard Downe <richard-downe at uiowa.edu>
> Subject: Re: [Rcpp-devel] inheritance
> To: Dirk Eddelbuettel <edd at debian.org>
> Cc: rcpp-devel at r-forge.wu-wien.ac.at
> Message-ID: <4E8BAA79.6030604 at uiowa.edu>
> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed
> 
> Since I'm a bit of a glutton for punishment, and I would like to see 
> this feature...are there major technical hurdles as to why this has not 
> been implemented (e.g., I should just give up and find another way), or 
> is it more just a "nobody's gotten around to it because it's good enough 
> how it is", where I might be able to change the situation?
> --rd
> 
> On 10/04/2011 05:52 PM, Dirk Eddelbuettel wrote:
>> On 4 October 2011 at 17:29, Richard Downe wrote:
>> | I'm fairly sure I'm not doing anything at all with multiple
>> | inheritance.  This is a single instance of single inheritance.
>> 
>> My bad, sloppy language here.
>> 
>> I think I meant to say that Rcpp modules does what is in the vignette: easy
>> access to simple data structures, so no inheritance whatsoever at the moment.
>> That is of course a bit of a restriction...
>> 
>> | I will peruse the list; what I had seen in my searches so far had
>> | suggested no conclusive answer.
>> 
>> Thanks. I also inadvertently dropped a 'may' in my reply.
>> 
>> Dirk
>> 
>> | --rd
>> |
>> | On 10/04/2011 05:23 PM, Dirk Eddelbuettel wrote:
>> |>  Richard,
>> |>
>> |>  Welcome!
>> |>
>> |>  On 4 October 2011 at 16:29, Richard Downe wrote:
>> |>  | Is it possible to have a class wrapped in rcpp inherit directly from a
>> |>  | superclass?
>> |>  | E.g., I have
>> |>  |
>> |>  |      class_<tcfaIndices>( "tcfaIndices" )
>> |>  |
>> |>  |          .constructor<long>()
>> |>  |
>> |>  |          .method("SetTCFADefinition",&tcfaIndices::SetTCFADefinition)
>> |>  |          .method("getTCFALabels",&tcfaIndices::getTCFALabels)
>> |>  |
>> |>  |          ;
>> |>  |
>> |>  | and
>> |>  |
>> |>  |      class_<morphologyIndices>( "morphologyIndices" )
>> |>  |
>> |>  |      .constructor<long>()
>> |>  |
>> |>  |          .method("getCentroidLumen",&morphologyIndices::getCentroidLumen)
>> |>  |          .method("getCentroidAdventitia",
>> |>  |&morphologyIndices::getCentroidAdventitia)
>> |>  |
>> |>  |          ;
>> |>  |
>> |>  | where the c++ class tcfaIndices inherits from c++ class morphologyIndices.
>> |>  | I get compiler errors that suggest this is impossible (they seem to show
>> |>  | up surrounding the cascade of calls to constructors), but was curious as
>> |>  | to if there's a way to do this (other than, say, introducing 1 more
>> |>  | level of abstraction, and then inserting a member variable rather than a
>> |>  | parent class...)
>> |>
>> |>  Rcpp itself is open to mulitple inheritance.
>> |>
>> |>  Rcpp modules, which your question appears to be concerned with, currently
>> |>  cannot as discussed a few times on this list.  You find perusing the list
>> |>  archives informative.
>> |>
>> |>  Hth, Dirk
>> |>
>> |
>> 
> 
> 
> 
> ------------------------------
> 
> Message: 7
> Date: Tue, 4 Oct 2011 23:14:11 -0500
> From: Dirk Eddelbuettel <edd at debian.org>
> Subject: Re: [Rcpp-devel] inheritance
> To: Richard Downe <richard-downe at uiowa.edu>
> Cc: rcpp-devel at r-forge.wu-wien.ac.at
> Message-ID: <20107.55699.488782.896480 at max.nulle.part>
> Content-Type: text/plain; charset=us-ascii
> 
> 
> On 4 October 2011 at 19:53, Richard Downe wrote:
> | Since I'm a bit of a glutton for punishment, and I would like to see 
> | this feature...are there major technical hurdles as to why this has not 
> | been implemented (e.g., I should just give up and find another way), or 
> | is it more just a "nobody's gotten around to it because it's good enough 
> | how it is", where I might be able to change the situation?
> 
> "Health warning: Template meta-programming may make your head explode."
> 
> It is mostly "just really hard". Try to find the old posts by Romain and go
> from there.
> 
> We all would like the feature, but it takes some determination so make it
> happen. So far Romain has pretty much pushed the Rcpp modules implementation
> all by himself.
> 
> Dirk
> 
> -- 
> New Rcpp master class for R and C++ integration is scheduled for 
> San Francisco (Oct 8), more details / reg.info available at
> http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php
> 
> 
> ------------------------------
> 
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
> 
> End of Rcpp-devel Digest, Vol 24, Issue 5
> *****************************************
> 



More information about the Rcpp-devel mailing list