[R-SIG-Mac] Compiling problem:

Simon Urbanek simon.urbanek at r-project.org
Sun Jul 11 18:56:46 CEST 2010


On Jul 10, 2010, at 4:55 PM, Conrad Stack wrote:

> Hello fellows,
> 
> I'm currently developing an R package and having some trouble getting it to
> install on Mac OS (the build process works fine on Windows 7 and Ubuntu 10).
> The little prototype that I'm trying to get working compiles a large amount
> of C++ code which is connected to R via Rcpp (0.8.2).  The C++ is compiled
> using autoconfig scripts into a static library which is used in Makevars (in
> the src directory).  Here is the relevant Makevars line (where libBrownie is
> the static library just compiled):
> 
> PKG_LIBS=-s -L. -L./brownie_src -lBrownie -lR -lgsl -lgslcblas -lm
>> /opt/local/lib/R/library/Rcpp/lib/libRcpp.a
> 

That sounds like a lot of trouble in itself (you should not include any R flags since that can break and -lR is not what's used on OS X; -s it bad as well and static libraries are better linked using their name since they have lower priority in -l). But it could be really anything including bugs in your package, so without the actual package I fear we can't help you much.



> This step seems to work fine and if I run the ./configure script which is generated from the autoconfig file,

More trouble - you should never run configure by hand because it will likely use wrong settings (unless it is written such that it attempts to find R and run it to get flags)  - R CMD INSTALL is what you need to use so the correct architecture, compilers and flags are setup.

Cheers,
Simon



> the library builds properly on Mac OS.
> The problem manifests when installing the package:
> 
> ** testing if installed package can be loaded
> 
> 
>> *** caught bus error ***
> 
> address 0x0, cause 'non-existent physical address'
> 
> 
> Traceback:
> 
> 1: dyn.load(file, DLLpath = DLLpath, ...)
> 
> 2: library.dynam(lib, package, package.lib)
> 
> 3: loadNamespace(package, c(which.lib.loc, lib.loc), keep.source =
> keep.source)
> 
> 4: doTryCatch(return(expr), name, parentenv, handler)
> 
> 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
> 
> 6: tryCatchList(expr, classes, parentenv, handlers)
> 
> 7: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if
> (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))
>        call <- sys.call(-4L)        dcall <- deparse(call)[1L]
> prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        msg <-
> conditionMessage(e)        sm <- strsplit(msg, "\n")[[1L]]        w <- 14L +
> nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))
>          w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],
>  type = "b")        if (w > LONG)             prefix <- paste(prefix, "\n
> ", sep = "")    }    else prefix <- "Error : "    msg <- paste(prefix,
> conditionMessage(e), "\n", sep = "")    .Internal(seterrmessage(msg[1L]))
> if (!silent && identical(getOption("show.error.messages"),         TRUE)) {
>       cat(msg, file = stderr())        .Internal(printDeferredWarnings())
> }    invisible(structure(msg, class = "try-error"))})
> 
> 8: try({    ns <- loadNamespace(package, c(which.lib.loc, lib.loc),
> keep.source = keep.source)    dataPath <- file.path(which.lib.loc, package,
> "data")    env <- attachNamespace(ns, pos = pos, dataPath = dataPath,
>  deps)})
> 
> 9: library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return =
> TRUE)
> 
> 10: withCallingHandlers(expr, packageStartupMessage = function(c)
> invokeRestart("muffleMessage"))
> 
> 11: suppressPackageStartupMessages(library(pkg_name, lib.loc = lib,
> character.only = TRUE, logical.return = TRUE))
> 
> 12: doTryCatch(return(expr), name, parentenv, handler)
> 
> 13: tryCatchOne(expr, names, parentenv, handlers[[1L]])
> 
> 14: tryCatchList(expr, classes, parentenv, handlers)
> 
> 15: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if
> (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))
>        call <- sys.call(-4L)        dcall <- deparse(call)[1L]
> prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        msg <-
> conditionMessage(e)        sm <- strsplit(msg, "\n")[[1L]]        w <- 14L +
> nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))
>          w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],
>  type = "b")        if (w > LONG)             prefix <- paste(prefix, "\n
> ", sep = "")    }    else prefix <- "Error : "    msg <- paste(prefix,
> conditionMessage(e), "\n", sep = "")    .Internal(seterrmessage(msg[1L]))
> if (!silent && identical(getOption("show.error.messages"),         TRUE)) {
>       cat(msg, file = stderr())        .Internal(printDeferredWarnings())
> }    invisible(structure(msg, class = "try-error"))})
> 
> 16: try(suppressPackageStartupMessages(library(pkg_name, lib.loc = lib,
> character.only = TRUE, logical.return = TRUE)))
> 
> 17: do_install_source(pkg_name, instdir, pkg, desc)
> 
> 18: do_install(pkg)
> 
> 19: tools:::.install_packages()
> 
> aborting ...
> 
> /opt/local/lib/R/bin/INSTALL: line 34:  1357 Done                    echo
> 'tools:::.install_packages()'
> 
>      1358 Bus error               | R_DEFAULT_PACKAGES= LC_COLLATE=C
> "${R_HOME}/bin/R" $myArgs --slave --args ${args}
> 
> I'm not really familiar with Mac OS at all so any direction would be great.
>  Thanks!
> Conrad
> 
> -- 
> Conrad Stack
> -----------------------
> PSU Department of Biology
> 208 Mueller Lab
> University Park, PA 16802
> cell: 814.409.8310
> email: conrad.stack at gmail.com
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> 



More information about the R-SIG-Mac mailing list