Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: download quantlib on macos if not found locally #176

Merged
merged 2 commits into from
Apr 27, 2023
Merged

CI: download quantlib on macos if not found locally #176

merged 2 commits into from
Apr 27, 2023

Conversation

jeroen
Copy link
Contributor

@jeroen jeroen commented Apr 27, 2023

This will allow the package to be built in CI or r-universe or by mac users locally, with the same quantlib as CRAN.

On systems where quantlib-config is found (such as cran itself), that configuration is used, and nothing is downloaded. So it functions as a fallback method for mac systems where quantlib is not available.

PS: if you use this, I recommend mirroring the downloaded files from cran somewhere (e.g. github release assets) because mac.r-project.org is pretty slow and flaky.

Copy link
Owner

@eddelbuettel eddelbuettel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks promising. Is that 'mac' directory at CRAN browseable?

@jeroen
Copy link
Contributor Author

jeroen commented Apr 27, 2023

The build works, but one of your tests has a weird error: Cannot supply LdFlags as none . I think your tests are assuming that quantlib-config is always available? (which is not the case for static lib or prebuilt binaries).

rquantlib/R/inline.R

Lines 38 to 49 in 8540c94

## on Linux and OS X, see if we have quantlib-config which may well be
## false in the case of prebuild binary packages as eg r-cran-rquantlib
## on Debian / Ubuntu as well as the OS X package from CRAN
## first we check whether we have quantlib-config in the path
if (isTRUE(unname(Sys.which("quantlib-config")) != "")) {
qc <- system("bash -c 'type -p quantlib-config'", ignore.stderr=TRUE, intern=TRUE)
if (is.character(qc) && nchar(qc) > 1) {
qlcflags <- system(paste(qc, "--cflags"), intern = TRUE)
qllibs <- system(paste(qc, "--libs"), intern = TRUE)
}
}
}

@eddelbuettel
Copy link
Owner

I think your tests are assuming that quantlib-config is always available?

Is it my tests, or my 'ad-hoc' build script used by the test? It could just be the latter.

Feel free for brute force testing to comment out the overtall hook into tinytest from tests/tinytest.R. If we have a build working (and I really appreciate the helping hand!) we can possibly tweak the rest in step two.

@jeroen
Copy link
Contributor Author

jeroen commented Apr 27, 2023

OK I disabled that test on mac (that was already disabled on windows) so the build passes now.

@eddelbuettel
Copy link
Owner

Nice.

In the flurry you may have missed what I asked earlier

Is that 'mac' directory at CRAN browseable?

I.e. can I know how old his packages are? But I answered that by pointing a browser at https://mac.r-project.org/bin/darwin20/arm64/. Looks like Simon updates once a year or more often if he musts.

@jeroen
Copy link
Contributor Author

jeroen commented Apr 27, 2023

They updated the libs last month for the R 4.3 release, but I suspect not much updates for another 2 years after this until they bump to a new macos version.

@eddelbuettel eddelbuettel merged commit af4e4c6 into eddelbuettel:master Apr 27, 2023
@eddelbuettel
Copy link
Owner

Of course now I have to figure out how to only trigger macOS when I have the patience for it :)

@jeroen
Copy link
Contributor Author

jeroen commented Apr 27, 2023

The build will be a bit faster if you mirror those 4 files to some of faster server (or just anywhere on github):

rquantlib/configure.ac

Lines 93 to 99 in af4e4c6

if test "`arch`" == "arm64" ; then
quantlib="https://mac.r-project.org/bin/darwin20/arm64/QuantLib-1.27.1-darwin.20-arm64.tar.xz"
boost="https://mac.r-project.org/bin/darwin20/arm64/boost-1.80.0-darwin.20-arm64.tar.xz"
else
quantlib="https://mac.r-project.org/bin/darwin20/x86_64/QuantLib-1.27.1-darwin.20-x86_64.tar.xz"
boost="https://mac.r-project.org/bin/darwin20/x86_64/boost-1.80.0-darwin.20-x86_64.tar.xz"
fi

Either way good luck, I'm done for the day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants