rocker-versioned2 icon indicating copy to clipboard operation
rocker-versioned2 copied to clipboard

Updating littler breaks access to shared library libR.so

Open pmoris opened this issue 2 years ago • 7 comments

Container image name

rocker/rstudio:4.1.2

Container image digest

rocker/rstudio@sha256:4aa7cb6c1851ea480b1435fbaab53834d85dff446b21a5f85f0c7ace843850e8

What operating system are you seeing the problem on?

Linux

System information

  • Docker version 20.10.17, build 100c701
  • WSL Ubuntu-20.04 Kernel version: 5.10.102.1

Bug description

After updating the littler package (from version 0.3.14 to 0.3.15 in this case), either manually or indirectly (e.g. via Bioconductor's BiocManager::install() update flag to update old packages "Update all/some/none? [a/s/n]:"), the littler helper scripts can no longer find the shared library libR.so.

root@7ab5bd2e2324:/# install2.r
r: error while loading shared libraries: libR.so: cannot open shared object file: No such file or directory

I'm a bit confused as to why rocker/rstudio:4.1.2 contains littler version 0.3.14 in the first place, because it is installed in the base image after setting the CRAN repo to https://packagemanager.rstudio.com/cran/__linux__/focal/latest, but the same thing happens on the latest version of rocker/rstudio (4.2.1) which comes with the most recent version of littler (0.3.15) already.

Similarly, rocker/rstudio:4.0.2 contains littler version 0.3.12, has its CRAN repo set to https://packagemanager.rstudio.com/cran/__linux__/focal/2021-03-30 and updating reinstalls the same version again, after which the shared library can no longer be found.

I suspect that this problem does not occur that often, but I'd be interested to learn why it happens.

How to reproduce this bug?

$ docker run -it --rm rocker/rstudio:4.1.2 bash
root@7ab5bd2e2324:/# r --version
r ('littler') version 0.3.14

using GNU R Version 4.1.2 (2021-11-01)

Copyright (C) 2006 - 2021  Jeffrey Horner and Dirk Eddelbuettel

r is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License.  For more information about
these matters, see http://www.gnu.org/copyleft/gpl.html.

root@7ab5bd2e2324:/# install2.r littler
trying URL 'https://packagemanager.rstudio.com/cran/__linux__/focal/latest/src/contrib/littler_0.3.15.tar.gz'
Content type 'binary/octet-stream' length 96438 bytes (94 KB)
==================================================
downloaded 94 KB

* installing *binary* package ‘littler’ ...
* DONE (littler)

The downloaded source packages are in
        ‘/tmp/downloaded_packages’
root@7ab5bd2e2324:/# install2.r
r: error while loading shared libraries: libR.so: cannot open shared object file: No such file or directory
root@7ab5bd2e2324:/# exit

pmoris avatar Aug 24 '22 13:08 pmoris

littler author/maintainer here: That happens when (non-standard) binary builds mix. I am aware of one that puts R below /opt which is of course outside of Debian or Ubuntu packaging standards. Do an an ldd on the shared library of your current r binary, it will point to a non-existing R.

The remedy, and hence likely fix this container too, is to rebuild littler (which is very quick) to match the R installation.

eddelbuettel avatar Aug 24 '22 13:08 eddelbuettel

Aha, thanks! Could you perhaps point me to an example of how to rebuild littler? The initial install in the rocker base image is just a regular install.packages() call, isn't it?

pmoris avatar Aug 25 '22 08:08 pmoris

A standard R CMD INSTALL littler_*tar.gz is all it takes, and install.packages() also works but it has to be a source build whereas rocker-versioned2 tries hard (and rightly so) to use binaries.

And that set of binaries (not made by me) is made in a setup that uses /opt/R/... That is what breaks when you (as rocker does) use a standard R from /usr/bin/R and installed in /usr/lib/R/. You need to rebuild to reflect those two paths of the system you are running rather than carrying a memory of the the system that littler binary was made on. (Ir is one of the generally very few little issues with that build system, and outside of our control.)

eddelbuettel avatar Aug 25 '22 11:08 eddelbuettel

Hello. Thank you for sharing this with us. I had never tried to reinstall littler and did not know about this issue.

I'm a bit confused as to why rocker/rstudio:4.1.2 contains littler version 0.3.14 in the first place, because it is installed in the base image after setting the CRAN repo to https://packagemanager.rstudio.com/cran/__linux__/focal/latest

This is because this image was built so long ago. If you search for the digest of that image in this repository, you will find the following report on the wiki. https://github.com/rocker-org/rocker-versioned2/wiki/rstudio_d09b72dd85ce It means that on 2021-11-29, the day this image was built, the latest version of littler was 0.3.14.

Note that the latest rocker/rstudio:4.1.2 is a different image, and in this image the repository is fixed to a specific date. https://github.com/rocker-org/rocker-versioned2/wiki/rstudio_395b3656a66a

Could you perhaps point me to an example of how to rebuild littler? The initial install in the rocker base image is just a regular install.packages() call, isn't it?

RSPM performs binary installations by default, but this line installs packages from a repository that enforces source installation through the repos option.

https://github.com/rocker-org/rocker-versioned2/blob/5bab51522634ec587ab133199405d49bd0cfc6c4/scripts/setup_R.sh#L66

And, dependencies must also be installed by apt for source installation.

https://github.com/rocker-org/rocker-versioned2/blob/5bab51522634ec587ab133199405d49bd0cfc6c4/scripts/setup_R.sh#L55-L59

So the following command should work. (I tested on rocker/rstudio:4.0.2)

$ apt update -y -qq && apt install -y -qq libpcre2-dev liblzma-dev libbz2-dev zlib1g-dev libicu-dev && install2.r --repos https://cloud.r-project.org littler
$ r --version
r ('littler') version 0.3.15

using GNU R Version 4.0.2 (2020-06-22)

Copyright (C) 2006 - 2021  Jeffrey Horner and Dirk Eddelbuettel

r is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License.  For more information about
these matters, see http://www.gnu.org/copyleft/gpl.html.

eitsupi avatar Aug 25 '22 11:08 eitsupi

Thanks for the extensive explanation, both of you! It all makes sense to me now.

Whether this truly is a "bug" that needs to (or can be) fixed in the rocker images, I leave up to you. I know enough now to fix the issue in case it comes up, and I'll try to avoid updating littler as a general rule ;)

pmoris avatar Aug 25 '22 11:08 pmoris

Another trick is to simply rely on the r-cran-littler binary made for and distributed by the c2d4u team, it is also both current and working. However, that trick may not apply to rocker-versioned2 as it (by design) has a different setup...

eddelbuettel avatar Aug 25 '22 11:08 eddelbuettel

Whether this truly is a "bug" that needs to (or can be) fixed in the rocker images, I leave up to you.

Yes, I think this is an RSPM issue. (Whether it needs fixing or not. Just a note of caution might be sufficient.)

@glin Hi, it may not be very useful to install littler from RSPM as reported in this issue.

eitsupi avatar Aug 25 '22 13:08 eitsupi