[Rquantlib-devel] RQuantLib on Mac OS X 10.10

Benjamin Voigt bvoigt at gmail.com
Sat Aug 6 23:37:38 CEST 2016


Dirk,

thank you. This solved the issue on my side. I have just been adding the following line into my .R/Makevars:
CXXFLAGS += -stdlib=libstdc++

After that "install.packages("RQuantLib", type="source”)” worked - except for numerous boost warnings.

I am not exactly sure why this needs to be present. Seems to be related to c++11 support. Some discussion here:
http://stackoverflow.com/questions/19774778/when-is-it-necessary-to-use-use-the-flag-stdlib-libstdc

@George: Did the .R/Makevars change resolve you issue too? 

Regards,
Ben

> On 06 Aug 2016, at 17:31, Dirk Eddelbuettel <edd at debian.org> wrote:
> 
> 
> On 6 August 2016 at 15:45, Benjamin Voigt wrote:
> | George,
> | 
> | it’s been a while (before OS X.11) since I have used RQuantLib. I have tried a
> | fresh build today following the guide at QuantLib (http://quantlib.org/install/
> | macosx.shtml). When trying an example of QuantLib I had to add the compiler
> | flag "-stdlib=libstdc++” or else I would get an “architecture x86_64” error.
> | When trying to install RQuantLib from source I noticed that this flag is
> | missing. Perhaps that is something to try to see if you have the same issue.
> | 
> | If you know how to add "-stdlib=libstdc++” to the build compiler flags for
> | RQuantLib I believe that should solve your issues, and mine for that matter :)
> 
> Weird.
> 
> Why do we need this here, and not for any of the other C++ using packages on CRAN?
> 
> Short tip:  You can set it locally outside the package via something like this:
> 
>      edd at max:~$ grep ^CXX.*FLAGS .R/Makevars
>      CXXFLAGS +=           -O3 -Wall -pipe -Wno-unused 
>      CXX1XFLAGS=-O3 -Wall -pipe -Wno-unused
>      edd at max:~$ 
> 
> It will affect all your C++ builds for R. 
> 
> | If I find some time tomorrow I will try to dig into that a little more…
> 
> I would appreciate this.  We can add it easily via configure -- but I would
> like to know why we need it.
> 
> Dirk
> 
> | Regards,
> | Ben 
> | 
> | 
> | 
> |     On 06 Aug 2016, at 05:46, George <grandtiger at gmail.com> wrote:
> | 
> |     Following is the error, when I try to install RQuantLib using the command
> |     below. 
> | 
> |     install.packages("https://cran.r-project.org/src/contrib/
> |     RQuantLib_0.4.2.tar.gz", repo=NULL, type='source', configure.args=
> |     "--with-boost-include=/opt/local/include/ --with-boost-lib=/opt/local/lib/
> |     ")
> | 
> |     I wonder anyone has experience with this, and whether there is a solution. 
> |     Thanks a lot and have a great weekend!
> | 
> |     ############################################
> | 
> |     66 warnings generated.
> | 
> |     clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined
> |     dynamic_lookup -single_module -multiply_defined suppress -L/Library/
> |     Frameworks/R.framework/Resources/lib -L/usr/local/lib -o RQuantLib.so
> |     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
> |     schedule.o utils.o vanilla.o zero.o -L/opt/local/lib -L/opt/local/lib
> |     -lQuantLib -L/opt/local/lib/ -F/Library/Frameworks/R.framework/..
> |     -framework R -Wl,-framework -Wl,CoreFoundation
> | 
> |     installing to /Library/Frameworks/R.framework/Versions/3.3/Resources/
> |     library/RQuantLib/libs
> | 
> |     ** R
> | 
> |     ** demo
> | 
> |     ** inst
> | 
> |     ** preparing package for lazy loading
> | 
> |     ** help
> | 
> |     *** installing help indices
> | 
> |     ** building package indices
> | 
> |     ** testing if installed package can be loaded
> | 
> |     Error in dyn.load(file, DLLpath = DLLpath, ...) : 
> | 
> |       unable to load shared object '/Library/Frameworks/R.framework/Versions/
> |     3.3/Resources/library/RQuantLib/libs/RQuantLib.so':
> | 
> |       dlopen(/Library/Frameworks/R.framework/Versions/3.3/Resources/library/
> |     RQuantLib/libs/RQuantLib.so, 6): Symbol not found:
> |     __ZN8QuantLib13FixedRateBondC1EjdRKNS_8ScheduleERKNSt3__16vectorIdNS4_9allocatorIdEEEERKNS_10DayCounterENS_21BusinessDayConventionEdRKNS_4DateERKNS_8CalendarERKNS_6PeriodESK_SE_b
> | 
> |       Referenced from: /Library/Frameworks/R.framework/Versions/3.3/Resources/
> |     library/RQuantLib/libs/RQuantLib.so
> | 
> |       Expected in: flat namespace
> | 
> |      in /Library/Frameworks/R.framework/Versions/3.3/Resources/library/
> |     RQuantLib/libs/RQuantLib.so
> | 
> |     Error: loading failed
> | 
> |     Execution halted
> | 
> |     ERROR: loading failed
> | 
> |     * removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/
> |     RQuantLib’
> | 
> |     Warning message:
> | 
> |     In install.packages("https://cran.r-project.org/src/contrib/
> |     RQuantLib_0.4.2.tar.gz",  :
> | 
> |       installation of package ‘/tmp/RtmpNWaFiC/downloaded_packages/
> |     RQuantLib_0.4.2.tar.gz’ had non-zero exit status
> | 
> |     > clang: error: invalid library name in argument '-stdlib=libstdc'clang:
> |     error: invalid library name in argument '-stdlib=libstdc'clang: error:
> |     invalid library name in argument '-stdlib=libstdc'clang: error: invalid
> |     library name in argument '-stdlib=libstdc'if installed package can be
> |     loadedclang: error: invalid library name in argument '-stdlib=
> |     libstdc'clang: error: invalid library name in argument '-stdlib=
> |     libstdc'clang: error: invalid library name in argument '-stdlib=
> |     libstdc'clang: error: invalid library name in argument '-stdlib=
> |     libstdc'clang: error: invalid library name in argument '-stdlib=
> |     libstdc'clan
> | 
> |     Error: unexpected symbol in "clang: error: invalid library"
> | 
> |     > if installed package can be loaded
> | 
> |     Error: unexpected symbol in "if installed"
> | 
> |     > if installed package can be loaded
> | 
> |     Error: unexpected symbol in "if installed"
> | 
> |     > if installed package can be loaded
> | 
> |     Error: unexpected symbol in "if installed"
> | 
> |     > if installed package can be loaded
> | 
> |     Error: unexpected symbol in "if installed"
> | 
> |     > if installed package can be loaded
> | 
> |     Error: unexpected symbol in "if installed"
> | 
> | 
> |     On Fri, Aug 5, 2016 at 7:17 AM, George Wang <grandtiger at gmail.com> wrote:
> | 
> |         Hi Ben,
> | 
> |         Do you have any quick guide for building and installing RQuantLib on
> |         Mac OSX? I was able to use macport to install boost and build QuantLib,
> |         but when I try to install RQuantLib from source, I always got errors
> |         (can provide more details when I get home tonight). I am wondering how
> |         you get it to work. Thanks a lot and have a great weekend!
> | 
> |         Regards,
> |         George
> | 
> |         Sent from my iPhone
> | 
> |         On Oct 28, 2014, at 5:01 PM, Benjamin J. J. Voigt <bvoigt at gmail.com>
> |         wrote:
> | 
> | 
> |             Hi,
> | 
> |             first post, bear with me. 
> | 
> |             On this matter, it works fine on 10.9.x. RStudio seems to have
> |             fixed on their end. Since I have recently rebuilt both QuantLib and
> |             RQuantLib several times on stable and development sources on my
> |             10.9.x environment just running RQuantLib has never been an issue.
> | 
> |             As a workaround, perhaps you could try to create a script to launch
> |             through the terminal so that the environment variables are loaded
> |             properly?
> | 
> |             Regards,
> |             Ben
> | 
> |             On Tue, Oct 28, 2014 at 6:41 PM, Dirk Eddelbuettel <edd at debian.org>
> |             wrote:
> | 
> | 
> |                 On 28 October 2014 at 11:35, Jack Drew wrote:
> |                 | Recently, I am trying to create a new RQuantLib setup. I am
> |                 on mac os x 10.10 and R 3.0.2. I have installed QuantLib 1.4,
> |                 and RQuantLib. From my terminal, within R, I can require
> |                 RQuantLib and use it with no problems. However, if I try to
> |                 require RQuantLib within the R GUI or within my StatET Eclipse,
> |                 I get:
> |                 |
> |                 | Loading required package: RQuantLib
> |                 | Error : .onLoad failed in loadNamespace() for 'RQuantLib',
> |                 details:
> |                 | call: if (is.character(qc) && nchar(qc) > 1) {
> |                 | error: missing value where TRUE/FALSE needed
> |                 | In addition: Warning message:
> |                 | running command 'bash -c 'type -p quantlib-config' 2>/dev/
> |                 null' had status 1
> |                 |
> |                 | I am not sure what I am missing, since the package works fine
> |                 from the terminal. Please help, if you are able to.
> | 
> |                 So quantlib-config is not found.
> | 
> |                 I don't own (or access) an OS X machine but even I noticed all
> |                 these hoopla
> |                 over 10.10 not setting PATH -- that could be the culprit.
> |                 Google for
> |                 something like
> | 
> |                           RStudio "OS X" 10.10 PATH
> | 
> |                 and you just get pointers.  One trick appears to be to launch
> |                 RStudio from
> |                 the term.app.
> |                
> |                 Dirk
> | 
> |                 --
> |                 http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
> |                 _______________________________________________
> |                 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
> |            
> | 
> | 
> | 
> |             -- 
> |             Ben
> | 
> |             “In God we trust, all others bring data.” W. Edwards Deming
> | 
> |             _______________________________________________
> |             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
> | 
> | 
> | 
> | 
> | _______________________________________________
> | 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