dfrancis01 / dfo-richt-project

Other
0 stars 0 forks source link

Build Error on macOS-latest (release) runner #60

Open dfrancis01 opened 2 years ago

dfrancis01 commented 2 years ago

Build failed after add leaflet package to the project on Mac OS - Latest Dependency terra failed to install Possible source of solution: https://github.com/search?q=gdal+path%3A.github%2Fworkflows

  ℹ Building terra 1.5-21
  ✖ Failed to build terra 1.5-21

  Error: Error: <callr_remote_error: Failed to build source package 'terra'>
   in process 2976 
  -->
  Failed to build source package 'terra', stdout + stderr:

  OE> * installing *source* package ‘terra’ ...
  OE> ** package ‘terra’ successfully unpacked and MD5 sums checked
  OE> staged installation is only possible with locking
  OE> ** using non-staged installation
  OE> configure: CC: clang -mmacosx-version-min=10.13
  OE> configure: CXX: clang++ -mmacosx-version-min=10.13 -std=gnu++11
  OE> checking for gdal-config... no
  OE> no
  OE> configure: error: gdal-config not found or not executable.
  OE> ERROR: configuration failed for package ‘terra’
  OE> * removing ‘/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpIuXj6H/pkg-libba02d16a499/terra’

   Stack trace:
dfrancis01 commented 2 years ago

This looks like your missing dependencies for Mac OS. Followed the trail from leaflet repo, Source: https://github.com/rstudio/leaflet/runs/6447505012?check_suite_focus=true Possible solution: https://github.com/rstudio/shiny-workflows/tree/main/setup-macOS-dependencies

dfrancis01 commented 2 years ago

It got dark

# 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
  pull_request:
    branches: main
name: R-CMD-check
jobs:
  R-CMD-check:
    runs-on: ${{ matrix.config.os }}
    name: ${{ matrix.config.os }} (${{ matrix.config.r }})
    strategy:
      fail-fast: false
      matrix:
        config:
          - {os: macOS-latest,   r: '4.1.2'}
          - {os: windows-latest, r: '4.1.2'}
          - {os: ubuntu-latest,   r: '4.1.2'}

    env:
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
      R_KEEP_PKG_SOURCE: yes
    steps:
      - uses: actions/checkout@v2
      - uses: r-lib/actions/setup-pandoc@v2
      - uses: r-lib/actions/setup-r@v2
        with:
          r-version: ${{ matrix.config.r }}
          use-public-rspm: true
      #- name: Install Terra Package
      #  if: matrix.config.os == 'macOS-latest'
      #  run: |
      #    install.packages("https://cran.r-project.org/bin/macosx/big-sur-arm64/contrib/4.1/terra_1.5-21.tgz", repos = NULL, type = .Platform$pkgType)
      #  shell: Rscript {0}
     # - name: Instal Mac OS dependancies
     #   if: matrix.config.os == 'macOS-latest'
      #  run: |
      #    brew install pkg-config proj geos gdal sqlite
     #   run: brew install gdal
     # - name: Set up GDAL
     #   if: matrix.config.os == 'macOS-latest'
     #   run: |
     #     GDAL_VER=$(find /usr/local/Cellar/gdal/  -name "lib" | awk -F"/" '{print $7}')
     #     GDAL_LDPATH=/usr/local/Cellar/gdal/$GDAL_VER/lib/
     #     export LIBRARY_PATH=$GDAL_LDPATH
     #     echo $LIBRARY_PATH
     # - name: Test GDAL installation
     #   if: matrix.config.os == 'macOS-latest'
     #   run: |
     #     gdalinfo --version
      - name: Instal Mac OS dependancies
        if: matrix.config.os == 'macOS-latest'
      - uses: rstudio/shiny-workflows/setup-macOS-dependencies@v1
        with:
          needs: check
          extra-packages: rcmdcheck

      - uses: r-lib/actions/setup-r-dependencies@v2
        with:
          extra-packages: rcmdcheck
      - uses: r-lib/actions/check-r-package@v2
dfrancis01 commented 2 years ago

Work around suspend Mac OS check

dfrancis01 commented 2 years ago

Solution for Terra is probably to install with renv::install set package & set repo / install from R Univers Dev repo something link:

install.packages('terra', repos='https://rspatial.r-universe.dev')
OR Something Like this: https://github.com/rspatial/terra/issues/429#issuecomment-1057518833 Reference: https://rstudio.github.io/renv/articles/packages.html https://rstudio.github.io/renv/reference/install.html Terra Raster
1. https://github.com/rspatial/terra 1.https://github.com/rspatial/raster

Might need to specify respository source and type (Binary vs Source): YouTube