bnosac / dlib

allowing R users to work with dlib through Rcpp
13 stars 2 forks source link

R installation segfault #4

Closed shearerpmm closed 5 years ago

shearerpmm commented 5 years ago

Hi! I'm really interested in using dlib's find_max_global from R, so I tried to install the package but I ran into errors. Here's my sessionInfo() and the logs from my second installation attempt. (My first gave me a lot of errors related to JPEG loading, so I removed -DDLIB_JPEG_SUPPORT in Makevars)

> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0        rstudioapi_0.8    magrittr_1.5      usethis_1.4.0     devtools_2.0.1    pkgload_1.0.2    
 [7] R6_2.3.0          rlang_0.3.1       tools_3.5.2       pkgbuild_1.0.2    sessioninfo_1.1.1 cli_1.0.1        
[13] withr_2.1.2       remotes_2.0.2     yaml_2.2.0        assertthat_0.2.0  digest_0.6.18     rprojroot_1.3-2  
[19] crayon_1.3.4      processx_3.2.0    callr_3.0.0       base64enc_0.1-3   fs_1.2.6          ps_1.2.1         
[25] testthat_2.0.1    glue_1.3.0        memoise_1.1.0     compiler_3.5.2    desc_1.2.0        backports_1.1.2  
[31] prettyunits_1.0.2
> devtools::install_local('~/lib/dlib/')
✔  checking for file ‘/private/var/folders/tk/pjpslqns2z36gd_64m23j2kx__t6v6/T/RtmpI1e9Tz/filecea31e5fc152/dlib/DESCRIPTION’ ...
─  preparing ‘dlib’: (595ms)
✔  checking DESCRIPTION meta-information
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘dlib_1.1.tar.gz’
   Warning: invalid uid value replaced by that for user 'nobody'
   Warning: invalid gid value replaced by that for user 'nobody'

* installing *source* package ‘dlib’ ...
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -include r_cmd_check_happiness.h -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include  -I../inst/include -DDLIB_PNG_SUPPORT -DDLIB_NO_GUI_SUPPORT  -fPIC  -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -include r_cmd_check_happiness.h -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include  -I../inst/include -DDLIB_PNG_SUPPORT -DDLIB_NO_GUI_SUPPORT  -fPIC  -Wall -g -O2 -c dlib-core.cpp -o dlib-core.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -include r_cmd_check_happiness.h -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include  -I../inst/include -DDLIB_PNG_SUPPORT -DDLIB_NO_GUI_SUPPORT  -fPIC  -Wall -g -O2 -c dlib-example.cpp -o dlib-example.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -include r_cmd_check_happiness.h -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include  -I../inst/include -DDLIB_PNG_SUPPORT -DDLIB_NO_GUI_SUPPORT  -fPIC  -Wall -g -O2 -c r_cmd_check_happiness.cc -o r_cmd_check_happiness.o
clang++ -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/clang4/lib -o dlib.so RcppExports.o dlib-core.o dlib-example.o r_cmd_check_happiness.o -lpng -lz -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
installing to /Library/Frameworks/R.framework/Versions/3.5/Resources/library/dlib/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
sh: line 1: 53608 Segmentation fault: 11  '/Library/Frameworks/R.framework/Resources/bin/R' --no-save --slave 2>&1 < '/var/folders/tk/pjpslqns2z36gd_64m23j2kx__t6v6/T//RtmpdVwV4F/filed11e39c17dce'

 *** caught segfault ***
address 0xffffffffffffffe8, cause 'memory not mapped'

Traceback:
 1: dyn.load(file, DLLpath = DLLpath, ...)
 2: library.dynam(lib, package, package.lib)
 3: loadNamespace(package, lib.loc)
 4: doTryCatch(return(expr), name, parentenv, handler)
 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 6: tryCatchList(expr, classes, parentenv, handlers)
 7: tryCatch({    attr(package, "LibPath") <- which.lib.loc    ns <- loadNamespace(package, lib.loc)    env <- attachNamespace(ns, pos = pos, deps)}, error = function(e) {    P <- if (!is.null(cc <- conditionCall(e)))         paste(" in", deparse(cc)[1L])    else ""    msg <- gettextf("package or namespace load failed for %s%s:\n %s",         sQuote(package), P, conditionMessage(e))    if (logical.return)         message(paste("Error:", msg), domain = NA)    else stop(msg, call. = FALSE, domain = NA)})
 8: library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE)
 9: withCallingHandlers(expr, packageStartupMessage = function(c) invokeRestart("muffleMessage"))
10: suppressPackageStartupMessages(library(pkg_name, lib.loc = lib,     character.only = TRUE, logical.return = TRUE))
11: doTryCatch(return(expr), name, parentenv, handler)
12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
13: tryCatchList(expr, classes, parentenv, handlers)
14: 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        sm <- strsplit(conditionMessage(e), "\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 <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
15: try(suppressPackageStartupMessages(library(pkg_name, lib.loc = lib,     character.only = TRUE, logical.return = TRUE)))
16: tools:::.test_load_package("dlib", "/Library/Frameworks/R.framework/Versions/3.5/Resources/library")
An irrecoverable exception occurred. R is aborting now ...
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/dlib’
Error in i.p(...) : 
  (converted from warning) installation of package ‘/var/folders/tk/pjpslqns2z36gd_64m23j2kx__t6v6/T//RtmpI1e9Tz/filecea387c6070/dlib_1.1.tar.gz’ had non-zero exit status
jwijffels commented 5 years ago

The package is on cran, why dont you install it from cran?

shearerpmm commented 5 years ago

The CRAN version contains dlib 19.2, and find_max_global was introduced in 19.8.

jwijffels commented 5 years ago

Ah ok, so how can I help on this?

shearerpmm commented 5 years ago

Was just hoping you might have an insight on solving it. I have no idea what to do, I don't do this kind of thing often (build a package with a compiled-from-source C++ dependency from scratch). If not, I'll probably look into alternatives like the Python API.

jwijffels commented 5 years ago

But where is your code?

shearerpmm commented 5 years ago

I don't have any code except yours. Here's what I've done so far:

This could be a problem on my end but I have absolutely no idea how to solve it, so I thought I'd ask here before giving up.

shearerpmm commented 5 years ago

Again, the CRAN version contains dlib 19.2, and find_max_global was introduced in 19.8.

jwijffels commented 5 years ago

Have you looked up the error message error? Looks like some5hings wrong with you r installation. It says Falling back to library file for linking... dont know what that means, I am using Ubuntu and Windows, no Mac to test this. Have you installed all Mac developer tools as indicated in the r for Mac manual. Also libpng and lz need to be on your system if you want to install from source