[Rquantlib-devel] Building rquantlib on windows

Dirk Eddelbuettel edd at debian.org
Wed Sep 24 14:04:14 CEST 2014


Hi Michele

On 24 September 2014 at 11:29, Michele Salvadore wrote:
| Hi,
| 
| I am trying to build rquantib on windows as I need to add/improve some features
| related to fixed income pricing.

Cool!  Contributions for fixed income would be excellent!

| This is my e4nvironment configuration:
| 
| BOOSTLIB="C:/workspace/lib/boost/boost_1_56_0"
| QUANTLIB_ROOT="C:/workspace/lib/QuantLib/QuantLib-1.4"

So I presume you built / installed both from source?

R and its tools are a little picky sometimes. This as works (eg for the
Windows binaries on CRAN) with a prepared builds you can also get from CRAN.

See here:   http://www.stats.ox.ac.uk/pub/Rtools/R215x.html

With directory:  http://www.stats.ox.ac.uk/pub/Rtools/goodies/multilib/

That Quantlib14.zip then has the QuantLib library and Boost headers
referenced in src/Makevars.win via the environment variable.


That said, it should of course also work as you do, but you have to be careful:
 
| > sessionInfo()
| R version 3.1.1 (2014-07-10)
| Platform: x86_64-w64-mingw32/x64 (64-bit)
| 
| locale:
| [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252
|   
| [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                        
|  
| [5] LC_TIME=English_United States.1252    
| 
| attached base packages:
| [1] stats     graphics  grDevices utils     datasets  methods   base     
| 
| loaded via a namespace (and not attached):
| [1] tools_3.1.1
| 
| When I "Build & Reload" (from RStudio) I get the following:
| 
| ==> Rcmd.exe INSTALL --no-multiarch --with-keep.source rquantlib
| 
| * installing to library 'C:/Program Files/R/R-3.1.1/library'
| * installing *source* package 'RQuantLib' ...
| 
|    **********************************************
|    WARNING: this package has a configure script
|          It probably needs manual configuration
|    **********************************************
| 
| 
| ** libs
| g++ -m64 -I"C:/PROGRA~1/R/R-31~1.1/include" -DNDEBUG    -I"C:/Program Files/R/
| R-3.1.1/library/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include"
|  -I"C:/workspace/lib/QuantLib/QuantLib-1.4" -I../inst/include -I. -I"C:/
| workspace/lib/boost/boost_1_56_0"   -O2 -Wall  -mtune=core2 -c RcppExports.cpp
| -o RcppExports.o
| In file included from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/models/
| model.hpp:30:0,
|                  from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/pricingengines/
| latticeshortratemodelengine.hpp:28,
|                  from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/experimental/
| callablebonds/treecallablebondengine.hpp:28,
|                  from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/experimental/
| callablebonds/all.hpp:9,
|                  from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/experimental/
| all.hpp:6,
|                  from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/
| quantlib.hpp:42,
|                  from ../inst/include/rquantlib_internal.h:24,
|                  from ../inst/include/RQuantLib.h:23,
|                  from RcppExports.cpp:4:
| C:/workspace/lib/QuantLib/QuantLib-1.4/ql/methods/lattices/lattice.hpp:169:0:
| warning: ignoring #pragma omp parallel [-Wunknown-pragmas]

So you gcc / g++ does not know about OpenMP?  I can't recall what the status
was -- OpenMP and its lib may be an additional download?  In any event this
does not block CRAN for its own builds of RQuantLib binaries for Windows. So
there must be a fix.

| In file included from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/methods/
| finitedifferences/operatortraits.hpp:27:0,
|                  from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/methods/
| finitedifferences/utilities/fdmboundaryconditionset.hpp:27,
|                  from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/methods/
| finitedifferences/solvers/fdmbackwardsolver.hpp:28,
|                  from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/experimental/
| finitedifferences/fdextoujumpvanillaengine.hpp:30,
|                  from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/experimental/
| finitedifferences/all.hpp:5,
|                  from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/experimental/
| all.hpp:15,
|                  from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/
| quantlib.hpp:42,
|                  from ../inst/include/rquantlib_internal.h:24,
|                  from ../inst/include/RQuantLib.h:23,
|                  from RcppExports.cpp:4:
| C:/workspace/lib/QuantLib/QuantLib-1.4/ql/methods/finitedifferences/
| stepcondition.hpp:48:0: warning: ignoring #pragma omp parallel
| [-Wunknown-pragmas]
| In file included from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/methods/
| finitedifferences/fdtypedefs.hpp:28:0,
|                  from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/methods/
| finitedifferences/americancondition.hpp:28,
|                  from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/methods/
| finitedifferences/all.hpp:4,
|                  from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/methods/
| all.hpp:4,
|                  from C:/workspace/lib/QuantLib/QuantLib-1.4/ql/
| quantlib.hpp:47,
|                  from ../inst/include/rquantlib_internal.h:24,
|                  from ../inst/include/RQuantLib.h:23,
|                  from RcppExports.cpp:4:
| C:/workspace/lib/QuantLib/QuantLib-1.4/ql/methods/finitedifferences/
| parallelevolver.hpp:51:0: warning: ignoring #pragma omp parallel
| [-Wunknown-pragmas]
| C:/workspace/lib/QuantLib/QuantLib-1.4/ql/methods/finitedifferences/
| parallelevolver.hpp:102:0: warning: ignoring #pragma omp parallel
| [-Wunknown-pragmas]
| In file included from C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/
| as.h:25:0,
|                  from C:/Program Files/R/R-3.1.1/library/Rcpp/include/
| RcppCommon.h:169,
|                  from ../inst/include/rquantlib_internal.h:30,
|                  from ../inst/include/RQuantLib.h:23,
|                  from RcppExports.cpp:4:
| C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/internal/Exporter.h: In
| constructor 'Rcpp::traits::Exporter<T>::Exporter(SEXP) [with T = long long
| unsigned int, SEXP = SEXPREC*]':
| C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/as.h:79:51:   instantiated
| from 'T Rcpp::internal::as(SEXP, Rcpp::traits::r_type_generic_tag) [with T =
| long long unsigned int, SEXP = SEXPREC*]'
| C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/as.h:144:84:  
| instantiated from 'T Rcpp::as(SEXP) [with T = long long unsigned int, SEXP =
| SEXPREC*]'
| C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/InputParameter.h:34:45:  
| instantiated from 'Rcpp::InputParameter<T>::operator T() [with T = long long
| unsigned int]'
| RcppExports.cpp:29:161:   instantiated from here
| C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/internal/Exporter.h:31:31:
| error: invalid conversion from 'SEXP' to 'long long unsigned int'

You may need to define the C++11 compilation so that we get 'long long'
types. That is a known issue with Boost.  Or maybe we need to set a define to
not request it -- I don't recall.


As a test, you could also try uploading your source to
   http://win-builder.r-project.org 
Make sure you use YOUR email in the Maintainer field or the results email
goes to me.

Let me know how it goes. I hope we can make this work.

Dirk

| [-fpermissive]
| make: *** [RcppExports.o] Error 1
| Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-31~1.1/etc
| /x64/Makeconf" -f "C:/PROGRA~1/R/R-31~1.1/share/make/winshlib.mk" SHLIB_LDFLAGS
| ='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="RQuantLib.dll" WIN=64
| TCLBIN=64 OBJECTS="RcppExports.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 utils.o vanilla.o zero.o"' had status 2
| ERROR: compilation failed for package 'RQuantLib'
| * removing 'C:/Program Files/R/R-3.1.1/library/RQuantLib'
| * restoring previous 'C:/Program Files/R/R-3.1.1/library/RQuantLib'
| 
| Exited with status 1.
| 
| 
| Any idea how to fix this?
| 
| Thanks,
| Michele
| _______________________________________________
| Rquantlib-devel mailing list
| Rquantlib-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rquantlib-devel

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rquantlib-devel mailing list