[Rcpp-devel] qtdensity example build problem

Dirk Eddelbuettel edd at debian.org
Tue May 8 04:53:04 CEST 2012


On 8 May 2012 at 12:47, Jarny Choi wrote:
| I've managed to fix the problem by re-installing RInside from CRAN
| (sources), rather than from CRAN (binaries) (using the package installer in R
| Gui). So perhaps there is a problem with the binary version?

My meek excuse is the lack of an OS X box to work on, and a co-author who
usually takes care of OS X issues (though we haven't seen too much of Romain
lately). 

At some point in the past I think we did tell folks to install from source on
OS X.  But now I can't quite recall whether that was for Rcpp, RInside or both.

|  At any rate, now
| I've got RInside/lib/x86_64/ directory with libRInside.a and libRInside.dylib
| files in it, and the example builds and runs! 

Fabulous!!  

I didn't mean to discourage earlier ... but that may be a first too.  Did you
have to do anything special for your Qt build on OS X?  From source as well?

It's a simple example, but it is kinda neat how the chart updates as you
slide the density.  And it is a nice existence proof:  Yes we can have nice
looking modern apps with rigorous statistical computing inside it.

So thanks for being persistent on OS X.

Cheers,  Dirk


| Cheers,
| Jarny
| 
| On 08/05/2012, at 11:09 AM, Dirk Eddelbuettel wrote:
| 
| > 
| > On 8 May 2012 at 10:36, Jarny Choi wrote:
| > | Thanks, Dirk. Looks like that R function RInsideLdPath is returning null for RInside which propagates the issue downstream. Here's what I've found out:
| > | 
| > | > .Platform$r_arch
| > | [1] "x86_64"
| > | > system.file("lib",.Platform$r_arch,package="RInside")
| > | [1] ""
| > | 
| > | This happens because /Library/Frameworks/R.framework/Versions/2.15/Resources/library/RInside/lib/x86_64 does not exist, and system.file checks for the existence of that path before returning null if it doesn't exist. Should that directory exist after RInside installation?
| > 
| > I am never quite sure with OS X as I don't have a box.  Did you build RInside
| > from source yourself, or did you install from CRAN?  Could you try 'the other
| > way' just in case?
| > 
| > | Thanks again for your help,
| > 
| > It would help me tremendously if you could debug a little at your, especially
| > as you should be able to compare everything with the corresponding files /
| > functions for Rcpp -- we really just carried the working scheme over to RInside.
| > 
| > | Jarny
| > | (I accidentally subscribed to the list using my other email so just used the reply-to field to tell mailman not to reject my message in the previous post. I've changed the email now.)
| > 
| > Oh, got it -- no problem.  Sorry for the bother but easier for all of us to
| > make initial posting that bit harder to keep spam down...
| > 
| > Dirk
| > 
| > | 
| > | On 08/05/2012, at 12:15 AM, Dirk Eddelbuettel wrote:
| > | > That could very well be a bug on OS X.  As I do not have an OS X box, I can't
| > | > test this.  So could you poke around locally?  
| > | > 
| > | > The code looks pretty innocent:
| > | > 
| > | > ## Use R's internal knowledge of path settings to find the lib/ directory
| > | > ## plus optinally an arch-specific directory on system building multi-arch
| > | > RInsideLdPath <- function() {
| > | >   if (nzchar(.Platform$r_arch)) {     ## eg amd64, ia64, mips
| > | >       system.file("lib",.Platform$r_arch,package="RInside")
| > | >   } else {
| > | >       system.file("lib",package="RInside")
| > | >   }
| > | > }
| > | > 
| > | > What does that function return for you?  And what does .Platform$r_arch say?
| > | > Are we by chance in the 'true' branch of that if statement?   And on the
| > | > other hand, very similar code is used for Rcpp.
| > | > 
| > | > And that 'RInsideLdPath' function is used here to initialize rinsidedir:
| > | > 
| > | > ## Provide linker flags -- i.e. -L/path/to/libRInside -- as well as an
| > | > ## optional rpath call needed to tell the Linux dynamic linker about the
| > | > ## location.  This is not needed on OS X where we encode this as library
| > | > ## built time (see src/Makevars) or Windows where we use a static library
| > | > ## Updated Jan 2010:  We now default to static linking but allow the use
| > | > ##                    of rpath on Linux if static==FALSE has been chosen
| > | > ##                    Note that this is probably being called from LdFlags()
| > | > RInsideLdFlags <- function(static=TRUE) {
| > | >   rinsidedir <- RInsideLdPath()
| > | >   if (static) {                               # static is default on Windows and OS X
| > | >       flags <- paste(rinsidedir, "/libRInside.a", sep="")
| > | >       if (.Platform$OS.type=="windows") {
| > | >           flags <- shQuote(flags)
| > | >       }
| > | >   } else {					# else for dynamic linking
| > | >       flags <- paste("-L", rinsidedir, " -lRInside", sep="") # baseline setting
| > | >       if ((.Platform$OS.type == "unix") &&    # on Linux, we can use rpath to encode path
| > | >           (length(grep("^linux",R.version$os)))) {
| > | >           flags <- paste(flags, " -Wl,-rpath,", rinsidedir, sep="")
| > | >       }
| > | >   }
| > | >   invisible(flags)
| > | > }
| > | > 
| > | > 
| > | > And that function is used by the one you called:
| > | > 
| > | > 
| > | > ## LdFlags defaults to static linking on the non-Linux platforms Windows and OS X
| > | > LdFlags <- function(static=ifelse(length(grep("^linux",R.version$os))==0, TRUE, FALSE)) {
| > | >   cat(RInsideLdFlags(static=static))
| > | > }
| > | > 
| > | > 
| > | > Your help is appreciated.
| > | > 
| > | > Cheers, Dirk
| > | > 
| > | 
| > | _______________________________________________
| > | 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
| > 
| > -- 
| > R/Finance 2012 Conference on May 11 and 12, 2012 at UIC in Chicago, IL
| > See agenda, registration details and more at http://www.RinFinance.com
| 
| _______________________________________________
| 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

-- 
R/Finance 2012 Conference on May 11 and 12, 2012 at UIC in Chicago, IL
See agenda, registration details and more at http://www.RinFinance.com


More information about the Rcpp-devel mailing list