eddelbuettel / rquantlib

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

installation documentation for macOS is incorrect #154

Open drchriscole opened 3 years ago

drchriscole commented 3 years ago

I realise this has already been raised on #141 but the issue still stands that the documentation is incorrect for macOS.

Also as it is RQuantLib does not work on macOS using the default instructions. This is what I get when trying load it in R 4.0.3 macOS Catalina.

> library(RQuantLib)
Sufficient QuantLib version with insufficient configuration.
Try configuring your build with the --enable-intraday argument.

As previously stated the Homebrew install has the '--enable-intraday' argument enabled.

I'll also open a ticket with Homebrew and see where the problem stems from as it appears it all should work.

eddelbuettel commented 3 years ago

So ... why are you opening a duplicate issue rather than just commenting on the existing one? What does this add? What could I possibly do -- I cannot influence the brew folks.

eddelbuettel commented 3 years ago

If there is documentation to fix, could you kindly provide a URL or file link? I can surely take a look but a global "docs borked" is not exactly operational. As I said a few over the nearly two decades of this project, I don't have a macOS box so ...

drchriscole commented 3 years ago

The point is that this isn't brew problem, as far as I can tell. QuantLib is installed with the correct flags as per the requirements of RQuantLib.

Step 4 on the wiki for macOS should be: brew install quantlib

The current version of quantlib in Homebrew is 1.21 so step 6 is unnecessary (plus it seems those 'inline's are already there.

Finally, in step 8 I get a whole bunch of deprecated warnings and build fails with:

Error: package or namespace load failed for ‘RQuantLib’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/ccole/Library/R/4.0/library/00LOCK-RQuantLib/00new/RQuantLib/libs/RQuantLib.so':
  dlopen(/Users/ccole/Library/R/4.0/library/00LOCK-RQuantLib/00new/RQuantLib/libs/RQuantLib.so, 6): Symbol not found: __ZN8QuantLib13MultiStepSwap12nextTimeStepERKNS_10CurveStateERSt6vectorImSaImEERS4_IS4_INS_23MarketModelMultiProduct8CashFlowESaIS9_EESaISB_EE
  Referenced from: /Users/ccole/Library/R/4.0/library/00LOCK-RQuantLib/00new/RQuantLib/libs/RQuantLib.so
  Expected in: flat namespace
 in /Users/ccole/Library/R/4.0/library/00LOCK-RQuantLib/00new/RQuantLib/libs/RQuantLib.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/ccole/Library/R/4.0/library/RQuantLib’
Warning in install.packages :
  installation of package ‘RQuantLib’ had non-zero exit status
eddelbuettel commented 3 years ago

Ok, now I know to look at the wiki, thanks. That was missing.

The 'flat namespace' rings a bell, I think we have seen this with other packages too and I think it has something to do with your local macOS setup. I am sorry that I don't have a pointer as I am not a macOS user myself. Here is one from RcppArmadillo being apparently related to mixing gcc/g++ and clang. Here is one from Rcpp suggesting that if you install something from source that uses Rcpp you may also need Rcpp from source. In sum this suggests that your mixing with precompiled units from brew may not be as plug-and-play as you hoped?

Could you compile QuantLib, Rcpp, RQuantLib from source to check this?

drchriscole commented 3 years ago

Just realised that was using gcc v8 from Homebrew. Trying again with the default clang in macOS also has loads of deprecation warnings e.g.

In file included from zero.cpp:20:
In file included from ../inst/include/rquantlib_internal.h:23:
In file included from /usr/local/include/ql/quantlib.hpp:58:
In file included from /usr/local/include/ql/termstructures/all.hpp:18:
In file included from /usr/local/include/ql/termstructures/yield/all.hpp:16:
/usr/local/include/ql/termstructures/yield/nonlinearfittingmethods.hpp:262:14: warning: 'auto_ptr<QuantLib::FittedBondDiscountCurve::FittingMethod>' is deprecated [-Wdeprecated-declarations]
        std::auto_ptr<FittedBondDiscountCurve::FittingMethod> clone() const;
             ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2135:28: note: 'auto_ptr<QuantLib::FittedBondDiscountCurve::FittingMethod>' has been explicitly marked deprecated here
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr
                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1030:39: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX11'
#  define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
                                      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1019:48: note: expanded from macro '_LIBCPP_DEPRECATED'
#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
                                               ^
66 warnings generated.

I can have a look at compiling from source, but not for a few days. I'll keep you posted.

eddelbuettel commented 3 years ago

Oh, that is better! Deprecation warnings are a pest, especially as CRAN has a formal (!!) policy to not allow us to suppress them (!!) in packages which is annoying (but makes sense for debugging). The best fix we have is to add them in our personal ~/.R/Makevars so I have something commented I often add back in / alter:

#XTRAFLAGS=-Wno-misleading-indentation -Wno-unused -Wno-ignored-attributes -Wno-parentheses -Wno-address-of-packed-member
[....]
CFLAGS=               -g -O3 -Wall -pipe $(PEDANTIC) $(XTRAFLAGS) -std=gnu99

CXXFLAGS=               -g -O3 -Wall -pipe $(PEDANTIC) $(XTRAFLAGS)
CXX1XFLAGS=     -g -O3 -Wall -pipe $(PEDANTIC) $(XTRAFLAGS)
CXX11FLAGS=     -g -O3 -Wall -pipe $(PEDANTIC) $(XTRAFLAGS)
CXX14FLAGS=     -g -O3 -Wall -pipe $(PEDANTIC) $(XTRAFLAGS)
CXX17FLAGS=     -g -O3 -Wall -pipe $(PEDANTIC) $(XTRAFLAGS)

Adjust XTRAFLAGS as needed.

Really appreciate the help on macOS. The 'Venn diagram intersection' of R && QuantLib && macOS && chops_to_build_from_source is pretty sparse.

drchriscole commented 3 years ago

Damn, I forgot the rest of it., sorry. The compilation still failed.

installing to /Users/ccole/Library/R/4.0/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 sh: line 1: 22570 Bus error: 10 R_TESTS= '/Library/Frameworks/R.framework/Resources/bin/R' --no-save --no-restore --no-echo 2>&1 < '/var/folders/75/b_5cscrd0dgbbm8n7xxpp8g8wnd8nl/T//RtmplOCplQ/file334e7f408967'

caught bus error address 0x10b9a6ee0, cause 'non-existent physical address'

Traceback: 1: dyn.load(file, DLLpath = DLLpath, ...) 2: library.dynam(lib, package, package.lib) 3: loadNamespace(package, lib.loc) 4: doTryCatch(return(expr), name, parentenv, handler) 5: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 6: tryCatchList(expr, classes, parentenv, handlers) 7: tryCatch({ attr(package, "LibPath") <- which.lib.loc ns <- loadNamespace(package, lib.loc) env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)}, error = function(e) { P <- if (!is.null(cc <- conditionCall(e))) paste(" in", deparse(cc)[1L]) else "" msg <- gettextf("package or namespace load failed for %s%s:\n %s", sQuote(package), P, conditionMessage(e)) if (logical.return) message(paste("Error:", msg), domain = NA) else stop(msg, call. = FALSE, domain = NA)}) 8: library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) 9: withCallingHandlers(expr, packageStartupMessage = function(c) tryInvokeRestart("muffleMessage")) 10: suppressPackageStartupMessages(library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE)) 11: doTryCatch(return(expr), name, parentenv, handler) 12: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 13: tryCatchList(expr, classes, parentenv, handlers) 14: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call)[1L] prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))}) 15: try(suppressPackageStartupMessages(library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE))) 16: tools:::.test_load_package("RQuantLib", "/Users/ccole/Library/R/4.0/library/00LOCK-RQuantLib/00new") An irrecoverable exception occurred. R is aborting now ... ERROR: loading failed

  • removing ‘/Users/ccole/Library/R/4.0/library/RQuantLib’ Warning in install.packages : installation of package ‘RQuantLib’ had non-zero exit status
eddelbuettel commented 3 years ago

Those things tends to go away with Rcpp built from source, along with the Rcpp-using package from source.

"Our problem here" is that the same fix may be needed for QuantLib itself which is Yuge and takes a jolly moment to build.

drchriscole commented 3 years ago

I couldn't let this go ;)

Have compiled all three (QuantLib, Rcpp and RQuantlib) from source. No change. Expanding errors to include last compile step:

clang++ -mmacosx-version-min=10.13 -std=gnu++11 -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 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 -L/usr/local/lib -L/usr/local/lib -lQuantLib -L/usr/local/lib/ -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Users/ccole/Library/R/4.0/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
sh: line 1: 59050 Bus error: 10           R_TESTS= '/Library/Frameworks/R.framework/Resources/bin/R' --no-save --no-restore --no-echo 2>&1 < '/var/folders/75/b_5cscrd0dgbbm8n7xxpp8g8wnd8nl/T//RtmptlAYqg/filec1a655866c98'

 *** caught bus error ***
address 0x1086f2150, cause 'non-existent physical address'

Traceback:
 1: dyn.load(file, DLLpath = DLLpath, ...)
 2: library.dynam(lib, package, package.lib)
 3: loadNamespace(package, lib.loc)
 4: doTryCatch(return(expr), name, parentenv, handler)
 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 6: tryCatchList(expr, classes, parentenv, handlers)
 7: tryCatch({    attr(package, "LibPath") <- which.lib.loc    ns <- loadNamespace(package, lib.loc)    env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)}, error = function(e) {    P <- if (!is.null(cc <- conditionCall(e)))         paste(" in", deparse(cc)[1L])    else ""    msg <- gettextf("package or namespace load failed for %s%s:\n %s",         sQuote(package), P, conditionMessage(e))    if (logical.return)         message(paste("Error:", msg), domain = NA)    else stop(msg, call. = FALSE, domain = NA)})
 8: library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE)
 9: withCallingHandlers(expr, packageStartupMessage = function(c) tryInvokeRestart("muffleMessage"))
10: suppressPackageStartupMessages(library(pkg_name, lib.loc = lib,     character.only = TRUE, logical.return = TRUE))
11: doTryCatch(return(expr), name, parentenv, handler)
12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
13: tryCatchList(expr, classes, parentenv, handlers)
14: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call)[1L]        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
15: try(suppressPackageStartupMessages(library(pkg_name, lib.loc = lib,     character.only = TRUE, logical.return = TRUE)))
16: tools:::.test_load_package("RQuantLib", "/Users/ccole/Library/R/4.0/library/00LOCK-RQuantLib/00new")
An irrecoverable exception occurred. R is aborting now ...
ERROR: loading failed
* removing ‘/Users/ccole/Library/R/4.0/library/RQuantLib’
Warning in install.packages :
  installation of package ‘RQuantLib’ had non-zero exit status

There are the commands used: QuantLib

./configure --with-boost-include=/usr/local/include/ \
            --with-boost-lib=/usr/local/lib/ --prefix=/usr/local/ \
            CXXFLAGS='-O2 -stdlib=libc++ -mmacosx-version-min=10.13' \
            LDFLAGS='-stdlib=libc++ -mmacosx-version-min=10.13'
make
sudo make install

As per their instructions I ran the example which worked fine.

Rcpp install.packages('Rcpp', type = 'source')

RQuantLib install.packages("RQuantLib", configure.args = "--with-boost-include=/usr/local/include/ --with-boost-lib=/usr/local/lib/", type = "source")

This is on an intel Mac, macOS (10.15.7 Catalina) and R 4.0.3. Let me know if there's anything else I can try.

eddelbuettel commented 3 years ago

I couldn't let this go ;)

That is the spirit.

I do not have good pointers (as I don't use macOS) but a) we had [when the macOS maintainer at CRAN had time to build QuantLib] working macOS packages so there is no foundational issue and b) I have of course in near-20 years of mucking with QuantLib and RQuantLib (and having Rcpp "fall out" as a happy side effect) seen segfaults like that---invariably they were of my making. Maybe another piece in the middle is still bad / a path wrong pointing to the wrong build / ...

I would now try to triangulate. With QuantLib sources you have examples. Do those build and run? (I guess). Can R call code via Rcpp? Do the old Rcpp::evalCpp("2+2") (which will too). Then step by step meet the two. Write a five liner with a QuantLib header and "manually" link. Then add RQuantLib. In other words a lot of poking with large sticks. Luckily, including R, you really only have four parts...

eddelbuettel commented 3 years ago

Crap. Forgot about Boost. There you go. Likely culprit :-/

drchriscole commented 3 years ago

Recompiled Boost from source with same outcome :(

The QuantLib examples run fine as do Rcpp calls. Can you elaborate further on the "Write a five liner with a QuantLib header and "manually" link." bit please? I'm not much of a C++ coder and even less one via Rcpp.

eddelbuettel commented 3 years ago

Dang. That makes it weirder.

Sorry, for the five liner (or, with the verbosity of QuantLib, fifty) I meant to add a header file, instantiate object and just print 'hello, world, still here' to again close the gap a little more the working pieces and the fuller (but not working package).

drchriscole commented 3 years ago

Created this hello.cpp code:

#include <Rcpp.h>
#include <ql/quantlib.hpp>
// [[Rcpp::export]]
void hello()
{
  Rprintf("Hello, quantlib world!\n");
}

And then ran it as:

library(Rcpp)
sourceCpp('hello.cpp')
hello()

Got a whole bunch of warnings (just like when compiling RQuantLib), but it printed out 'Hello, quantlib world|" just fine. Any other ideas?

p.s. I also did this in a new user account on the same mac with no difference.

eddelbuettel commented 3 years ago

I assume you are aware of a) the options for sourceCpp() and cppFunction() to point to dependencies as one does .e.g. with RcppArmadillo to get header and/or RcppGSL to get header and the required library b) that this is actually not actively advertised (I think) as something that works cross-platform with RQuantLib -- I think I looked into it once or twice or three times in the past for use on Linux, and there is of course R/inline.R but I don't think I ever stated "do this on macOS".

So with that: which section of which document are you looking at that makes you think this was working? The overall in the wiki covers, if I recall correctly, only basic install. More could be done, but someone has to lay down the ground work first. Maybe you can?

drchriscole commented 3 years ago

Your assumptions regarding Rcpp are incorrect. I have no experience of it at all so am just going on what I find on stackoverflow ;) So if there's any more detailed pointers or links I can follow, I'd be happy o try.>

which section of which document are you looking at that makes you think this was working?

What do you mean by "this"? The Rcpp call, QuantLib, or something else?

From what I can see is that by including 'ql/quantlib.hpp' in the basic code, the header is being compiled into the final executable (hence all the deprecation warnings), but of course nothing is being used.

eddelbuettel commented 3 years ago

E.g. your Subject: line here "installation documentation ... incorrect" but I am not all-knowing all-seeing and do not know what document you may have read.

I assume you understand the technical implication of 'header included' possibly leading to 'object instantiated' requiring linking. C++ can be setup differently via header-only libraries and there even once was a trial for (R)QuantLib which I wrapped here -- while not current with current QuantLib it is (far) better than nuttin' at all.

matthewgson commented 3 years ago

I had similar issue - installing brew install quantlib and disabling Makevars to use apple complier then install.packages("RQuantLib", configure.args = "--with-boost-include=/usr/local/include/ --with-boost-lib=/usr/local/lib/", type = "source") worked. I've updated wiki... hope this might help.

eddelbuettel commented 3 years ago

Thanks for the edit. I don't have a macOS machine so we rely on community-curation.

hoantran999 commented 2 years ago

For those who are using Macbook M1 If you install quantlib using brew, it will be installed under /opt/homebrew instead of /usr/local, and boost also installed under /opt/homebrew/

This is what I did: I have installed quantlib using brew: Disable Makevars by deleting Makevars in /Users/yourname/.R folder

Change this line "/usr/local/include to /opt/homebrew/include (or create a symbolic link) install.packages("RQuantLib", configure.args = "--with-boost-include=/opt/homebrew/include/ --with-boost-lib=/opt/homebrew/lib/", type = "source")

it worked for me.

kupietools commented 8 months ago

I'm having a hard time getting this to work. I'm trying to build from source because I need the intraday enabled. The machine it's on is running Catalina. I installed boostwith Macports, I don't use Homebrew. I did install.packages('Rcpp', type = 'source') in R.app, no problem. But install.packages("RQuantLib", configure.args = "--with-boost-include=/usr/local/include/ --with-boost-lib=/usr/local/lib/", type = "source") seems to be caught in some sort of endless loop, it's giving me a huge block of warnings ending in:

#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
                                               ^
66 warnings generated.

EDIT: After waiting a while, finally it coughed up a bunch of blocks resembling:

vanilla.cpp:89:9: error: unknown type name 'QL_DEPRECATED_DISABLE_WARNING'
        QL_DEPRECATED_DISABLE_WARNING
        ^
vanilla.cpp:90:24: error: template specialization requires 'template<>'        QuantLib::ext::shared_ptr<QuantLib::PricingEngine> engine(new QuantLib::AnalyticDividendEuropeanEngine(stochProcess));                       ^         ~~~~~~~~~~~~~~~~~~~~~~~~~vanilla.cpp:90:24: error: no variable template matches specialization
vanilla.cpp:90:59: error: expected ';' at end of declaration
        QuantLib::ext::shared_ptr<QuantLib::PricingEngine> engine(new QuantLib::AnalyticDividendEuropeanEngine(stochProcess));
                                                          ^
                                                          ;
vanilla.cpp:94:9: error: unknown type name 'QL_DEPRECATED_ENABLE_WARNING'
        QL_DEPRECATED_ENABLE_WARNING
        ^
vanilla.cpp:95:15: error: expected ';' at end of declaration
        option.setPricingEngine(engine);
              ^
              ;
vanilla.cpp:188:9: error: unknown type name 'QL_DEPRECATED_DISABLE_WARNING'
        QL_DEPRECATED_DISABLE_WARNING
        ^
vanilla.cpp:189:19: error: definition or redeclaration of 'DividendVanillaOption' not allowed inside a function
        QuantLib::DividendVanillaOption option(payoff, exercise, discDivDates, discDividends);
        ~~~~~~~~~~^
vanilla.cpp:189:19: error: no member named 'DividendVanillaOption' in namespace 'QuantLib'
        QuantLib::DividendVanillaOption option(payoff, exercise, discDivDates, discDividends);
        ~~~~~~~~~~^
vanilla.cpp:189:40: error: expected ';' at end of declaration
        QuantLib::DividendVanillaOption option(payoff, exercise, discDivDates, discDividends);
                                       ^
                                       ;
vanilla.cpp:190:9: error: use of undeclared identifier 'QL_DEPRECATED_ENABLE_WARNING'        QL_DEPRECATED_ENABLE_WARNING        ^66 warnings and 11 errors generated.
make: *** [vanilla.o] Error 1

before finally concluding with

ERROR: compilation failed for package 'RQuantLib'
* removing '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RQuantLib'

The downloaded source packages are in
    '/private/var/folders/lh/cf_s95f529q8l9mv82s84y4m0000gp/T/RtmpdvosWp/downloaded_packages'
Warning message:
In install.packages("RQuantLib", configure.args = "--with-boost-include=/usr/local/include/ --with-boost-lib=/usr/local/lib/",  :
  installation of package 'RQuantLib' had non-zero exit status

I looked for

Makevars in /Users/yourname/.R folder

but I have no .R folder in my home directory, visible or invisible.

eddelbuettel commented 8 months ago

I am sorry to hear you are have troubling on macOS. As I do not use the platform, I will not be able to help you much. That said, r-universe appears to have to trouble with either x86_64 or amd64 macOS. Which makes sense as this is a pretty vanilla (if large, on the QuantLib side) package.

The screenshot is from https://eddelbuettel.r-universe.dev/RQuantLib, which itself hangs off 'my' r-universe page at https://eddelbuettel.r-universe.dev/RQuantLib.

image

Similarly, CRAN has no issues (apart from outdated Boost warnings not yet taken care of on macOS).

image

CRAN also tells us what they use:

image

So if in doubt, make sure you have compilers / OS versions as recent as theirs.

eddelbuettel commented 8 months ago

Whoops. But that at least alerted me to the fact that I had committed and pushed to github following the most recent release 0.4.21. Done now. So r-universe will 'soon' (usually about an hour) also show 0.4.21.

kupietools commented 8 months ago

Thanks for the speedy reply. You've got me at a bit of a loss here as this is all a little bit out of my wheelhouse... I first became acquainted with R, looked at it for the very first time ever, about 4 hours ago, so a lot of this is still greek to me. When I woke up this morning I still thought I'd be doing all this in Excel, but that's a non-starter, so here I am.

On the MacOS side, the compilers/hardware/os versions on that screenshot, if that's the minimum requirement, completely preclude repurposing my still-good old hardware for this... I'm already running the latest XCode this OS can run (with Apple Clang 12.) However: I had no problem installing a precompiled binary with install.packages("RQuantLib", type = "binary") and using it on this machine, the binary just doesn't have the intraday enabled. I'm also right this minute recompiling quantlib from source on it, which appears to be going without a hitch. So it would appear there's not necessarily an insurmountable obstacle to building rquantlib on Catalina (MacOS X 10.15), I'm just not sure what's preventing it for me.

I'll give it an hour and then poke around those links you give and see if I can figure anything out.

Basically, I think what's happening here is probably a knowledge gap on my end, nobody's responsibility but my own, but if anyone can spot it and let me know how to get where I need to be with this, I'd appreciate it. I've got to do intraday calcs. My future vast personal fortune depends on it.

eddelbuettel commented 8 months ago

You are approaching it the right way, I think. It all decomposes.

Start at your R prompt with Rcpp::evalCpp("21 + 21") which should return the eternal answer 42. That means you can compile. Next will be to see if you can compile with the same toolchain use by R against the Boost libraries you. Maybe "accidentally" mixed R and brew; I think that is said to not work (but I don't know for sure). And so on. Eventually once you

then you should be in business. Nobody said it was simple but it should be feasible. If it is all too much you could also try developing on Linux by virtue of a Docker container.

kupietools commented 8 months ago

I don't use Homebrew so no worries there. I installed boost with Macports, which puts things in the standard expected locations (I checked.) Not entirely sure how to proceed with trying to recompile; I don't do a lot of work in compiled languages so it's all a bit foreign to me. I know how to download a .zip from github, cd into the folder, ./configure and make, but nothing beyond, or how to deal if something goes wrong. So from ' Next will be to see if you can compile with the same toolchain [...etc...]' on, I'm sure I can eventually translate into what I actually need to do, but, it doesn't immediately mean anything to me. I'll puzzle it out though.

Parenthetically, as it happens, after decades of being a Mac guy, I've been very tempted in the last few months to switch to Linux for primary use anyway. My needs are getting more technical over time, while MacOS is turning more and more into a toy. Plus I already run 2 Debian VMs full-time for other purposes, and, surprisingly, more and more, they're proving to be easier to deal with than the latest few versions of MacOS.

Thanks for your tips!

eddelbuettel commented 8 months ago

Well Debian maintainer of QuantLib here so I can help. Ubuntu is also good (happens to be what I use on desktop/server and laptop) so I happen to also build QuantLib there in my PPA. If you want to try that, your life is likely going to be easier.

[ I have nothing against macOS. I just don't know it, and I get more interactions with users when "stuff ain't working" which may bias me a little. The hardware is nice, I once 'inherited' two by now too-old-and-weak macbooks from my kids. ]

matthewgson commented 1 month ago

I recently had a chance to revisit (re-install) RQuantLib on macOS and update the wiki. Many of the instructions were outdated and misleading (e.g., you should not install quantlib from brew for the intraday feature). I confirmed that it works fine (at least for me).

eddelbuettel commented 1 month ago

Thanks @matthewgson -- maybe next time when you edit ping me and we can review. (While I am repo owner I do not get updates on wiki changes...)