Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RQuantLib 0.4.5 doesn't compile on Ubuntu 16.04 #119

Closed
grandtiger opened this issue Sep 7, 2018 · 19 comments
Closed

RQuantLib 0.4.5 doesn't compile on Ubuntu 16.04 #119

grandtiger opened this issue Sep 7, 2018 · 19 comments

Comments

@grandtiger
Copy link

I have tried many times to install RQuantLib 0.4.5, but kept getting core dump. I even reinstall boost and recompiled QuantLib, but it makes no difference. However, installation of version 0.4.4 worked just fine. What is so special about 0.4.5?

Following is my Ubuntu 16.04 system details.

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.5 LTS
Release:        16.04
Codename:       xenial

dpkg -s libboost-dev | grep 'Version'
Version: 1.58.0.1ubuntu1

QuantLib version is the latest 1.13 release

R Console outputs during the package installation:

> install.packages('RQuantLib', lib='/usr/lib/R/library')

trying URL 'https://cloud.r-project.org/src/contrib/RQuantLib_0.4.5.tar.gz'
Content type 'application/x-gzip' length 190726 bytes (186 KB)
==================================================
downloaded 186 KB

* installing *source* package ‘RQuantLib’ ...
** package ‘RQuantLib’ successfully unpacked and MD5 sums checked
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking for R... yes
checking for quantlib-config... yes
checking for Boost development files... yes
checking for minimal Boost version... yes
configure: creating ./config.status
config.status: creating src/Makevars
Completed configuration and ready to build.
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c affine.cpp -o affine.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c asian.cpp -o asian.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c barrier_binary.cpp -o barrier_binary.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c bermudan.cpp -o bermudan.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c bonds.cpp -o bonds.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c calendars.cpp -o calendars.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c curves.cpp -o curves.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c dates.cpp -o dates.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c daycounter.cpp -o daycounter.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c discount.cpp -o discount.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c hullwhite.cpp -o hullwhite.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c implieds.cpp -o implieds.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c modules.cpp -o modules.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c sabr.cpp -o sabr.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c schedule.cpp -o schedule.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c utils.cpp -o utils.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c vanilla.cpp -o vanilla.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c zero.cpp -o zero.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RQuantLib.so RcppExports.o affine.o asian.o barrier_binary.o bermudan.o bonds.o calendars.o curves.o dates.o daycounter.o discount.o hullwhite.o implieds.o modules.o sabr.o schedule.o utils.o vanilla.o zero.o -L/usr/local/lib -lQuantLib -fopenmp -L/usr/lib/R/lib -lR
installing to /usr/lib/R/library/RQuantLib/libs
** R
** data
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded

 *** caught segfault ***
address 0x7f3750a0f500, cause 'invalid permissions'

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("RQuantLib", "/usr/lib/R/library")
An irrecoverable exception occurred. R is aborting now ...
Segmentation fault (core dumped)
ERROR: loading failed
* removing ‘/usr/lib/R/library/RQuantLib’

The downloaded source packages are in
        ‘/tmp/RtmpAr2HwQ/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("RQuantLib", lib = "/usr/lib/R/library") :
  installation of package ‘RQuantLib’ had non-zero exit status

R Console output for successful installation of RQuantLib v0.4.4:

> require(devtools)
> install_version("RQuantLib", version = "0.4.4", repos = "http://cran.us.r-project.org")
Downloading package from url: http://cran.us.r-project.org/src/contrib/Archive/RQuantLib/RQuantLib_0.4.4.tar.gz
Installing RQuantLib
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet  \
  CMD INSTALL '/tmp/RtmpAr2HwQ/devtools5b767b494c75/RQuantLib'  \
  --library='/usr/local/lib/R/site-library' --install-tests

* installing *source* package ‘RQuantLib’ ...
** package ‘RQuantLib’ successfully unpacked and MD5 sums checked
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking for R... yes
checking for quantlib-config... yes
checking for Boost development files... yes
checking for minimal Boost version... yes
configure: creating ./config.status
config.status: creating src/Makevars
Completed configuration and ready to build.
** libs
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c RcppExports.cpp -o RcppExports.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c affine.cpp -o affine.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c asian.cpp -o asian.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c barrier_binary.cpp -o barrier_binary.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c bermudan.cpp -o bermudan.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c bonds.cpp -o bonds.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c calendars.cpp -o calendars.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c curves.cpp -o curves.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c dates.cpp -o dates.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c daycounter.cpp -o daycounter.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c discount.cpp -o discount.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c hullwhite.cpp -o hullwhite.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c implieds.cpp -o implieds.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c modules.cpp -o modules.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c sabr.cpp -o sabr.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c schedule.cpp -o schedule.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c utils.cpp -o utils.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c vanilla.cpp -o vanilla.o
g++  -I"/usr/share/R/include" -DNDEBUG  -I"/usr/lib/R/site-library/Rcpp/include"   -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -I/usr/local/include -fpermissive -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c zero.cpp -o zero.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RQuantLib.so RcppExports.o affine.o asian.o barrier_binary.o bermudan.o bonds.o calendars.o curves.o dates.o daycounter.o discount.o hullwhite.o implieds.o modules.o sabr.o schedule.o utils.o vanilla.o zero.o -L/usr/local/lib -lQuantLib -fopenmp -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/RQuantLib/libs
** R
** data
** demo
** inst
** tests
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (RQuantLib)
@eddelbuettel
Copy link
Owner

The segfault is highly symptomatic of a binary mismatch in one if the dependencies. Maybe the Boost version you use now is different from the Boost version used to compile QuantLib, maybe Rcpp needs a recompilation, maybe something else.

We support this software and make sure it generally works, but we cannot support random combinations of components.

It works on 18.04 (which I use), it works for Debian unstable/testing, it works on Ubuntu "trusty" (as used for Travis) and it works on all machines that CRAN uses for testing. Which suggests something may be wrong in your corner.

@grandtiger
Copy link
Author

@eddelbuettel Thanks for looking into this. I have a Ubuntu 18.04 Windows Sub-system for Linux, which does work. However, it's really puzzling that on the same Ubuntu 16.04 machine, RQuantLib v0.4.4 works just fine, but v0.4.5 doesn't. The boost version and QuantLib version are the same for both installation. I tried on R 3.4.4 initially, it didn't work. So I tried again after updating to R 3.5.1, same exact result. I have tried everything I can think of, that's why I am asking for help here. I am a bit hesitant to upgrade my 16.04 to 18.04 at this point, and probably would just keep using v0.4.4 for now.

@eddelbuettel
Copy link
Owner

Can you be more explicit and say which of
R
Rcpp
QuantLib
RQuantLib
you installed from source, and which as a binary?

You insist on using an outdated distribution release with current application releases. That may require some work on your end. But the good news is that this generally works when the components match.

@grandtiger
Copy link
Author

@eddelbuettel
R: 3.4.4 and 3.5.1 (same error)
Rcpp: 0.12.18
QuantLib: 1.13 (from source)
RQuantLib: 0.4.5 (error on 16.04, fine on 18.04), 0.4.4 (work on both 16.04 and 18.04)
I believe only boost is from binary.

@eddelbuettel
Copy link
Owner

Beats me. Please see if you can debug it. It works on all platforms we (and CRAN) test on.

@grandtiger
Copy link
Author

@eddelbuettel Debugging R/Rcpp package is beyond me at this point, so I might just move on to 18.04. I am running Ubuntu 16.04 as virtual machines (vmware and virtualbox), not sure whether this matters. As the first step, I upgraded one of my 16.04 VM to 18.04, RQuantLib 0.4.4 works out of the box with R 3.4.4. I then upgraded R to 3.5.1, it works too. Finally I upgrade to RQuantLib 0.4.5, no issues at all. I plan to upgrade my work ubuntu VM soon. Thanks for looking into this! I will close this issue unless you want to keep it open and let other R/Rcpp experts chime in.

@eddelbuettel
Copy link
Owner

I will close this. It is a non-issue as RQL works on 18.04 and all other current systems.

@stjordanis
Copy link

I also have the same issue, using virrtualbox + ubuntu 16.04

This is what I get at the end:

installing to /home/steliox1604/R/x86_64-pc-linux-gnu-library/3.4/RQuantLib/libs
** R
** data
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
sh: line 1: 8824 Segmentation fault (core dumped) '/usr/lib/R/bin/R' --no-save --slave 2>&1 < '/tmp/RtmpLLio3v/file200c3a61ff89'

*** caught segfault ***
address 0x7f9a75469a20, cause 'invalid permissions'

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 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 <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && identical(getOption("show.error.messages"), TRUE)) { 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("RQuantLib", "/home/steliox1604/R/x86_64-pc-linux-gnu-library/3.4")
An irrecoverable exception occurred. R is aborting now ...
ERROR: loading failed

  • removing ‘/home/steliox1604/R/x86_64-pc-linux-gnu-library/3.4/RQuantLib’
    Error in i.p(...) :
    (converted from warning) installation of package ‘/tmp/Rtmpe4ZbXe/file1d18407495e3/RQuantLib_0.4.5.2.tar.gz’ had non-zero exit status

@eddelbuettel
Copy link
Owner

If you used Ubuntu 16.04 with its versions of R, QuantLib and RQuantLib it would just work.

If you decide to mix and match you most likely need to recompile all components.

So, for startrts, which versions of

  • R
  • QuantLib
  • RQuantLib

are you using, and where did you get them from?

@stjordanis
Copy link

Thank you,
I used:

  • R version 3.4.1 (2017-06-30) -- "Single Candle"
  • Quantlib latest pull from github
  • I tried Rquantlib from synaptic package manager, github ( install_github("eddelbuettel/rquantlib")) as well as RCran;
    they all failed on my ubuntu 16.04 VM

When I try RQuant from CRAN/Rstudio, I get a different final error message:

/usr/bin/ld: /usr/local/lib/libQuantLib.a(cashflow.o): relocation R_X86_64_32S against `_ZNK8QuantLib8CashFlow12exCouponDateEv' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libQuantLib.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'RQuantLib.so' failed
make: *** [RQuantLib.so] Error 1
ERROR: compilation failed for package ‘RQuantLib’

  • removing ‘/home/steliox1604/R/x86_64-pc-linux-gnu-library/3.4/RQuantLib’
    Warning in install.packages :
    installation of package ‘RQuantLib’ had non-zero exit status

@eddelbuettel
Copy link
Owner

So you are mixing and matching across

  • a 2 1/2 year old Ubuntu release
  • a 1 1/2 year old R release
  • cutting edge QuantLib

Do you see why that can be a problem?

In short, old Ubuntu can be made to work but it work. I have to do that each and every time for the Travis CI checks on GitHub which insist on even older Ubuntu releases. So my PPA there has some versions of QuantLib build for whatever I needed for Travis.

But I have given up on that. I now use a simple Docker container running Debian testing so I get

  • the current R version (which I maintain in Debian)
  • the current QuantLib version (which I maintain in Debian)
    and I can easily build and test RQuantLib against it.

For what it is worth I also offer a Docker run-time container there so it is all pre-made for you...

Sadly I do not have the time to help with any and all crossed pairs of versions. If you have the patience to build QL from source you should be able to bend your 16.04 system in change.

Good luck!

@stjordanis
Copy link

You are absolutely right, thank you, I basically wanted to provide feedback from my VM.
I guess the cutting edge Quantlib version must be the culprit.
I was lucky with so many R packages in Ubuntu 16.04 up to now, so I pushed my luck a bit too much with this one.

@eddelbuettel
Copy link
Owner

eddelbuettel commented Nov 20, 2018

The thing is (some) people get upset when I point out the dissonance.

You have Ubuntu 16.04. You use it because you like to be stable. It has packages for R, QuantLib and RQuantLib -- a simple sudo apt-get install r-cran-rquantlib sets you up with working code. It works and I know it -- I happen to be the maintainer for all three.

But yes, it is older. So now wanting newest code on a 2+ years old 16.04 ... will have some friction. You can make it work but it is just that: work. Maybe just upgrade to 18.04 as a start? Food for thought.

@stjordanis
Copy link

stjordanis commented Nov 20, 2018

Of course. BTW, I also ran sudo apt-get install r-cran-rquantlib, like I said, following your wiki instructions {using synaptic} .
But I already had the latest quantlib installed and this must be messing with rwuabtlib if it's not the old r version or Ubuntu 16.04..
I still maintain this Ubuntu 16.04 vm due to cloudera manager requirements only.

@dickmao
Copy link

dickmao commented Dec 22, 2018

However, installation of version 0.4.4 worked just fine. What is so special about 0.4.5?

The setting of CXX_STD=CXX11 in Makevars.

Here is what I did:

  1. git clone lballabio/QuantLib
./autogen.sh`
./configure --prefix=$HOME/.local --enable-intraday
make install
  1. git clone eddelbuettel/rquantlib and remove CXX_STD=CXX11 from src/Makevars.in
  2. From the rquantlib parent directory, fire up R and execute
library(devtools)
install()
library(RQuantLib)
getHolidayList("UnitedStates", as.Date("2018-12-01"), as.Date("2019-01-02"))

@eddelbuettel
Copy link
Owner

and remove CXX_STD=CXX11 from src/Makevars.in

Why? Upstream moved towards wider use of C++11 throughout QuantLib, see Luigi's series of blog posts.

@dickmao
Copy link

dickmao commented Dec 22, 2018

Just offering a quick and dirty fix for people who don't want to upgrade to 18.04 or who otherwise want to hack from source. I am all for C++11 in QuantLib.

@lballabio
Copy link

Upstream is not yet on C++11, as in "allowing C++11 features in the code" (the changes described in the blog posts are still on a branch) but it compiles successfully in C++11/C++14/C++17 mode, since they're part of the build matrix at https://travis-ci.org/lballabio/QuantLib.

This said, I wouldn't exclude the possibility of ABI incompatibilities if some parts of the final link (e.g., the Boost libraries?) were compiled in C++03 mode and other parts in C++11 mode.

@eddelbuettel
Copy link
Owner

eddelbuettel commented Jan 17, 2019

Again, it is not our responsibility to ensure compilability under any and all options build and OS options, but I just glanced at my PPAs and under the older (pre R 3.5.*) scheme I still built QL 1.13 under Ubuntu 14.04 (for Travis) -- see https://launchpad.net/~edd/+archive/ubuntu/misc (and https://launchpad.net/~edd/+archive/ubuntu/r-3.5 for a more current one with QL 1.14 built for 18.04 and 18.10 -- my personal use too).

I no longer need the build for 14.04 (or 16.04) as I switched Travis to using bespoke Docker containers based on Debian testing. So in a nutshell, I still recommended to get to the more current Ubuntu 18.04.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants