ARROW-12098: [R] Catch cpp build failures on linux

The installation looks like this now in the default case if the build script errors:

```
* installing *source* package ‘arrow’ ...
** using staged installation
*** Found local C++ source
*** Building C++ libraries
**** cmake
**** arrow
**** Error building Arrow C++. Re-run with ARROW_R_DEV=true for debug information.
------------------------- NOTE ---------------------------
See https://arrow.apache.org/docs/r/articles/install.html
for help installing Arrow C++ libraries
---------------------------------------------------------
```

This PR also (1) restores the arrow-without-arrow wrapping (from #9689) and (2) adds an .onAttach message for the arrow-without-arrow case to hopefully alert users earlier that they have an incomplete/useless build. If you do get a without-arrow build, this is what the loading message looks like:

```
> library(arrow)
The Arrow C++ library is not available. To retry installation with debug output, run:
    install_arrow(verbose = TRUE)
See https://arrow.apache.org/docs/r/articles/install.html for more guidance and troubleshooting.

Attaching package: ‘arrow’

The following object is masked from ‘package:utils’:

    timestamp

```

It *also* adds an .onAttach message if you have a build with optional features disabled (e.g. S3, lz4, etc.):

```
> library(arrow)
See arrow_info() for available features

Attaching package: ‘arrow’

The following object is masked from ‘package:utils’:

    timestamp
```

`arrow_info()` will then (on Linux only) also print a message pointing you to the installation vignette if there are missing features:

```
> arrow_info()
Arrow package version: 3.0.0.9000

Capabilities:

dataset    TRUE
parquet    TRUE
s3         TRUE
utf8proc   TRUE
re2        TRUE
snappy     TRUE
gzip       TRUE
brotli     TRUE
zstd       TRUE
lz4        TRUE
lz4_frame  TRUE
lzo       FALSE
bz2        TRUE
jemalloc   TRUE
mimalloc  FALSE

To reinstall with more features enabled, see
  https://arrow.apache.org/docs/r/articles/install.html

...
```

Certain compression libraries (like lzo) are on a blocklist that excludes them from this extra messaging. The purpose of all of this is to give more hints to users when they have limited builds and give them guidance on how to enhance them, while at the same time not overly broadcasting this (which would promote FUD) and trying to be clear that you don't *always* have to `install_arrow()` after `install.packages()`.

Closes #9896 from nealrichardson/nix-install-debug

Authored-by: Neal Richardson <neal.p.richardson@gmail.com>
Signed-off-by: Neal Richardson <neal.p.richardson@gmail.com>
This commit is contained in:
Neal Richardson
2021-04-09 10:19:51 -07:00
parent 78b9c0cd05
commit e433ca40db
3 changed files with 28 additions and 17 deletions
+12 -7
View File
@@ -37,10 +37,17 @@ if [ "$ARROW_R_DEV" = "TRUE" ]; then
# Note that NOT_CRAN=true means (among other things) that optional dependencies are built
export NOT_CRAN=true
fi
export TEST_R_WITH_ARROW=TRUE
export _R_CHECK_TESTS_NLINES_=0
: ${TEST_R_WITH_ARROW:=TRUE}
export TEST_R_WITH_ARROW=$TEST_R_WITH_ARROW
export _R_CHECK_CRAN_INCOMING_REMOTE_=FALSE
# --run-donttest was used in R < 4.0, this is used now
export _R_CHECK_DONTTEST_EXAMPLES_=$TEST_R_WITH_ARROW
# Not all Suggested packages are needed for checking, so in case they aren't installed don't fail
export _R_CHECK_FORCE_SUGGESTS_=FALSE
export _R_CHECK_LIMIT_CORES_=FALSE
export _R_CHECK_TESTS_NLINES_=0
# By default, aws-sdk tries to contact a non-existing local ip host
# to retrieve metadata. Disable this so that S3FileSystem tests run faster.
export AWS_EC2_METADATA_DISABLED=TRUE
@@ -49,9 +56,6 @@ export AWS_EC2_METADATA_DISABLED=TRUE
export TEXMFCONFIG=/tmp/texmf-config
export TEXMFVAR=/tmp/texmf-var
# Not all Suggested packages are needed for checking, so in case they aren't installed don't fail
export _R_CHECK_FORCE_SUGGESTS_=FALSE
if [[ "$DEVTOOLSET_VERSION" -gt 0 ]]; then
# enable the devtoolset version to use it
source /opt/rh/devtoolset-$DEVTOOLSET_VERSION/enable
@@ -61,8 +65,9 @@ fi
BEFORE=$(ls -alh ~/)
SCRIPT="as_cran <- !identical(tolower(Sys.getenv('NOT_CRAN')), 'true')
run_donttest <- identical(tolower(Sys.getenv('_R_CHECK_DONTTEST_EXAMPLES_', 'true')), 'true')
if (as_cran) {
rcmdcheck::rcmdcheck(args = c('--as-cran', '--run-donttest'), error_on = 'warning', check_dir = 'check', timeout = 3600)
rcmdcheck::rcmdcheck(args = c('--as-cran', if (run_donttest) '--run-donttest'), error_on = 'warning', check_dir = 'check', timeout = 3600)
} else {
if (nzchar(Sys.which('minio'))) {
message('Running minio for S3 tests (if build supports them)')
@@ -71,7 +76,7 @@ SCRIPT="as_cran <- !identical(tolower(Sys.getenv('NOT_CRAN')), 'true')
pid <- sys::exec_background('minio', c('server', minio_dir))
on.exit(tools::pskill(pid))
}
rcmdcheck::rcmdcheck(build_args = '--no-build-vignettes', args = c('--no-manual', '--ignore-vignettes', '--run-donttest'), error_on = 'warning', check_dir = 'check', timeout = 3600)
rcmdcheck::rcmdcheck(build_args = '--no-build-vignettes', args = c('--no-manual', '--ignore-vignettes', if (run_donttest) '--run-donttest'), error_on = 'warning', check_dir = 'check', timeout = 3600)
}"
echo "$SCRIPT" | ${R_BIN} --no-save
+4 -2
View File
@@ -47,8 +47,7 @@ jobs:
export R_ORG={{ r_org }}
export R_IMAGE={{ r_image }}
export R_TAG={{ r_tag }}
# we have to export this (right?) because we need it in the build env
export ARROW_R_DEV={{ not_cran }}
export ARROW_R_DEV={{ not_cran|default("TRUE") }}
# Note that ci/scripts/r_test.sh sets NOT_CRAN=true if ARROW_R_DEV=TRUE
docker-compose run \
-e ARROW_DATASET={{ arrow_dataset|default("") }} \
@@ -57,6 +56,9 @@ jobs:
-e ARROW_WITH_RE2={{ arrow_with_re2|default("") }} \
-e ARROW_WITH_UTF8PROC={{ arrow_with_utf8proc|default("") }} \
-e LIBARROW_MINIMAL={{ libarrow_minimal|default("") }} \
-e LIBARROW_DOWNLOAD={{ libarrow_download|default("") }} \
-e LIBARROW_BUILD={{ libarrow_build|default("") }} \
-e TEST_R_WITH_ARROW={{ with_arrow|default("TRUE") }} \
r
displayName: Docker run
+12 -8
View File
@@ -1763,7 +1763,6 @@ tasks:
r_org: rhub
r_image: ubuntu-gcc-release
r_tag: latest
not_cran: "TRUE"
test-r-rocker-r-base-latest:
ci: azure
@@ -1772,7 +1771,6 @@ tasks:
r_org: rocker
r_image: r-base
r_tag: latest
not_cran: "TRUE"
test-r-rstudio-r-base-3.6-bionic:
ci: azure
@@ -1781,7 +1779,6 @@ tasks:
r_org: rstudio
r_image: r-base
r_tag: 3.6-bionic
not_cran: "TRUE"
test-r-rstudio-r-base-3.6-centos8:
ci: azure
@@ -1790,7 +1787,6 @@ tasks:
r_org: rstudio
r_image: r-base
r_tag: 3.6-centos8
not_cran: "TRUE"
test-r-rstudio-r-base-3.6-centos7-devtoolset-8:
ci: azure
@@ -1799,7 +1795,6 @@ tasks:
r_org: rstudio
r_image: r-base
r_tag: 3.6-centos7
not_cran: "TRUE"
devtoolset_version: 8
test-r-rstudio-r-base-3.6-opensuse15:
@@ -1809,7 +1804,6 @@ tasks:
r_org: rstudio
r_image: r-base
r_tag: 3.6-opensuse15
not_cran: "TRUE"
test-r-rstudio-r-base-3.6-opensuse42:
ci: azure
@@ -1818,7 +1812,6 @@ tasks:
r_org: rstudio
r_image: r-base
r_tag: 3.6-opensuse42
not_cran: "TRUE"
test-r-minimal-build:
ci: azure
@@ -1827,7 +1820,6 @@ tasks:
r_org: rocker
r_image: r-base
r_tag: latest
not_cran: "TRUE"
arrow_dataset: "OFF"
arrow_parquet: "OFF"
arrow_s3: "OFF"
@@ -1835,6 +1827,18 @@ tasks:
arrow_with_utf8proc: "OFF"
libarrow_minimal: "TRUE"
test-r-without-arrow:
ci: azure
template: r/azure.linux.yml
params:
r_org: rhub
r_image: ubuntu-gcc-release
r_tag: latest
libarrow_download: "FALSE"
libarrow_build: "FALSE"
with_arrow: "FALSE"
not_cran: "FALSE"
test-ubuntu-18.04-r-sanitizer:
ci: azure
template: docker-tests/azure.linux.yml