eddelbuettel / rquantlib

R interface to the QuantLib library
119 stars 50 forks source link

Installation Failure: Updated Manjaro (Arch-based) Linux #175

Closed whelanh closed 1 year ago

whelanh commented 1 year ago

install.packages('RQuantLib') fails on R 4.3.0 on updated Manjaro (arch-based) Linux system (I suspect this is a recurring problem with compiler mismatch?):

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 the compiler supports GNU C++... yes
checking whether g++ -std=gnu++17 accepts -g... yes
checking for g++ -std=gnu++17 option to enable C++11 features... none needed
checking how to run the C++ preprocessor... g++ -std=gnu++17 -E
checking whether the compiler supports GNU C++... (cached) yes
checking whether g++ -std=gnu++17 accepts -g... (cached) yes
checking for g++ -std=gnu++17 option to enable C++11 features... (cached) none needed
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
Configured RQuantlib 0.4.17
** libs
using C++ compiler: ‘g++ (GCC) 12.2.1 20230201’
using C++14
g++ -std=gnu++14 -I"/usr/include/R/" -DNDEBUG  -I'/home/hugh/R/x86_64-pc-linux-gnu-library/4.3/Rcpp/include' -I/usr/local/include   -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -I/usr/include -fopenmp -pthread  -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c RcppExports.cpp -o RcppExports.o
In file included from /usr/include/ql/quantlib.hpp:10,
                 from ../inst/include/rquantlib_internal.h:23,
                 from ../inst/include/RQuantLib.h:22,
                 from RcppExports.cpp:4:
/usr/include/ql/any.hpp:40:20: error: ‘any’ has not been declared in ‘std’
   40 |         using std::any;                   // NOLINT(misc-unused-using-decls)
      |                    ^~~
/usr/include/ql/any.hpp:41:20: error: ‘any_cast’ has not been declared in ‘std’
eddelbuettel commented 1 year ago

Can you provide a bit more detail, please?

I see g++ 12.2.1, that should be good. But what version of QuantLib is this trying to build against?

FWIW QuantLib 1.30 came out recently, I updated it for Debian (I am the maintainer for it there) and also in my PPA. I made two tiny changes in the github repo of RQuantLib for.

The CRAN version of RQuantLib has not been updated for that, so it would likely be happiest with QuantLib 1.29. Is that what you use, or do you have something older?

whelanh commented 1 year ago

Thank you so much for responding. The version of QuantLib I have installed/compiled is 1.30-1 from AUR. I will see if I can downgrade QuantLib to 1.29. Thank you for all you work on the RQuantLib package. Kind regards, Hugh

eddelbuettel commented 1 year ago

No, 1.30-1 is good! While it does not explain the error you showed (which I never saw on similar compiler versions) you can just try remotes::install_github("eddelbuettel/rquantlib") though I fear it may also fail. The next thing we may have to control for is Boost versions but you are likely also current. In a nutshell, I do not know where

/usr/include/ql/any.hpp:40:20: error: ‘any’ has not been declared in ‘std’
   40 |         using std::any;                   // NOLINT(misc-unused-using-decls)
      |                    ^~~
/usr/include/ql/any.hpp:41:20: error: ‘any_cast’ has not been declared in ‘std’

came from. "It all works over here."

whelanh commented 1 year ago

You might be right about Boost versions. I see I have boost 1.81.0-3 version installed. I see from the boost website that there is a 1.82.0 version of boost; is that the one you used?

eddelbuettel commented 1 year ago

No I am also on 1.81. Weird. Also "small" +1/-1 deltas rarely matter. You are otherwise current.

You need to debug that at your end -- I cannot help your from here. My log is below. All clean here. (Would be the same for CRAN RQuantLib modulo one (or two) 'deprecation' warnings.)

```r > getRversion() [1] ‘4.3.0’ > utils::osVersion [1] "Ubuntu 22.10" > remotes::install_github("eddelbuettel/rquantlib") Using github PAT from envvar GITHUB_PAT Downloading GitHub repo eddelbuettel/rquantlib@HEAD Skipping 1 packages ahead of CRAN: Rcpp ── R CMD build ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────✔ checking for file ‘/tmp/Rtmp6lCuV3/remotes11151131056a35/eddelbuettel-rquantlib-adeb935/DESCRIPTION’ ... ─ preparing ‘RQuantLib’: ✔ checking DESCRIPTION meta-information ... ─ cleaning src ─ running ‘cleanup’ ─ checking for LF line-endings in source and make files and shell scripts (371ms) ─ checking for empty or unneeded directories ─ looking to see if a ‘data/datalist’ file should be added ─ building ‘RQuantLib_0.4.17.2.tar.gz’ Installing package into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is unspecified) * installing *source* package ‘RQuantLib’ ... ** using staged installation 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 the compiler supports GNU C++... yes checking whether ccache g++ accepts -g... yes checking for ccache g++ option to enable C++11 features... none needed checking how to run the C++ preprocessor... ccache g++ -E checking whether the compiler supports GNU C++... (cached) yes checking whether ccache g++ accepts -g... (cached) yes checking for ccache g++ option to enable C++11 features... (cached) none needed 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 Configured RQuantlib 0.4.17 ** libs using C++ compiler: ‘g++ (Ubuntu 12.2.0-3ubuntu1) 12.2.0’ using C++14 ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fop enmp -fpic -g -O3 -Wall -pipe -pedantic -c RcppExports.cpp -o RcppExports.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fop enmp -fpic -g -O3 -Wall -pipe -pedantic -c affine.cpp -o affine.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c asian.cpp -o asian.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c barrier_binary.cpp -o barrier_binary.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c bermudan.cpp -o bermudan.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c bonds.cpp -o bonds.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c calendars.cpp -o calendars.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c curves.cpp -o curves.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c dates.cpp -o dates.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c daycounter.cpp -o daycounter.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c discount.cpp -o discount.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c hullwhite.cpp -o hullwhite.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c implieds.cpp -o implieds.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c modules.cpp -o modules.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c sabr.cpp -o sabr.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c schedule.cpp -o schedule.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c utils.cpp -o utils.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c vanilla.cpp -o vanilla.o ccache g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -g -O3 -Wall -pipe -pedantic -I/usr/include -fopenmp -I../inst/include -I. -DBOOST_NO_AUTO_PTR -fopenmp -fpic -g -O3 -Wall -pipe -pedantic -c zero.cpp -o zero.o ccache g++ -std=gnu++14 -Wl,-S -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -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 -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -L/usr/lib -lQuantLib -fopenmp -fopenmp -L/usr/lib/R/lib -lR installing to /usr/local/lib/R/site-library/00LOCK-RQuantLib/00new/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 from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (RQuantLib) > ```
whelanh commented 1 year ago

Well I am happy to report success now. It was not a Boost issue (I did not change my configuration). I changed my installation of "quantlib" from AUR 1.30-1 to the other option on AUR of 'quantlib-git" version 1.30r12ga342b44ff-1. These AUR issues are probably why you are happy to be using Debian :-) After doing that I was able to install RQuantLib normally using install.packages('RQuantLib')...albeit with some warnings ( "RQuantLib 0.4.17 built with QuantLib version 1.31-dev. See https://www.quantlib.org for more on QuantLib. Warning message: In compareVersion(qlver, "1.7") : NAs introduced by coercion")

Thank you for your help and patience. Kindest regards, Hugh

eddelbuettel commented 1 year ago

Great, glad to know you're covered. I am still not sure where the error may have come from -- but happy to file it under 'local to Manjaro' and close this :grinning: