paleolimbot commented on code in PR #37684:
URL: https://github.com/apache/arrow/pull/37684#discussion_r1343064320
##########
r/tools/nixlibs.R:
##########
@@ -191,33 +202,50 @@ test_for_curl_and_openssl <- "
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#error Using OpenSSL version 3
#endif
-"
+")
compile_test_program <- function(code) {
- # Note: if we wanted to check for openssl on macOS, we'd have to set the brew
- # path as a -I directory. But since we (currently) only run this code to
- # determine whether we can download a Linux binary, it's not relevant.
+ openssl_dir <- ""
+ if(on_macos) {
+ openssl_root_dir <- get_macos_openssl_dir()
+ openssl_dir <- paste0("-I", openssl_root_dir, "/include")
+ }
runner <- paste(
R_CMD_config("CXX17"),
+ openssl_dir,
R_CMD_config("CPPFLAGS"),
R_CMD_config("CXX17FLAGS"),
R_CMD_config("CXX17STD"),
"-E",
- "-xc++"
- )
+ "-xc++" )
suppressWarnings(system2("echo", sprintf('"%s" | %s -', code, runner),
stdout = FALSE, stderr = TRUE))
}
+get_macos_openssl_dir <- function(){
+ openssl_root_dir <- Sys.getenv("OPENSSL_ROOT_DIR", NA)
+ if (is.na(openssl_root_dir)) {
+ # try to guess default openssl include dir based on CRAN's build script
+ # https://github.com/R-macos/recipes/blob/master/build.sh#L35
+ if(identical(Sys.info()["machine"], "arm64")){
+ openssl_root_dir <- "/opt/R/arm64"
+ } else if (file.exists("/opt/R/x86_64")) {
+ openssl_root_dir <- "/opt/R/x86_64"
+ } else {
+ openssl_root_dir <- "/usr/local"
+ }
+ }
+ return(openssl_root_dir)
Review Comment:
> I don't have those headers in that location so that means I wouldn't be
able to install the binary
I think in a static linking scenario a binary install would be fine? A
source install would be problematic (but perhaps in the interest of getting
this into the nightly builds/allowing a wider variety of people to test we
could move that to a follow-up? (IIRC, `pkg-config` would work for both the
recipes and homebrew install of openssl but also doesn't quite give you the
root directory directly).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]