From bc10adc39e44f0a2c6a2b98e2214255aa6ca8c73 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Wed, 9 Oct 2024 21:46:18 -0500 Subject: [PATCH 01/21] clean up configure script a bit --- configure | 61 ++++++----------------------- src/RcppExports.cpp | 12 +++--- tools/test_absl.cc | 6 +++ tools/{version.c => test_openssl.c} | 0 4 files changed, 23 insertions(+), 56 deletions(-) create mode 100644 tools/test_absl.cc rename tools/{version.c => test_openssl.c} (100%) diff --git a/configure b/configure index c394cf3b..a705048f 100755 --- a/configure +++ b/configure @@ -1,4 +1,8 @@ -# Anticonf (tm) script by Jeroen Ooms (2020) + +# This configure script finds OpenSSL and Abseil, optionally building +# Abseil if not found. + +# Anticonf (tm) script by Jeroen Ooms (2020) for finding OpenSSL # This script will query 'pkg-config' for the required cflags and ldflags. # If pkg-config is unavailable or does not find the library, try setting # INCLUDE_DIR and LIB_DIR manually via e.g: @@ -8,9 +12,8 @@ PKG_CONFIG_NAME="openssl" PKG_DEB_NAME="libssl-dev" PKG_RPM_NAME="openssl-devel" -PKG_CSW_NAME="libssl_dev" -PKG_BREW_NAME="openssl@1.1" -PKG_TEST_FILE="tools/version.c" +PKG_BREW_NAME="openssl" +PKG_TEST_FILE="tools/test_openssl.c" PKG_LIBS="-lssl -lcrypto" PKG_CFLAGS="" @@ -30,16 +33,6 @@ elif [ "$PKGCONFIG_CFLAGS" ] || [ "$PKGCONFIG_LIBS" ]; then echo "Found pkg-config cflags and libs!" PKG_CFLAGS=${PKGCONFIG_CFLAGS} PKG_LIBS=${PKGCONFIG_LIBS} -elif [ `uname` = "Darwin" ]; then - test ! "$CI" && brew --version 2>/dev/null - if [ $? -eq 0 ]; then - BREWDIR=`brew --prefix` - PKG_CFLAGS="-I$BREWDIR/opt/openssl/include -I$BREWDIR/opt/openssl@1.1/include" - PKG_LIBS="-L$BREWDIR/opt/openssl/lib -L$BREWDIR/opt/openssl@1.1/lib $PKG_LIBS" - else - curl -sfL "https://autobrew.github.io/scripts/$PKG_BREW_NAME" > autobrew - . ./autobrew - fi fi # Find compiler @@ -59,7 +52,6 @@ if [ $? -ne 0 ]; then echo "Configuration failed because $PKG_CONFIG_NAME was not found. Try installing:" echo " * deb: $PKG_DEB_NAME (Debian, Ubuntu, etc)" echo " * rpm: $PKG_RPM_NAME (Fedora, CentOS, RHEL)" - echo " * csw: $PKG_CSW_NAME (Solaris)" echo " * brew: $PKG_BREW_NAME (Mac OSX)" echo "If $PKG_CONFIG_NAME is already installed, check that 'pkg-config' is in your" echo "PATH and PKG_CONFIG_PATH contains a $PKG_CONFIG_NAME.pc file. If pkg-config" @@ -71,45 +63,14 @@ if [ $? -ne 0 ]; then exit 1 fi -# Try to link against the correct OpenSSL version -if [ -z "$AUTOBREW" ]; then -SONAME=`${CC} -E ${PKG_CFLAGS} src/tests/soname.h | sh | xargs` -if [ "$SONAME" ]; then -if [ `uname` = "Darwin" ]; then - PKG_LIBS_VERSIONED=`echo "${PKG_LIBS}" | sed "s/-lssl/-lssl.${SONAME}/" | sed "s/-lcrypto/-lcrypto.${SONAME}/"` -else - PKG_LIBS_VERSIONED=`echo "${PKG_LIBS}" | sed "s/-lssl/-l:libssl.so.${SONAME}/" | sed "s/-lcrypto/-l:libcrypto.so.${SONAME}/"` -fi - -# Test if versioned linking works -${CC} ${PKG_CFLAGS} src/tests/main.c ${PKG_LIBS_VERSIONED} -o src/main.exe 2>/dev/null -if [ $? -eq 0 ]; then PKG_LIBS="${PKG_LIBS_VERSIONED}"; fi -rm src/main.exe || true - -# Suppress opensslv3 warnings for now -if [ "$SONAME" = "3" ]; then -PKG_CFLAGS="$PKG_CFLAGS -DOPENSSL_SUPPRESS_DEPRECATED" -fi - -fi #SONAME -fi #AUTOBREW - -# Check pkg-config for abseil-cpp, but fall back to a cmake build. -# This should possibly be updated to check that the pkg-config detected -# version will actually work; however, the version of abseil that included -# pkg-config files is about the same as the minimum version required here. +# Check pkg-config for abseil-cpp, but fall back to a cmake build +# because a sufficient version of abseil-cpp is not available on +# all platforms (notably, Ubuntu 20.04 and Ubuntu 22.04). export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:`pwd`/tools/pkgconfig" -# Allow developers to set R_S2_ABSL_HOME in .Renviron to avoid building -# Abseil on every package rebuild. This can be built from this directory using -# tools/build_absl.sh path/to/dir (then R_S2_ABSL_HOME=path/to/dir in .Renviron) -if [ ! -z "${R_S2_ABSL_HOME}" ]; then - export PKG_CONFIG_PATH="{$R_S2_ABSL_HOME}/lib/pkgconfig:${PKG_CONFIG_PATH}" -fi - echo "** Using PKG_CONFIG_PATH=${PKG_CONFIG_PATH}" -if pkg-config absl_s2 --libs 2>/dev/null; then +if pkg-config absl_s2 --libs >/dev/null 2>/dev/null; then echo "** Using abseil-cpp from pkg-config" PKGCONFIG_CFLAGS=`pkg-config --cflags-only-I absl_s2` diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 6350151d..24a5ac1b 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -1344,12 +1344,12 @@ BEGIN_RCPP END_RCPP } -RcppExport SEXP c_s2_geography_writer_new(void *, void *, void *, void *); -RcppExport SEXP c_s2_handle_geography(void *, void *); -RcppExport SEXP c_s2_handle_geography_tessellated(void *, void *); -RcppExport SEXP c_s2_projection_mercator(void *); -RcppExport SEXP c_s2_projection_orthographic(void *); -RcppExport SEXP c_s2_projection_plate_carree(void *); +RcppExport SEXP c_s2_geography_writer_new(SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP c_s2_handle_geography(SEXP, SEXP); +RcppExport SEXP c_s2_handle_geography_tessellated(SEXP, SEXP); +RcppExport SEXP c_s2_projection_mercator(SEXP); +RcppExport SEXP c_s2_projection_orthographic(SEXP); +RcppExport SEXP c_s2_projection_plate_carree(SEXP); RcppExport SEXP c_s2_trans_s2_lnglat_new(void); RcppExport SEXP c_s2_trans_s2_point_new(void); diff --git a/tools/test_absl.cc b/tools/test_absl.cc new file mode 100644 index 00000000..c460daaf --- /dev/null +++ b/tools/test_absl.cc @@ -0,0 +1,6 @@ + +#include "absl/base/config.h" + +#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20230802L +#error "Abseil C++ version is too old" +#endif diff --git a/tools/version.c b/tools/test_openssl.c similarity index 100% rename from tools/version.c rename to tools/test_openssl.c From a5cfb1f96ba4647ed70fd54a219ff5340ee59e54 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Wed, 9 Oct 2024 21:55:22 -0500 Subject: [PATCH 02/21] update pkgdown action --- .github/workflows/pkgdown.yaml | 8 ++++++-- _pkgdown.yml | 28 ++++++++-------------------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 51b79c18..130d63e3 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -11,6 +11,8 @@ on: name: pkgdown +permissions: read-all + jobs: pkgdown: runs-on: ubuntu-latest @@ -19,8 +21,10 @@ jobs: group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 @@ -39,7 +43,7 @@ jobs: - name: Deploy to GitHub pages 🚀 if: github.event_name != 'pull_request' - uses: JamesIves/github-pages-deploy-action@4.1.4 + uses: JamesIves/github-pages-deploy-action@v4.5.0 with: clean: false branch: gh-pages diff --git a/_pkgdown.yml b/_pkgdown.yml index 5a84a97a..c92e1ae3 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,9 +1,8 @@ -url: https://r-spatial.github.io/s2 +url: https://r-spatial.github.io/s2/ development: mode: auto template: bootstrap: 5 - reference: - title: Geography Constructors and Exporters desc: Convert objects to and from geography vectors @@ -18,7 +17,6 @@ reference: - s2_geog_from_wkb - s2_as_text - s2_as_binary - - title: Geography Transformations desc: Functions that operate on geography vectors and return geography vectors contents: @@ -32,7 +30,6 @@ reference: - s2_snap_to_grid - s2_union_agg - s2_centroid_agg - - title: Binary Geography Predicates desc: Functions that operate two geography vectors and return a logical vector contents: @@ -46,9 +43,9 @@ reference: - s2_touches - s2_within - s2_dwithin - - title: Geography Accessors - desc: Functions that operate one or more geography vectors and return a vector of values + desc: Functions that operate one or more geography vectors and return a vector of + values contents: - s2_is_collection - s2_is_empty @@ -63,35 +60,26 @@ reference: - s2_distance - s2_max_distance - s2_bounds_cap - - title: Matrix Functions desc: These functions return various relationships between two geography vectors - contents: - - s2_closest_feature - + contents: s2_closest_feature - title: Linear Referencing - contents: - - s2_interpolate - + contents: s2_interpolate - title: S2 Cell Utilities contents: - s2_cell_union - s2_cell_union_normalize - s2_cell - s2_cell_is_valid - - title: Utility Functions contents: - s2_earth_radius_meters - s2_options - s2_plot - - title: Example Data desc: Useful data for testing and demonstrating s2 functions - contents: - - starts_with("s2_data") - + contents: starts_with("s2_data") - title: Low-level Details desc: Interact with spherical geometry at a low level - contents: - - wk_handle.s2_geography + contents: wk_handle.s2_geography + From 668ddc38c02aa44018aaee99db8bbfc042a0d0f5 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Wed, 9 Oct 2024 22:06:35 -0500 Subject: [PATCH 03/21] update actions --- .../{check-standard.yaml => R-CMD-check.yaml} | 36 ++++++++++--------- .github/workflows/test-coverage.yaml | 10 ++++-- 2 files changed, 27 insertions(+), 19 deletions(-) rename .github/workflows/{check-standard.yaml => R-CMD-check.yaml} (68%) diff --git a/.github/workflows/check-standard.yaml b/.github/workflows/R-CMD-check.yaml similarity index 68% rename from .github/workflows/check-standard.yaml rename to .github/workflows/R-CMD-check.yaml index b61e50d5..e8881a79 100644 --- a/.github/workflows/check-standard.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,4 +1,4 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/master/examples +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: @@ -8,6 +8,8 @@ on: name: R-CMD-check +permissions: read-all + jobs: R-CMD-check: runs-on: ${{ matrix.config.os }} @@ -18,9 +20,9 @@ jobs: fail-fast: false matrix: config: - - {os: macOS-latest, r: 'release'} # TODO: Solve Abseil linking issue on R 4.0 and R 4.1/Windows # - {os: windows-latest, r: '4.1'} + - {os: macos-latest, r: 'release'} - {os: windows-latest, r: '4.2'} - {os: windows-latest, r: '4.3'} - {os: windows-latest, r: 'release'} @@ -33,7 +35,7 @@ jobs: R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 @@ -43,25 +45,27 @@ jobs: http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true + - name: Install Abseil (MacOS) + if: matrix.config.os == 'macos-latest' + run: | + brew install abseil + + - name: Install Abseil (Ubuntu) + if: matrix.config.os == 'ubuntu-latest' + run: | + sudo apt-get update && sudo apt-get install -y libabsl-dev + - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: rcmdcheck + extra-packages: any::rcmdcheck + needs: check - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' - name: Show install output if: always() run: find check -name '00install.out*' -exec cat '{}' \; || true shell: bash - - - name: Show testthat output - if: always() - run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true - shell: bash - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main - with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 4b01af75..e827c42e 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -1,5 +1,3 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/master/examples -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: branches: [main, master] @@ -8,6 +6,8 @@ on: name: test-coverage +permissions: read-all + jobs: test-coverage: runs-on: ubuntu-latest @@ -15,12 +15,16 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true + - name: Install Abseil (Ubuntu) + run: | + sudo apt-get update && sudo apt-get install -y libabsl-dev + - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: covr From 490cfd41d6b991197392c73313be37d9d9ba9521 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Wed, 9 Oct 2024 22:12:47 -0500 Subject: [PATCH 04/21] readme update --- README.Rmd | 30 +++++++++++++++++++----------- README.md | 37 +++++++++++++++++++++++-------------- 2 files changed, 42 insertions(+), 25 deletions(-) diff --git a/README.Rmd b/README.Rmd index bc16a2f5..ff1fa3a4 100644 --- a/README.Rmd +++ b/README.Rmd @@ -16,15 +16,15 @@ knitr::opts_chunk$set( # s2 -![R-CMD-check](https://github.com/r-spatial/s2/workflows/R-CMD-check/badge.svg) -[![codecov](https://codecov.io/gh/r-spatial/s2/branch/master/graph/badge.svg)](https://app.codecov.io/gh/r-spatial/s2) +[![R-CMD-check](https://github.com/r-spatial/s2/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-spatial/s2/actions/workflows/R-CMD-check.yaml) +[![codecov](https://codecov.io/gh/r-spatial/s2/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-spatial/s2) [![CRAN](http://www.r-pkg.org/badges/version/s2)](https://cran.r-project.org/package=s2) [![Downloads](http://cranlogs.r-pkg.org/badges/s2?color=brightgreen)](https://www.r-pkg.org/pkg/s2) The s2 R package provides bindings to Google's [S2Geometry](http://s2geometry.io) library. The package exposes an API similar to Google's [BigQuery Geography API](https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions), whose functions also operate on spherical geometries. Package [sf](https://cran.r-project.org/package=sf) uses this package by default for nearly all its geometrical operations on objects with ellipsoidal (unprojected) coordinates; in cases where it doesn't, such as `st_relate()`, it emits a warning. -This package is a complete rewrite of an earlier CRAN package s2 with versions up +This package is a complete rewrite of an earlier CRAN package s2 with versions up to 0.4-2, for which the sources are found [here](https://github.com/spatstat/s2/). ## Installation @@ -42,6 +42,14 @@ And the development version from [GitHub](https://github.com/) with: remotes::install_github("r-spatial/s2") ``` +The S2 package requires [Abseil]() and OpenSSL. You can install these using a system package manager on most platforms: + +- Windows: Both OpenSSL and Abseil are available from RTools since R 4.3 +- MacOS: `brew install openssl abseil` +- Debian/Ubuntu: `apt-get install libssl-dev libabsl-dev` +- Fedora: `dnf install openssl-devel abseil-cpp-devel` +- Alpine: `apk add abseil-cpp` + ## Example The s2 package provides geometry transformers and predicates similar to those found in [GEOS](https://trac.osgeo.org/geos/), except instead of assuming a planar geometry, s2's functions work in latitude and longitude and assume a spherical geometry: @@ -63,9 +71,9 @@ The [sf package](https://r-spatial.github.io/sf/) uses s2 for geographic coordin library(dplyr) library(sf) -nc_s2 <- read_sf(system.file("shape/nc.shp", package = "sf")) %>% - mutate(geometry = as_s2_geography(geometry)) %>% - as_tibble() %>% +nc_s2 <- read_sf(system.file("shape/nc.shp", package = "sf")) %>% + mutate(geometry = as_s2_geography(geometry)) %>% + as_tibble() %>% select(NAME, geometry) nc_s2 @@ -74,7 +82,7 @@ nc_s2 Use accessors to extract information about geometries: ```{r} -nc_s2 %>% +nc_s2 %>% mutate( area = s2_area(geometry), perimeter = s2_perimeter(geometry) @@ -84,22 +92,22 @@ nc_s2 %>% Use predicates to subset vectors: ```{r} -nc_s2 %>% +nc_s2 %>% filter(s2_contains(geometry, "POINT (-80.9313 35.6196)")) ``` Use transformers to create new geometries: ```{r} -nc_s2 %>% +nc_s2 %>% mutate(geometry = s2_boundary(geometry)) ``` Finally, use the WKB or WKT exporters to export to sf or some other package: ```{r} -nc_s2 %>% - mutate(geometry = st_as_sfc(s2_as_binary(geometry))) %>% +nc_s2 %>% + mutate(geometry = st_as_sfc(s2_as_binary(geometry))) %>% st_as_sf() ``` diff --git a/README.md b/README.md index 6b958e2a..41172202 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ -![R-CMD-check](https://github.com/r-spatial/s2/workflows/R-CMD-check/badge.svg) -[![codecov](https://codecov.io/gh/r-spatial/s2/branch/master/graph/badge.svg)](https://app.codecov.io/gh/r-spatial/s2) +[![R-CMD-check](https://github.com/r-spatial/s2/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-spatial/s2/actions/workflows/R-CMD-check.yaml) +[![codecov](https://codecov.io/gh/r-spatial/s2/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-spatial/s2) [![CRAN](http://www.r-pkg.org/badges/version/s2)](https://cran.r-project.org/package=s2) [![Downloads](http://cranlogs.r-pkg.org/badges/s2?color=brightgreen)](https://www.r-pkg.org/pkg/s2) @@ -41,6 +41,15 @@ And the development version from [GitHub](https://github.com/) with: remotes::install_github("r-spatial/s2") ``` +The S2 package requires [Abseil]() and OpenSSL. You can install these +using a system package manager on most platforms: + +- Windows: Both OpenSSL and Abseil are available from RTools since R 4.3 +- MacOS: `brew install openssl abseil` +- Debian/Ubuntu: `apt-get install libssl-dev libabsl-dev` +- Fedora: `dnf install openssl-devel abseil-cpp-devel` +- Alpine: `apk add abseil-cpp` + ## Example The s2 package provides geometry transformers and predicates similar to @@ -69,9 +78,9 @@ using `as_s2_geography()`: library(dplyr) library(sf) -nc_s2 <- read_sf(system.file("shape/nc.shp", package = "sf")) %>% - mutate(geometry = as_s2_geography(geometry)) %>% - as_tibble() %>% +nc_s2 <- read_sf(system.file("shape/nc.shp", package = "sf")) %>% + mutate(geometry = as_s2_geography(geometry)) %>% + as_tibble() %>% select(NAME, geometry) nc_s2 @@ -88,13 +97,13 @@ nc_s2 #> 8 Gates POLYGON ((-76.46035 36.3738976, -76.5024643 36.4522858, -76.4983… #> 9 Warren POLYGON ((-78.1347198 36.2365837, -78.1096268 36.2135086, -78.05… #> 10 Stokes POLYGON ((-80.0240555 36.5450249, -80.0480957 36.5471344, -80.43… -#> # … with 90 more rows +#> # ℹ 90 more rows ``` Use accessors to extract information about geometries: ``` r -nc_s2 %>% +nc_s2 %>% mutate( area = s2_area(geometry), perimeter = s2_perimeter(geometry) @@ -112,13 +121,13 @@ nc_s2 %>% #> 8 Gates POLYGON ((-76.46035 36.3738976, -76.5024643 36.… 9.03e8 123170. #> 9 Warren POLYGON ((-78.1347198 36.2365837, -78.1096268 3… 1.18e9 141073. #> 10 Stokes POLYGON ((-80.0240555 36.5450249, -80.0480957 3… 1.23e9 140583. -#> # … with 90 more rows +#> # ℹ 90 more rows ``` Use predicates to subset vectors: ``` r -nc_s2 %>% +nc_s2 %>% filter(s2_contains(geometry, "POINT (-80.9313 35.6196)")) #> # A tibble: 1 × 2 #> NAME geometry @@ -129,7 +138,7 @@ nc_s2 %>% Use transformers to create new geometries: ``` r -nc_s2 %>% +nc_s2 %>% mutate(geometry = s2_boundary(geometry)) #> # A tibble: 100 × 2 #> NAME geometry @@ -144,15 +153,15 @@ nc_s2 %>% #> 8 Gates LINESTRING (-76.46035 36.3738976, -76.5024643 36.4522858, -76.49… #> 9 Warren LINESTRING (-78.1347198 36.2365837, -78.1096268 36.2135086, -78.… #> 10 Stokes LINESTRING (-80.0240555 36.5450249, -80.0480957 36.5471344, -80.… -#> # … with 90 more rows +#> # ℹ 90 more rows ``` Finally, use the WKB or WKT exporters to export to sf or some other package: ``` r -nc_s2 %>% - mutate(geometry = st_as_sfc(s2_as_binary(geometry))) %>% +nc_s2 %>% + mutate(geometry = st_as_sfc(s2_as_binary(geometry))) %>% st_as_sf() #> Simple feature collection with 100 features and 1 field #> Geometry type: GEOMETRY @@ -172,7 +181,7 @@ nc_s2 %>% #> 8 Gates POLYGON ((-76.46035 36.3739, -76.50246 36.45229, -76.49834 36.50… #> 9 Warren POLYGON ((-78.13472 36.23658, -78.10963 36.21351, -78.05835 36.2… #> 10 Stokes POLYGON ((-80.02406 36.54502, -80.0481 36.54713, -80.43531 36.55… -#> # … with 90 more rows +#> # ℹ 90 more rows ``` ## Acknowledgment From 3383f4fee58b63d2d91db28fed37bb29a90dd0d9 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Wed, 9 Oct 2024 22:17:19 -0500 Subject: [PATCH 05/21] update roxygen --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 78bd8a91..249c5b03 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,7 +25,7 @@ License: Apache License (== 2.0) Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.2 SystemRequirements: OpenSSL >= 1.0.1, Abseil >= 20230802.0 LinkingTo: Rcpp, From d21c2a85d1c8c12d1c47e2bdc63234eade88f19a Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Wed, 9 Oct 2024 23:08:49 -0500 Subject: [PATCH 06/21] add compose setup --- .Rbuildignore | 1 + docker-compose.yml | 8 ++++++++ tests/testthat/test-s2-cell.R | 2 ++ tools/docker/ubuntu-focal.dockerfile | 12 ++++++++++++ 4 files changed, 23 insertions(+) create mode 100644 docker-compose.yml create mode 100644 tools/docker/ubuntu-focal.dockerfile diff --git a/.Rbuildignore b/.Rbuildignore index b8a674fa..bfce554a 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -16,3 +16,4 @@ ^tools/dist$ ^compile_commands\.json$ ^\.cache$ +^docker-compose\.yml$ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..82df6ffc --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + ubuntu-focal: + build: + context: . + dockerfile: tools/docker/ubuntu-focal.dockerfile + volumes: + - .:/s2 + command: bash diff --git a/tests/testthat/test-s2-cell.R b/tests/testthat/test-s2-cell.R index 27a938df..fb02b7a0 100644 --- a/tests/testthat/test-s2-cell.R +++ b/tests/testthat/test-s2-cell.R @@ -11,6 +11,8 @@ test_that("s2_cell class works", { }) test_that("s2_cell bit64::integer64 support works", { + skip_if_not_installed("bit64") + cells <- c(as_s2_cell(NA_character_), s2_cell_sentinel()) int64s <- bit64::as.integer64(cells) expect_identical(int64s, bit64::as.integer64(c(NA, -1))) diff --git a/tools/docker/ubuntu-focal.dockerfile b/tools/docker/ubuntu-focal.dockerfile new file mode 100644 index 00000000..37b5953b --- /dev/null +++ b/tools/docker/ubuntu-focal.dockerfile @@ -0,0 +1,12 @@ + +FROM ubuntu:focal + +ENV TZ=UTC +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + r-base cmake \ + libudunits2-dev libgdal-dev libgeos-dev libproj-dev \ + libcurl4-openssl-dev libssl-dev + +# Make sure we can use all cores to install things +RUN mkdir ~/.R && echo "MAKEFLAGS = -j$(nproc)" > ~/.R/Makevars +RUN R -e 'install.packages(c("wk", "Rcpp", "testthat"), repos = "https://cloud.r-project.org")' From d0fa79e08b72c813bb03c87600d5f63ab7647f71 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Wed, 9 Oct 2024 23:13:08 -0500 Subject: [PATCH 07/21] try --- .github/workflows/R-CMD-check.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index e8881a79..d3ece6dd 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -11,11 +11,30 @@ name: R-CMD-check permissions: read-all jobs: + test: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - name: Install Abseil (MacOS) + run: brew install abseil + - name: Install minimal dependencies + run: | + R -e 'install.packages(c("wk", "Rcpp", "testthat"))' + - name: Install + run: | + R CMD INSTALL . + - name: Test + run: | + R -e 'testthat::test_local()' + R-CMD-check: runs-on: ${{ matrix.config.os }} name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + needs: + - test + strategy: fail-fast: false matrix: From 3410cf04a3b5f301db5e6ab9f141de46d28ff78a Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Wed, 9 Oct 2024 23:46:53 -0500 Subject: [PATCH 08/21] setup r --- .github/workflows/R-CMD-check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index d3ece6dd..1be5a134 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -15,6 +15,7 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 + - uses: r-lib/actions/setup-r@v2 - name: Install Abseil (MacOS) run: brew install abseil - name: Install minimal dependencies From 5755dda0a13845b2dd8e1bbf9312133e7d17e83f Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Thu, 10 Oct 2024 09:59:28 -0500 Subject: [PATCH 09/21] document smoke check --- .github/workflows/R-CMD-check.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 1be5a134..8ab40e77 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -11,6 +11,7 @@ name: R-CMD-check permissions: read-all jobs: + # Check MacOS first before embarking on the full check matrix test: runs-on: macos-latest steps: @@ -20,7 +21,7 @@ jobs: run: brew install abseil - name: Install minimal dependencies run: | - R -e 'install.packages(c("wk", "Rcpp", "testthat"))' + R -e 'install.packages(c("wk", "Rcpp", "bit64", "testthat"))' - name: Install run: | R CMD INSTALL . From 6c78b052feed164fcfdbcaba87304e2cfd7a6eec Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Thu, 10 Oct 2024 11:09:34 -0500 Subject: [PATCH 10/21] setup for ubuntus --- configure | 2 +- docker-compose.yml | 57 ++++++++++++++++++- ...ntu-focal.dockerfile => debian.dockerfile} | 7 ++- 3 files changed, 60 insertions(+), 6 deletions(-) rename tools/docker/{ubuntu-focal.dockerfile => debian.dockerfile} (76%) diff --git a/configure b/configure index a705048f..1fb23e8b 100755 --- a/configure +++ b/configure @@ -30,7 +30,7 @@ if [ "$INCLUDE_DIR" ] || [ "$LIB_DIR" ]; then PKG_CFLAGS="-I$INCLUDE_DIR $PKG_CFLAGS" PKG_LIBS="-L$LIB_DIR $PKG_LIBS" elif [ "$PKGCONFIG_CFLAGS" ] || [ "$PKGCONFIG_LIBS" ]; then - echo "Found pkg-config cflags and libs!" + echo "Found OpenSSL pkg-config cflags and libs!" PKG_CFLAGS=${PKGCONFIG_CFLAGS} PKG_LIBS=${PKGCONFIG_LIBS} fi diff --git a/docker-compose.yml b/docker-compose.yml index 82df6ffc..564793e0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,59 @@ + +# Docker compose setup for testing s2 package install +# +# The s2 R package requires OpenSSL and Abseil, of which Abseil +# is not trivially installable. Because of this, we have several +# strategies for locating or building a version of it from the +# configure script. This file (and the images it refers to in +# tools/docker) are to make sure that the install works on a +# variety of linux platforms/system Abseil versions. +# +# Usage: +# +# docker compose run --rm ubuntu-20 +# +# ...for the default behaviour (clean + install), or use +# +# docker compose run --rm -it ubuntu-20 bash +# +# ...to open the environment interactively. The build of the image +# should be cached until you explicitly decide to rebuild it using +# `docker compose build ubuntu-20`. +# +# VSCode users can leverage the Remotes extension that allows connecting +# to a running container. This involves opening a separate terminal and +# running `docker compose run --rm -it ubuntu-20 bash` to keep the +# container running (during which time you can connect to it from VSCode). + services: - ubuntu-focal: + ubuntu-20: build: context: . - dockerfile: tools/docker/ubuntu-focal.dockerfile + args: + - IMAGE=ubuntu:20.04 + - ABSL_DEP= + dockerfile: tools/docker/debian.dockerfile volumes: - .:/s2 - command: bash + command: R CMD INSTALL /s2 --preclean + + ubuntu-22: + build: + context: . + args: + - IMAGE=ubuntu:22.04 + - ABSL_DEP= + dockerfile: tools/docker/debian.dockerfile + volumes: + - .:/s2 + command: R CMD INSTALL /s2 --preclean + + ubuntu-24: + build: + context: . + args: + - IMAGE=ubuntu:24.04 + dockerfile: tools/docker/debian.dockerfile + volumes: + - .:/s2 + command: R CMD INSTALL /s2 --preclean diff --git a/tools/docker/ubuntu-focal.dockerfile b/tools/docker/debian.dockerfile similarity index 76% rename from tools/docker/ubuntu-focal.dockerfile rename to tools/docker/debian.dockerfile index 37b5953b..b0e45a0d 100644 --- a/tools/docker/ubuntu-focal.dockerfile +++ b/tools/docker/debian.dockerfile @@ -1,11 +1,14 @@ -FROM ubuntu:focal +ARG IMAGE=debian:testing +ARG ABSL_DEP=libabsl-dev + +FROM ${IMAGE} ENV TZ=UTC RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ r-base cmake \ libudunits2-dev libgdal-dev libgeos-dev libproj-dev \ - libcurl4-openssl-dev libssl-dev + libcurl4-openssl-dev libssl-dev ${ABSL_DEP} # Make sure we can use all cores to install things RUN mkdir ~/.R && echo "MAKEFLAGS = -j$(nproc)" > ~/.R/Makevars From 2c433c053c27c4601fd46726b84b8011ebeddcf2 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Thu, 10 Oct 2024 11:41:36 -0500 Subject: [PATCH 11/21] better debian compose --- docker-compose.yml | 14 +++++++++----- tools/docker/debian.dockerfile | 8 ++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 564793e0..4c261070 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,22 +31,18 @@ services: context: . args: - IMAGE=ubuntu:20.04 - - ABSL_DEP= dockerfile: tools/docker/debian.dockerfile volumes: - .:/s2 - command: R CMD INSTALL /s2 --preclean ubuntu-22: build: context: . args: - IMAGE=ubuntu:22.04 - - ABSL_DEP= dockerfile: tools/docker/debian.dockerfile volumes: - .:/s2 - command: R CMD INSTALL /s2 --preclean ubuntu-24: build: @@ -56,4 +52,12 @@ services: dockerfile: tools/docker/debian.dockerfile volumes: - .:/s2 - command: R CMD INSTALL /s2 --preclean + + debian-testing: + build: + context: . + args: + - IMAGE=debian:testing + dockerfile: tools/docker/debian.dockerfile + volumes: + - .:/s2 diff --git a/tools/docker/debian.dockerfile b/tools/docker/debian.dockerfile index b0e45a0d..79d5c37b 100644 --- a/tools/docker/debian.dockerfile +++ b/tools/docker/debian.dockerfile @@ -1,6 +1,5 @@ ARG IMAGE=debian:testing -ARG ABSL_DEP=libabsl-dev FROM ${IMAGE} @@ -8,8 +7,13 @@ ENV TZ=UTC RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ r-base cmake \ libudunits2-dev libgdal-dev libgeos-dev libproj-dev \ - libcurl4-openssl-dev libssl-dev ${ABSL_DEP} + libcurl4-openssl-dev libssl-dev + +# Not all versions of ubuntu/debian have libabsl-dev +RUN apt-get install -y libabsl-dev || true # Make sure we can use all cores to install things RUN mkdir ~/.R && echo "MAKEFLAGS = -j$(nproc)" > ~/.R/Makevars RUN R -e 'install.packages(c("wk", "Rcpp", "testthat"), repos = "https://cloud.r-project.org")' + +CMD R CMD INSTALL /s2 --preclean && R -e 'testthat::test_local("/s2")' From 63e32dd000fd38b5674fbe3a57827b3786671702 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Thu, 10 Oct 2024 13:56:46 -0500 Subject: [PATCH 12/21] test some more distros --- docker-compose.yml | 21 +++++++++++++++++++++ tools/docker/fedora.dockerfile | 15 +++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tools/docker/fedora.dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index 4c261070..be9ade3a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -53,6 +53,7 @@ services: volumes: - .:/s2 + # CRAN platform debian-testing: build: context: . @@ -61,3 +62,23 @@ services: dockerfile: tools/docker/debian.dockerfile volumes: - .:/s2 + + # This is what CRAN runs + fedora-36: + build: + context: . + args: + - IMAGE=fedora:39 + dockerfile: tools/docker/fedora.dockerfile + volumes: + - .:/s2 + + # First version that includes abseil-cpp as a system package + fedora-39: + build: + context: . + args: + - IMAGE=fedora:39 + dockerfile: tools/docker/fedora.dockerfile + volumes: + - .:/s2 diff --git a/tools/docker/fedora.dockerfile b/tools/docker/fedora.dockerfile new file mode 100644 index 00000000..04694001 --- /dev/null +++ b/tools/docker/fedora.dockerfile @@ -0,0 +1,15 @@ + +ARG IMAGE=fedora:latest + +FROM ${IMAGE} + +RUN dnf install -y R cmake openssl-devel + +# Only available on Fedora 39+ +RUN dnf install -y abseil-cpp-devel || true + +# Make sure we can use all cores to install things +RUN mkdir ~/.R && echo "MAKEFLAGS = -j$(nproc)" > ~/.R/Makevars +RUN R -e 'install.packages(c("wk", "Rcpp", "testthat"), repos = "https://cloud.r-project.org")' + +CMD R CMD INSTALL /s2 --preclean && R -e 'testthat::test_local("/s2")' From 2ac354c4fecc51a0a54e0c89fd0c8c675b106c0d Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Thu, 10 Oct 2024 14:12:23 -0500 Subject: [PATCH 13/21] check alpine --- docker-compose.yml | 7 +++++++ tools/docker/alpine.dockerfile | 12 ++++++++++++ tools/docker/debian.dockerfile | 6 ++---- tools/docker/fedora.dockerfile | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 tools/docker/alpine.dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index be9ade3a..7b3c7769 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -82,3 +82,10 @@ services: dockerfile: tools/docker/fedora.dockerfile volumes: - .:/s2 + + alpine: + build: + context: . + dockerfile: tools/docker/alpine.dockerfile + volumes: + - .:/s2 diff --git a/tools/docker/alpine.dockerfile b/tools/docker/alpine.dockerfile new file mode 100644 index 00000000..cbeedb0b --- /dev/null +++ b/tools/docker/alpine.dockerfile @@ -0,0 +1,12 @@ + +ARG IMAGE=alpine:latest + +FROM ${IMAGE} + +RUN apk add bash R R-dev abseil-cpp-dev + +# Make sure we can use all cores to install things +RUN mkdir ~/.R && echo "MAKEFLAGS = -j$(nproc)" > ~/.R/Makevars +RUN R -e 'install.packages(c("wk", "bit64", "Rcpp", "testthat"), repos = "https://cloud.r-project.org")' + +CMD R CMD INSTALL /s2 --preclean && R -e 'testthat::test_local("/s2")' diff --git a/tools/docker/debian.dockerfile b/tools/docker/debian.dockerfile index 79d5c37b..ee504142 100644 --- a/tools/docker/debian.dockerfile +++ b/tools/docker/debian.dockerfile @@ -5,15 +5,13 @@ FROM ${IMAGE} ENV TZ=UTC RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ - r-base cmake \ - libudunits2-dev libgdal-dev libgeos-dev libproj-dev \ - libcurl4-openssl-dev libssl-dev + r-base cmake libcurl4-openssl-dev libssl-dev # Not all versions of ubuntu/debian have libabsl-dev RUN apt-get install -y libabsl-dev || true # Make sure we can use all cores to install things RUN mkdir ~/.R && echo "MAKEFLAGS = -j$(nproc)" > ~/.R/Makevars -RUN R -e 'install.packages(c("wk", "Rcpp", "testthat"), repos = "https://cloud.r-project.org")' +RUN R -e 'install.packages(c("wk", "bit64", "Rcpp", "testthat"), repos = "https://cloud.r-project.org")' CMD R CMD INSTALL /s2 --preclean && R -e 'testthat::test_local("/s2")' diff --git a/tools/docker/fedora.dockerfile b/tools/docker/fedora.dockerfile index 04694001..e861bc6e 100644 --- a/tools/docker/fedora.dockerfile +++ b/tools/docker/fedora.dockerfile @@ -10,6 +10,6 @@ RUN dnf install -y abseil-cpp-devel || true # Make sure we can use all cores to install things RUN mkdir ~/.R && echo "MAKEFLAGS = -j$(nproc)" > ~/.R/Makevars -RUN R -e 'install.packages(c("wk", "Rcpp", "testthat"), repos = "https://cloud.r-project.org")' +RUN R -e 'install.packages(c("wk", "bit64", "Rcpp", "testthat"), repos = "https://cloud.r-project.org")' CMD R CMD INSTALL /s2 --preclean && R -e 'testthat::test_local("/s2")' From 2c49d3490c04274644ad5220300ffc4dcf9cd59a Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Thu, 10 Oct 2024 14:28:20 -0500 Subject: [PATCH 14/21] add test compile --- configure | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 1fb23e8b..1b4fb553 100755 --- a/configure +++ b/configure @@ -13,7 +13,6 @@ PKG_CONFIG_NAME="openssl" PKG_DEB_NAME="libssl-dev" PKG_RPM_NAME="openssl-devel" PKG_BREW_NAME="openssl" -PKG_TEST_FILE="tools/test_openssl.c" PKG_LIBS="-lssl -lcrypto" PKG_CFLAGS="" @@ -41,10 +40,10 @@ CFLAGS=`${R_HOME}/bin/R CMD config CFLAGS` CPPFLAGS=`${R_HOME}/bin/R CMD config CPPFLAGS` # For debugging -echo "Testing compiler using PKG_CFLAGS=$PKG_CFLAGS" +echo "Testing compiler OpenSSL configuration using PKG_CFLAGS=$PKG_CFLAGS" # Test configuration -${CC} ${CPPFLAGS} ${PKG_CFLAGS} ${CFLAGS} -E ${PKG_TEST_FILE} >/dev/null 2>configure.log +${CC} ${CPPFLAGS} ${PKG_CFLAGS} ${CFLAGS} -E tools/test_openssl.c >/dev/null 2>configure.log # Customize the error if [ $? -ne 0 ]; then @@ -105,6 +104,22 @@ else PKG_LIBS="${PKGCONFIG_LIBS} ${PKG_LIBS}" fi +# Check compile of test file +CXX17="`${R_HOME}/bin/R CMD config CXX17`" +CXX17FLAGS=`"${R_HOME}"/bin/R CMD config CXX17FLAGS` +CXX17STD=`"${R_HOME}"/bin/R CMD config CXX17STD` + +echo "Testing Abseil configuration using PKG_CFLAGS=${PKG_CFLAGS}" + +${CXX17} ${CPPFLAGS} ${PKG_CFLAGS} ${CXX17FLAGS} ${CXX17STD} -E tools/test_absl.cc >/dev/null 2>>configure.log +if [ $? -ne 0 ]; then + echo "Test compile failed!" + echo "------- Error ---------" + cat configure.log + echo "-----------------------" + exit 1 +fi + # From apache/arrow/r/configure: # If on Raspberry Pi, need to manually link against latomic # See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358 for similar example From f06cb17f2a556507047b99ede800404299d779fc Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Thu, 10 Oct 2024 14:57:03 -0500 Subject: [PATCH 15/21] see if removing the deployment target matters --- tools/build_absl.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/build_absl.sh b/tools/build_absl.sh index 4b237e3b..aea8ed2b 100755 --- a/tools/build_absl.sh +++ b/tools/build_absl.sh @@ -49,7 +49,6 @@ cd "tools/build/abseil-cpp" -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=11.3 \ -DCMAKE_CXX_STANDARD=17 \ -DABSL_PROPAGATE_CXX_STD=ON \ "../../vendor/abseil-cpp" && From 76f8acde95657a180da576fd2885c7b2814c3757 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Thu, 10 Oct 2024 15:17:12 -0500 Subject: [PATCH 16/21] don't bother installing unused absl on ubuntu --- .github/workflows/R-CMD-check.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 8ab40e77..0a0eb805 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -71,11 +71,6 @@ jobs: run: | brew install abseil - - name: Install Abseil (Ubuntu) - if: matrix.config.os == 'ubuntu-latest' - run: | - sudo apt-get update && sudo apt-get install -y libabsl-dev - - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: any::rcmdcheck From 3ad97d9de2a96358a7c48f6d2736bd97b4fbe6f1 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Thu, 10 Oct 2024 15:34:48 -0500 Subject: [PATCH 17/21] clean up checks --- docker-compose.yml | 2 +- tools/docker/debian.dockerfile | 1 - tools/docker/fedora.dockerfile | 5 +---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7b3c7769..2babcd90 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -68,7 +68,7 @@ services: build: context: . args: - - IMAGE=fedora:39 + - IMAGE=fedora:36 dockerfile: tools/docker/fedora.dockerfile volumes: - .:/s2 diff --git a/tools/docker/debian.dockerfile b/tools/docker/debian.dockerfile index ee504142..0d4e436e 100644 --- a/tools/docker/debian.dockerfile +++ b/tools/docker/debian.dockerfile @@ -3,7 +3,6 @@ ARG IMAGE=debian:testing FROM ${IMAGE} -ENV TZ=UTC RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ r-base cmake libcurl4-openssl-dev libssl-dev diff --git a/tools/docker/fedora.dockerfile b/tools/docker/fedora.dockerfile index e861bc6e..b76573e9 100644 --- a/tools/docker/fedora.dockerfile +++ b/tools/docker/fedora.dockerfile @@ -3,10 +3,7 @@ ARG IMAGE=fedora:latest FROM ${IMAGE} -RUN dnf install -y R cmake openssl-devel - -# Only available on Fedora 39+ -RUN dnf install -y abseil-cpp-devel || true +RUN dnf install -y R cmake abseil-cpp-devel openssl-devel # Make sure we can use all cores to install things RUN mkdir ~/.R && echo "MAKEFLAGS = -j$(nproc)" > ~/.R/Makevars From cfe4e07eeb9d7976db2717d833132eebad3f7422 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Thu, 10 Oct 2024 16:09:16 -0500 Subject: [PATCH 18/21] fix makevars/flags and errors for various types of errors --- configure | 9 ++++++++- tools/build_absl.sh | 10 +++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 1b4fb553..388a0c84 100755 --- a/configure +++ b/configure @@ -95,10 +95,17 @@ else # Clean up build directory rm -rf tools/build + # Depending on the cmake options this can end up in a subdirectory of lib + ABSL_BASE_PC=`find tools/dist -name absl_base.pc` + R_S2_PKG_CONFIG_PATH=`dirname "${ABSL_BASE_PC}"` R_S2_ABSL_HOME="`pwd`/tools/dist" - export PKG_CONFIG_PATH="${R_S2_ABSL_HOME}/lib/pkgconfig:${PKG_CONFIG_PATH}" + export PKG_CONFIG_PATH="${R_S2_PKG_CONFIG_PATH}:${PKG_CONFIG_PATH}" echo "** Using PKG_CONFIG_PATH=${PKG_CONFIG_PATH}" PKGCONFIG_LIBS=`pkg-config --libs absl_s2` + if [ -z "${PKGCONFIG_LIBS}" ]; then + echo "** Failed to resolve built vendored copy of Abseil using pkg-config" + exit 1 + fi PKG_CFLAGS="-I${R_S2_ABSL_HOME}/include ${PKG_CFLAGS}" PKG_LIBS="${PKGCONFIG_LIBS} ${PKG_LIBS}" diff --git a/tools/build_absl.sh b/tools/build_absl.sh index aea8ed2b..8270683f 100755 --- a/tools/build_absl.sh +++ b/tools/build_absl.sh @@ -1,9 +1,13 @@ # https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Using-cmake +# Do our best to pass on the user MAKEFLAGS. This can result in much faster +# compilation of the vendored library. +MAKEFLAGS=`Rscript -e 'readRenviron("~/.R/Makevars"); cat(Sys.getenv("MAKEFLAGS"))'` + if test -z "$MAKE"; then MAKE="`which make`"; fi if ${MAKE} --version ; then - echo "Using MAKE=$MAKE $MAKEVARS" + echo "Using MAKE=$MAKE $MAKEFLAGS" else echo "make not found" exit 1 @@ -13,7 +17,7 @@ if test -z "$CMAKE"; then CMAKE="`which cmake`"; fi if test -z "$CMAKE"; then CMAKE=/Applications/CMake.app/Contents/bin/cmake; fi if "${CMAKE}" --version ; then echo "Using CMAKE=$CMAKE" - echo "Using MAKE=$MAKE $MAKEVARS" + echo "Using MAKE=$MAKE $MAKEFLAGS" else echo "cmake not found" exit 1 @@ -52,7 +56,7 @@ cd "tools/build/abseil-cpp" -DCMAKE_CXX_STANDARD=17 \ -DABSL_PROPAGATE_CXX_STD=ON \ "../../vendor/abseil-cpp" && - ${MAKE} ${MAKEVARS} && + ${MAKE} ${MAKEFLAGS} && "${CMAKE}" --install . cd ../../.. From 133a14803b6580ae5ff72e48badf81db64171b21 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Thu, 10 Oct 2024 16:14:21 -0500 Subject: [PATCH 19/21] see if that speeds things up --- .github/workflows/R-CMD-check.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 0a0eb805..fdaf40b4 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -71,6 +71,11 @@ jobs: run: | brew install abseil + - name: Set Makevars (Ubuntu) + if: matrix.config.os == 'ubuntu-latest' + run: | + mkdir ~/.R && echo "MAKEFLAGS = -j$(nproc)" > ~/.R/Makevars + - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: any::rcmdcheck From 52aad1713ad82dd99807aa8aae9dd6843baf2af3 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Thu, 10 Oct 2024 16:17:33 -0500 Subject: [PATCH 20/21] maybe fix url --- README.Rmd | 4 ++-- README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.Rmd b/README.Rmd index ff1fa3a4..f2464791 100644 --- a/README.Rmd +++ b/README.Rmd @@ -113,8 +113,8 @@ nc_s2 %>% ## Acknowledgment -This project gratefully acknowledges financial [support](https://www.r-consortium.org/projects) from the +This project gratefully acknowledges financial [support](https://www.r-consortium.org/) from the - + diff --git a/README.md b/README.md index 41172202..52d7e2b1 100644 --- a/README.md +++ b/README.md @@ -187,7 +187,7 @@ nc_s2 %>% ## Acknowledgment This project gratefully acknowledges financial -[support](https://www.r-consortium.org/projects) from the +[support](https://www.r-consortium.org/) from the - + From f1963f9264331b8dbcaab34e419717f20d93b9da Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Thu, 10 Oct 2024 16:24:42 -0500 Subject: [PATCH 21/21] maybe fix --- tools/build_absl.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/build_absl.sh b/tools/build_absl.sh index 8270683f..86f24d25 100755 --- a/tools/build_absl.sh +++ b/tools/build_absl.sh @@ -1,9 +1,15 @@ # https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Using-cmake +: ${R_HOME=`R RHOME`} +if test -z "${R_HOME}"; then + echo "could not determine R_HOME" + exit 1 +fi + # Do our best to pass on the user MAKEFLAGS. This can result in much faster # compilation of the vendored library. -MAKEFLAGS=`Rscript -e 'readRenviron("~/.R/Makevars"); cat(Sys.getenv("MAKEFLAGS"))'` +MAKEFLAGS=`${R_HOME}/bin/Rscript -e 'readRenviron("~/.R/Makevars"); cat(Sys.getenv("MAKEFLAGS"))'` if test -z "$MAKE"; then MAKE="`which make`"; fi if ${MAKE} --version ; then @@ -23,12 +29,6 @@ else exit 1 fi -: ${R_HOME=`R RHOME`} -if test -z "${R_HOME}"; then - echo "could not determine R_HOME" - exit 1 -fi - CC=`"${R_HOME}/bin/R" CMD config CC` CXX="`${R_HOME}/bin/R CMD config CXX17` `${R_HOME}/bin/R CMD config CXX17STD`" CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`