r-hub / actions

GitHub Actions for R-hub
MIT License
21 stars 4 forks source link

Installing package cachem causes an error in the action for "atlas", but not in a bare container #17

Open bertcarnell opened 4 months ago

bertcarnell commented 4 months ago

This error reproduces consistently in my github action, but not in a bare container.

Snippet of error in github action: https://github.com/bertcarnell/lhs/actions/runs/9147268987/job/25148473610

ℹ Building fastmap 1.2.0
  ℹ Building xfun 0.44
  ✔ Built fastmap 1.2.0 (3.1s)
  ✔ Installed fastmap 1.2.0  (1s)
  ℹ Building cachem 1.1.0
  ✖ Failed to build cachem 1.1.0 (573ms)
  Error: 
  ! error in pak subprocess
  Caused by error in `stop_task_build(state, worker)`:
  ! Failed to build source package cachem.
  Full installation output:
  * installing *source* package ‘cachem’ ...
  ** package ‘cachem’ successfully unpacked and MD5 sums checked
  staged installation is only possible with locking
  ** using non-staged installation
  ** libs
  using C compiler: ‘gcc (GCC) 13.2.1 20240316 (Red Hat 13.2.1-7)’
  gcc -I"/opt/R/devel-gcc/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2 -Wall -pedantic -mtune=native -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection -Werror=implicit-function-declaration -Wstrict-prototypes  -Wall -pedantic -c cache.c -o cache.o
  gcc -I"/opt/R/devel-gcc/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2 -Wall -pedantic -mtune=native -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection -Werror=implicit-function-declaration -Wstrict-prototypes  -Wall -pedantic -c init.c -o init.o
  gcc -shared -L/opt/R/devel-gcc/lib/R/lib -L/usr/local/lib -o cachem.so cache.o init.o -L/opt/R/devel-gcc/lib/R/lib -lR
  installing to /tmp/RtmpDWvXgn/pkg-lib23d119c413e/cachem/libs
  ** R
  ** byte-compile and prepare package for lazy loading
  Error in dyn.load(file, DLLpath = DLLpath, ...) : 
    unable to load shared object '/github/home/R/x86_64-pc-linux-gnu-library/4.5/rlang/libs/rlang.so':
    libsvml.so: cannot open shared object file: No such file or directory
  Calls: <Anonymous> ... asNamespace -> loadNamespace -> library.dynam -> dyn.load
  Execution halted
  ERROR: lazy loading failed for package ‘cachem’
  * removing ‘/tmp/RtmpDWvXgn/pkg-lib23d119c413e/cachem’
  ---
  Backtrace:
  1. pak::lockfile_install(".github/pkg.lock")
  2. pak:::remote(function(...) { …
  3. err$throw(res$error)

Attempt to reproduce the error in a bare container, outside of github actions, but this was successful

docker pull ghcr.io/r-hub/containers/atlas:latest
sudo docker run -ti --rm -v /mnt/c/repositories:/home/docker -w /home/docker -u root --name atlas_interactive ghcr.io/r-hub/containers/atlas

yum update -y
yum install -y gmp-devel pandoc texlive
R
install.packages(c("knitr", "rmarkdown", "Rcpp", "testthat", "DoE.base"))
install.packages(c("cachem"))
q()
R CMD build lhs
R CMD check lhs_*.tar.gz
bertcarnell commented 4 months ago

Workaround:

      - uses: r-hub/actions/checkout@v1
      - uses: r-hub/actions/platform-info@v1
        with:
          token: ${{ secrets.RHUB_TOKEN }}
          job-config: ${{ matrix.config.job-config }}
      - uses: r-hub/actions/setup-deps@v1
        if: matrix.config.label != 'atlas' && matrix.config.label != 'gcc13' && matrix.config.label != 'mkl'
        with:
          token: ${{ secrets.RHUB_TOKEN }}
          job-config: ${{ matrix.config.job-config }}
          pak-version: stable
      - name: cachem replacement
        if: matrix.config.label == 'atlas' || matrix.config.label == 'gcc13' || matrix.config.label == 'mkl'
        run: |
          yum install -y gmp-devel pandoc texlive
          Rscript -e 'install.packages(c("rcmdcheck", "knitr", "rmarkdown", "Rcpp", "testthat", "DoE.base"), repos = "https://cran.case.edu")'
      - name: Bad CXXFLAGS for atlas
        if: matrix.config.label == 'atlas'
        # throws a warning on non-portable compilation flags
        # Can't set _R_CHECK_COMPILATION_FLAGS_=FALSE because --as-cran resets it
        # instead, allow for the flags that are a problem
        run: |
          echo '_R_CHECK_COMPILATION_FLAGS_KNOWN_="-Werror=format-security -Werror=implicit-function-declaration -Wno-ignored-attributes -Wno-parentheses -Wp,-D_FORTIFY_SOURCE=3"' >> $GITHUB_ENV
      - uses: r-hub/actions/run-check@v1
        with:
          token: ${{ secrets.RHUB_TOKEN }}
          job-config: ${{ matrix.config.job-config }}
gaborcsardi commented 4 months ago

I cannot reproduce that, it is all fine with a vanilla R-hub v2 workflow: https://github.com/gaborcsardi/lhs/actions/runs/9255316046/job/25460249197