[R-pkg-devel] pkg built with static vignette introduces dependency on R > = 3.5.0

Duncan Murdoch murdoch@dunc@n @ending from gm@il@com
Fri Jun 8 13:02:46 CEST 2018

On 08/06/2018 5:12 AM, Roman Flury wrote:
> Dear all,
> I'm working on a package which contains a static vignette. If the pkg is built with R version 3.3.3 everything works fine, but if built with the current R-devel version I get the warning:
>>      NB: this package now depends on R (>= 3.5.0)
>>      WARNING: Added dependency on R >= 3.5.0 because serialized objects in  serialize/load version 3 cannot be read in older versions of R.  File(s) containing such objects:  'staticvignettepkg/build/vignette.rds'
> and as described the dependency on R >= 3.5.0 is added to the DESCRIPTION file.
> I found possible context for this behaviour in the R-devel NEWS https://cran.r-project.org/doc/manuals/r-devel/NEWS.html:
> ''R has new serialization format (version 3) which supports custom serialization of ALTREP framework objects. These objects can still be serialized in format 2, but less efficiently. Serialization format 3 also records the current native encoding of unflagged strings and converts them when de-serialized in R running under different native encoding. Format 3 comes with new serialization magic numbers (RDA3, RDB3, RDX3). Format 3 can be selected by version = 3 in save(), serialize() and saveRDS(), but format 2 remains the default for all serialization and saving of the workspace. Serialized data in format 3 cannot be read by versions of R prior to version 3.5.0.''
> but I can not see why or how this should have an influence on a static vignette?
> To illustrate and reproduce my issue I created a git repository https://github.com/romanflury/staticvignette with a minimal package, containing an arbitrary pdf document as a static vignette. The git repository includes the respective session infos also.
> I hope to avoid this dependency, since I do not want to force users to update their R version.

When R builds a package with vignettes, it adds a file 
build/vignette.rds to the tarball that contains information about the 
vignettes.  Since R-devel is switching the format of .rds files, this 
file is in the new format, which can't be read by R versions prior to 3.5.0.

Generally speaking there is no guarantee that R x.y.z can handle a 
package built in a later version, and this is an example of that 
problem:  R x.y.z can't handle a package built in x.(y+2).z.

So the solution is to build your tarball in R 3.5.x or earlier, not in 
R-devel, or to add the dependency mentioned in the warning message.

Duncan Murdoch

More information about the R-package-devel mailing list