r-rust / gifski

R wrapper for the 'gifski' Rust Cargo crate.
Other
73 stars 4 forks source link

gifski 0.8.7 fail to install invalid serialized Package Id for key `package.dependencies` [SOLVED] #14

Closed HenrikBengtsson closed 3 years ago

HenrikBengtsson commented 3 years ago

Just sharing in case someone else runs into the same problem and for search engines to pick it up. I will close immediately since there's no problem with gifski per se.

Problem

$ R
R version 4.0.4 (2021-02-15) -- "Lost Library Book"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
...

> install.packages("gifski")
Installing package into '/home/hb/R/x86_64-pc-linux-gnu-library/4.0-CBI'
(as 'lib' is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/gifski_0.8.7.tar.gz'
Content type 'application/x-gzip' length 12337 bytes (12 KB)
==================================================
downloaded 12 KB

* installing *source* package 'gifski' ...
** package 'gifski' successfully unpacked and MD5 sums checked
** using staged installation
cargo 1.30.0 (36d96825d 2018-10-24)
Using /home/hb/.cargo/bin/cargo
** libs
gcc -I"/home/hb/shared/software/CBI/R-4.0.4/lib/R/include" -DNDEBUG   -I/usr/local/include  -pthread -fvisibility=hidden -fpic  -g -O2  -c wrapper.c -o wrapper.o
PATH="/home/hb/.cargo/bin:/home/hb/.rbenv/plugins/ruby-build/bin:/home/hb/.rbenv/shims:/home/hb/.rbenv/bin:/home/hb/.cargo/bin:/home/hb/repositories/r-on-demand-prototype/.src/google-cloud-sdk/bin:/home/hb/shared/software/CBI/R-4.0.4/bin:/home/hb/shared/software/CBI/shellcheck-0.7.1:/home/hb/software/Marp-0.0.14:/home/hb/shared/software/CBI/fzf-0.25.1/bin:/home/hb/shared/software/CBI/emacs-26.3/bin:/home/hb/shared/software/CBI/glow-1.3.0:/home/hb/shared/software/CBI/bat-0.17.1:/home/hb/node_modules/.bin:/home/hb/go-workspace/bin:/home/hb/go/bin:/home/hb/bin:/home/hb/.cargo/bin:/home/hb/.local/bin:/home/hb/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/hb/shared/software/CBI/fzf-0.20.0/bin" cargo build --release --manifest-path=myrustlib/Cargo.toml
error: failed to parse lock file at: /tmp/hb/RtmpmfliCQ/R.INSTALL6a4e43bd4c66/gifski/src/myrustlib/Cargo.lock

Caused by:
  invalid serialized PackageId for key `package.dependencies`
Makevars:13: recipe for target 'myrustlib/target/release/libmyrustlib.a' failed
make: *** [myrustlib/target/release/libmyrustlib.a] Error 101
ERROR: compilation failed for package 'gifski'
* removing '/home/hb/R/x86_64-pc-linux-gnu-library/4.0-CBI/gifski'
* restoring previous '/home/hb/R/x86_64-pc-linux-gnu-library/4.0-CBI/gifski'

The downloaded source packages are in
    '/tmp/hb/RtmpncrM9J/downloaded_packages'
Warning message:
In install.packages("gifski") :
  installation of package 'gifski' had non-zero exit status

Solution (update cargo)

It might not be obvious from the error message that this problem is because the Rust toolchain is too old;

$ cargo --version
cargo 1.30.0 (36d96825d 2018-10-24)

I rarely use Rust myself so I forgot that I installed Rust manually quite a while ago and instead incorrectly assumed that sudo apt dist-upgrade on my Ubuntu 18.04 machine kept it up-to-date, so it took me a while before I realized it was out-dated. To update, do:

$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2021-02-11, rust version 1.50.0 (cb75ad5db 2021-02-10)
info: downloading component 'rustc'
 60.3 MiB /  60.3 MiB (100 %)  18.8 MiB/s ETA:   0 s                
info: downloading component 'rust-std'
 24.5 MiB /  24.5 MiB (100 %)  11.5 MiB/s ETA:   0 s                
info: downloading component 'cargo'
info: downloading component 'rust-docs'
 14.7 MiB /  14.7 MiB (100 %)  14.7 MiB/s ETA:   0 s                
info: removing component 'rustc'
info: removing component 'rust-std'
info: removing component 'cargo'
info: removing component 'rust-docs'
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: checking for self-updates
info: downloading self-update

stable-x86_64-unknown-linux-gnu updated - rustc 1.50.0 (cb75ad5db 2021-02-10)

$ cargo --version
cargo 1.50.0 (f04e7fab7 2021-02-04)

Result

$ R
R version 4.0.4 (2021-02-15) -- "Lost Library Book"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
...

> install.packages("gifski")
Installing package into '/home/hb/R/x86_64-pc-linux-gnu-library/4.0-CBI'
(as 'lib' is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/gifski_0.8.7.tar.gz'
Content type 'application/x-gzip' length 12337 bytes (12 KB)
==================================================
downloaded 12 KB

* installing *source* package 'gifski' ...
** package 'gifski' successfully unpacked and MD5 sums checked
** using staged installation
cargo 1.50.0 (f04e7fab7 2021-02-04)
Using /home/hb/.cargo/bin/cargo
** libs
...
   Compiling gifski v0.8.7
   Compiling myrustlib v0.1.0 (/tmp/hb/Rtmprkf9QB/R.INSTALL6d751a9adcf6/gifski/src/myrustlib)
    Finished release [optimized] target(s) in 48.50s
rm -Rf /tmp/hb/Rtmprkf9QB/R.INSTALL6d751a9adcf6/gifski/src/.cargo
gcc -shared -L/home/hb/shared/software/CBI/R-4.0.4/lib/R/lib -L/usr/local/lib -o gifski.so wrapper.o -Lmyrustlib/target/release -lmyrustlib -lresolv -pthread -L/home/hb/shared/software/CBI/R-4.0.4/lib/R/lib -lR
installing to /home/hb/R/x86_64-pc-linux-gnu-library/4.0-CBI/00LOCK-gifski/00new/gifski/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (gifski)

The downloaded source packages are in
    '/tmp/hb/RtmpqLlRSe/downloaded_packages'
jeroen commented 3 years ago

Thanks. Not sure how I can improve this error message... or perhaps we should automatically run cargo update for the user?

HenrikBengtsson commented 3 years ago

I don't know if there's anything that can be done. I don't know Rust but if there's something like C++11, C++14, ... for Rust and that's the underlying problem here, maybe a similar "hint" in SystemRequirements:. The fact that you report on the cargo version is great - it was what eventually led me on the right path.

I think there's a risk that an automatic cargo/Rust update could do more damage than it helps, e.g. if updating R packages updates your Rust toolchain it might not be noticed until weeks later and it can be really hard to troubleshoot.