[Rcpp-devel] qtdensity example build problem
Jarny Choi
jarny.choi at gmail.com
Tue May 8 02:36:51 CEST 2012
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?
Thanks again for your help,
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.)
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
>
More information about the Rcpp-devel
mailing list