assignUser commented on code in PR #37684:
URL: https://github.com/apache/arrow/pull/37684#discussion_r1340506133
##########
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:
Yeah that makes sense, I'll check for openssl/opensslv.h
--
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]