Login  Register

Re: SWIG R with c++11

Posted by Peter Caspers-4 on Oct 27, 2013; 9:45am
URL: http://quantlib.414.s1.nabble.com/SWIG-R-with-c-11-tp14618p14620.html

Hi Dirk,

thank you. With

CXX=clang++
CXXFLAGS=-g -O3 -Wall -pipe -Wno-unused -pedantic -std=c++11

in ~/R/Makevars make runs smooth on my code. I get 12 warnings of type

QuantLib.cpp:552:7: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]

which does not look critical, and 3 warnings

* checking DESCRIPTION meta-information ... WARNING
Non-standard license specification:
  QuantLib License
Standardizable: FALSE

* checking for missing documentation entries ... WARNING
Undocumented code objects:
  ‘ARSCurrency’ ‘ATSCurrency’ ‘AUDCurrency’ ‘AUDLibor’
  ‘AUDLibor__SWIG_0’ ‘AUDLibor__SWIG_1’ ‘Actual360’ ‘Actual365Fixed’
  ‘Actual365NoLeap’ ‘ActualActual’ ‘ActualActual__SWIG_0’
...

* checking PDF version of manual ... WARNING
LaTeX errors when creating PDF version.
This typically indicates Rd problems.

again not dangerous, are they.

Also then running R CMD INSTALL . goes without problems. After that I
have a QuantLib.so which I can load from R

dyn.load('/usr/local/lib/R/site-library/QuantLib/libs/QuantLib.so')

and after

source('~/quantlibpc/QuantLib-SWIG/R/R/QuantLib.R')

I can succesfully run a few basic tests with QuantLib objects.

However there does not seem to be the compiled wrapper QuantLib.RData
generated. Was it renamed maybe or do I have to generate it by myself ?

Thanks a lot
    Peter

Dirk Eddelbuettel <[hidden email]> writes:

> Hi Peter,
>
> On 26 October 2013 at 21:34, Peter Caspers wrote:
> |    is it possible to build the SWIG R package with -std=c++11 ? As far
> | as I can see during the execution of R CMD check R one step
> |
> | * checking whether package ‘QuantLib’ can be installed ... ERROR
> |
> | fails because some hard coded (?) configuration (not related to the one
> | produced with the usual ./configure ... call) is used here, in the log
> | R.Rcheck/00install.out I get
> |
> | make[3]: Entering directory `/home/peter/quantlibpc/QuantLib-SWIG/R/src'
> | g++ -I/usr/share/R/include -DNDEBUG `quantlib-config --cflags`      -fpic  -O3 -pipe  -g  -c QuantLib.cpp -o QuantLib.o
> |
> | which fails because of some c++11 elements in my client quantlib code.
>
> Interesting question. The whole 'R and C++11' nexus is a little toxic (as the
> CRAN gatekeepers exists on the older standard; some of us are working behind
> the scenes to change that).  By and large, using -std=c++11 should not bite.
> We use it for a things with Rcpp,  but because we cannot (yet!!) upload to
> CRAN with it, there isn't as much testing for C++11.  
>
> R itself is in C and does not care. Boost may care (and Boost 2.0 will be
> guaranteed to work this way). No idea about Swig. I haven't built the QL-Swig
> bindings in a while.
>
> Now, your post doesn't actually show the error. What happens when you simply
> set appropriate CXXFLAGS as in
>
>     CXXFLAGS= -g -O3 -Wall -pipe -Wno-unused -pedantic -std=c++11
>
> (I usually do that in ~/.R/Makevars; you can also set it per package in
> src/Makevars).
>
> Can you try and report back?
>
> Dirk

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev