Skip to content

Commit

Permalink
apacheGH-34105: [R] Provide extra output for failed builds (apache#37727
Browse files Browse the repository at this point in the history
)

### Rationale for this change

This is a replacement for the previous PR apache#37698. The rationale for this PR is providing extra output for R package builds where the C++ build fails

### What changes are included in this PR?

Update the system call to save output when building Arrow C++ from the R package and output it if it's failed

### Are these changes tested?

No automated tests but the changes have been tested manually.

### Are there any user-facing changes?

Yes, but only for users building the R package from source which is hopefully not common.
* Closes: apache#34105

Lead-authored-by: Bryce Mecum <petridish@gmail.com>
Co-authored-by: Nic Crane <thisisnic@gmail.com>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
  • Loading branch information
amoeba and thisisnic committed Sep 15, 2023
1 parent b7a9951 commit 697bebb
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions r/tools/nixlibs.R
Original file line number Diff line number Diff line change
Expand Up @@ -466,17 +466,25 @@ build_libarrow <- function(src_dir, dst_dir) {
env_vars <- env_vars_as_string(env_var_list)

cat("**** arrow", ifelse(quietly, "", paste("with", env_vars)), "\n")
status <- suppressWarnings(system(
paste(env_vars, "inst/build_arrow_static.sh"),
ignore.stdout = quietly, ignore.stderr = quietly

build_log_path <- tempfile(fileext = ".log")
status <- suppressWarnings(system2(
"bash",
"inst/build_arrow_static.sh",
env = env_vars,
stdout = ifelse(quietly, build_log_path, ""),
stderr = ifelse(quietly, build_log_path, "")
))

if (status != 0) {
# It failed :(
cat(
"**** Error building Arrow C++.",
ifelse(env_is("ARROW_R_DEV", "true"), "", "Re-run with ARROW_R_DEV=true for debug information."),
"\n"
)
cat("**** Error building Arrow C++.", "\n")
if (quietly) {
cat("**** Printing contents of build log because the build failed",
"while ARROW_R_DEV was set to FALSE\n")
cat(readLines(build_log_path), sep = "\n")
cat("**** Complete build log may still be present at", build_log_path, "\n")
}
}
invisible(status)
}
Expand Down

0 comments on commit 697bebb

Please sign in to comment.