You are not logged in.

#1 2018-07-22 17:54:13

Kilnarix
Member
Registered: 2018-07-22
Posts: 3

Can't compile the RQuantLib library in R, strange error

Dear all.

I have been able to compile and install the QuantLib library from the Arch Linux AUR. My efforts to then install the RQuantLib library in R have been unsuccessful. I am getting a compilation error. I can't find the error repeated anywhere online. I am at the end of my tether. Please help!

Here is the output of the R: (I am running R as the super user in case that makes a difference)

> install.packages("RQuantLib")
trying URL 'https://cran.revolutionanalytics.com/src/contrib/RQuantLib_0.4.4.tar.gz'
Content type 'application/octet-stream' length 188141 bytes (183 KB)
==================================================
downloaded 183 KB

* 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/include/R/" -DNDEBUG  -I"/usr/lib/R/library/Rcpp/include" -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt  -I/usr/local/include  -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt  -c RcppExports.cpp -o RcppExports.o
g++  -I"/usr/include/R/" -DNDEBUG  -I"/usr/lib/R/library/Rcpp/include" -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt  -I/usr/local/include  -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt  -c affine.cpp -o affine.o
g++  -I"/usr/include/R/" -DNDEBUG  -I"/usr/lib/R/library/Rcpp/include" -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt  -I/usr/local/include  -I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt  -c asian.cpp -o asian.o
asian.cpp: In function ‘Rcpp::List asianOptionEngine(std::__cxx11::string, std::__cxx11::string, double, double, double, double, double, double, double, double, size_t)’:
asian.cpp:72:101: error: no matching function for call to ‘boost::posix_time::minutes::minutes(double)’
         QuantLib::Date exDate(today.dateTime() + boost::posix_time::minutes(maturity * 360 * 24 * 60));
                                                                                                     ^
In file included from /usr/local/include/ql/time/date.hpp:39,
                 from /usr/local/include/ql/event.hpp:28,
                 from /usr/local/include/ql/cashflow.hpp:28,
                 from /usr/local/include/ql/quantlib.hpp:10,
                 from ../inst/include/rquantlib_internal.h:24,
                 from ./rquantlib.h:33,
                 from asian.cpp:23:
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:43:16: note: candidate: ‘template<class T> boost::posix_time::minutes::minutes(const T&, typename boost::enable_if<boost::is_integral<T>, void>::type*)’
       explicit minutes(T const& m,
                ^~~~~~~
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:43:16: note:   template argument deduction/substitution failed:
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp: In substitution of ‘template<class T> boost::posix_time::minutes::minutes(const T&, typename boost::enable_if<boost::is_integral<T>, void>::type*) [with T = double]’:
asian.cpp:72:101:   required from here
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:43:16: error: no type named ‘type’ in ‘struct boost::enable_if<boost::is_integral<double>, void>’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:39:30: note: candidate: ‘boost::posix_time::minutes::minutes(const boost::posix_time::minutes&)’
   class BOOST_SYMBOL_VISIBLE minutes : public time_duration
                              ^~~~~~~
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:39:30: note:   no known conversion for argument 1 from ‘double’ to ‘const boost::posix_time::minutes&’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:39:30: note: candidate: ‘boost::posix_time::minutes::minutes(boost::posix_time::minutes&&)’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:39:30: note:   no known conversion for argument 1 from ‘double’ to ‘boost::posix_time::minutes&&’
asian.cpp:115:123: error: no matching function for call to ‘boost::posix_time::minutes::minutes(__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type)’
             fixingDates[i]= QuantLib::Date(today.dateTime() + boost::posix_time::minutes(timeIncrements[i] * 360 * 24 * 60));
                                                                                                                           ^
In file included from /usr/local/include/ql/time/date.hpp:39,
                 from /usr/local/include/ql/event.hpp:28,
                 from /usr/local/include/ql/cashflow.hpp:28,
                 from /usr/local/include/ql/quantlib.hpp:10,
                 from ../inst/include/rquantlib_internal.h:24,
                 from ./rquantlib.h:33,
                 from asian.cpp:23:
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:43:16: note: candidate: ‘template<class T> boost::posix_time::minutes::minutes(const T&, typename boost::enable_if<boost::is_integral<T>, void>::type*)’
       explicit minutes(T const& m,
                ^~~~~~~
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:43:16: note:   template argument deduction/substitution failed:
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp: In substitution of ‘template<class T> boost::posix_time::minutes::minutes(const T&, typename boost::enable_if<boost::is_integral<T>, void>::type*) [with T = double]’:
asian.cpp:115:123:   required from here
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:43:16: error: no type named ‘type’ in ‘struct boost::enable_if<boost::is_integral<double>, void>’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:39:30: note: candidate: ‘boost::posix_time::minutes::minutes(const boost::posix_time::minutes&)’
   class BOOST_SYMBOL_VISIBLE minutes : public time_duration
                              ^~~~~~~
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:39:30: note:   no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type’ {aka ‘double’} to ‘const boost::posix_time::minutes&’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:39:30: note: candidate: ‘boost::posix_time::minutes::minutes(boost::posix_time::minutes&&)’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:39:30: note:   no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type’ {aka ‘double’} to ‘boost::posix_time::minutes&&’
make: *** [/usr/lib64/R/etc/Makeconf:168: asian.o] Error 1
ERROR: compilation failed for package ‘RQuantLib’
* removing ‘/usr/lib/R/library/RQuantLib’

The downloaded source packages are in
	‘/tmp/RtmpywPieH/downloaded_packages’
Warning message:
In install.packages("RQuantLib") :
  installation of package ‘RQuantLib’ had non-zero exit status

Offline

#2 2018-07-22 19:21:44

Kilnarix
Member
Registered: 2018-07-22
Posts: 3

Re: Can't compile the RQuantLib library in R, strange error

Downgrading the packages boost and boost-libs to version 1.66.0-3 solves the problem, and RQuantLib installs and runs.

Does this mean I have discovered a bug?

Offline

#3 2018-07-22 19:25:55

loqs
Member
Registered: 2014-03-06
Posts: 19,081

Re: Can't compile the RQuantLib library in R, strange error

Offline

Board footer

Powered by FluxBB