actions icon indicating copy to clipboard operation
actions copied to clipboard

run-rchk action cannot load libR.so

Open ms609 opened this issue 2 years ago • 7 comments

Describe the bug run-rchk cannot load libR.so

To Reproduce I have a GitHub action script including the Basic configuration given at the actions/run-rchk readme:

jobs:  
  rchk:
    runs-on: ubuntu-latest
    container:
      image: rhub/ubuntu-rchk
      options: --user=root
    steps:
    - uses: actions/checkout@v2
    - uses: r-lib/actions/run-rchk@v2

The run fails with

 Error in dyn.load(dll_file) : 
    unable to load shared object '/tmp/RtmpWikvGF/file1935703f34e/glue/libs//glue.so':
    libR.so: cannot open shared object file: No such file or directory
  Calls: <Anonymous> ... load_private_packages -> load_private_package -> dyn.load
  Execution halted

ms609 avatar Feb 03 '22 10:02 ms609

I think it is because setup-r-dependencies@v2 not working with the docker image rhub/ubuntu-rchk. Try the following instead?

  rchk:
    runs-on: ubuntu-latest
    container:
      image: rhub/ubuntu-rchk
      options: --user=root
    steps:
    - uses: actions/checkout@v2
    - uses: r-lib/actions/run-rchk@v2
      with:
        setup-only: true
    - uses: r-lib/actions/setup-r-dependencies@v1
      with:
        cache-version: rchk-1
    - uses: r-lib/actions/run-rchk@v2
      with:
        run-only: true

randy3k avatar Feb 25 '22 06:02 randy3k

Thanks for the suggestion; however, I still see the error in the setup-r-dependencies@v1 step.

 Error in dyn.load(dll_file) : 
    unable to load shared object '/tmp/RtmpldVcb7/file18c1d8a9878/glue/libs//glue.so':
    libR.so: cannot open shared object file: No such file or directory
  Calls: saveRDS ... load_private_packages -> load_private_package -> dyn.load
  Execution halted

ms609 avatar Feb 25 '22 07:02 ms609

trying URL 'r-lib.github.io/p/pak/stable/src/contrib/pak_0.2.0.9000_R4-2_x86_64-pc-linux-musl.tar.gz'

It seems the pak binary from r-lib.github.io is not working with the docker rhub/ubuntu-rchk. A solution is to change the repo to CRAN so that we install it from source

install.packages("pak", repos = "https://cran.rstudio.com/")

However, it will take a few minutes to install.

randy3k avatar Feb 25 '22 08:02 randy3k

Thanks, I added a step

    - name: Install `pak` from source
      run: |
        install.packages("pak", repos = "https://cran.rstudio.com/")
      shell: Rscript {0}

which installs pak successfully, but r-lib/actions/setup-r-dependencies@v1 still attempts to install pak, meeting the same failure point. Run log

ms609 avatar Feb 25 '22 09:02 ms609

Ya, you need to fork this repo and change this line to

install.packages("pak", repos = "https://cran.rstudio.com/")

I figured out that the binary of pak shipped from r-lib.github.io/p/pak requires the shared library libR.so. But unfortunately, the image rhub/ubuntu-rchk only has libR.a. So the current workaround is to install pak from source.

There are a few viable solutions to resolve the issue.

  1. Request rhub/ubuntu-rchk to build R with flag --enable-R-shlib
  2. Fork rhub/ubuntu-rchk and build another image which build R with flag --enable-R-shlib
  3. Build another image on top of rhub/ubuntu-rchk that comes with pak.

@gaborcsardi what do you think?

randy3k avatar Feb 25 '22 18:02 randy3k

@ms609

Forgot to mention that another solution is to completely skip setup-r-dependencies like this,

  rchk:
    runs-on: ubuntu-latest
    container:
      image: rhub/ubuntu-rchk
      options: --user=root
    steps:
    - uses: actions/checkout@v2
    - uses: r-lib/actions/run-rchk@v2
      with:
        setup-only: true
    - name: Install package
      run: |
		install.packages('remotes', repos = "https://cran.rstudio.com/")
        remotes::install_local()
      shell: Rscript {0}
    - uses: r-lib/actions/run-rchk@v2
      with:
        run-only: true

But it also means that your package's dependencies would be built every time. If you still want the ability to cache dependencies, you would refer to this retired action that based on remotes.

Update:

I have put together a version of setup-r-dependencies that works with rhub/ubuntu-rchk.

Example:

  rchk:
    runs-on: ubuntu-latest
    container:
      image: rhub/ubuntu-rchk
      options: --user=root
    steps:
    - uses: actions/checkout@v2
    - uses: r-lib/actions/run-rchk@v2
      with:
        setup-only: true
    - uses: randy3k/gh-actions/r-install-deps@main
      with:
        cache-version: rchk-1
    - name: Install package
      run: |
        remotes::install_local()
      shell: Rscript {0}
    - uses: r-lib/actions/run-rchk@v2
      with:
        run-only: true

randy3k avatar Feb 25 '22 18:02 randy3k

Thanks – your update fix seems to have rchk up and running on the github action!

Thanks for your help with this.

ms609 avatar Feb 28 '22 09:02 ms609

@randy3k What is the current status of this action? Is it still broken?

gaborcsardi avatar Oct 19 '22 12:10 gaborcsardi

FWIW, our (Linux) pak builds now work on R installations without a shared library, so I am going to close this.

gaborcsardi avatar Apr 01 '23 17:04 gaborcsardi

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue and include a link to this issue

github-actions[bot] avatar Apr 16 '23 01:04 github-actions[bot]