I am running R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out" in RStudio 1.3.1093 on Ubuntu 18.04. I tried to install the package ggplot2
when I ran into the following error messages:
Installing package into ‘/home/nick/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependencies ‘testthat’, ‘isoband’
trying URL 'https://cloud.r-project.org/src/contrib/testthat_3.0.1.tar.gz'
Content type 'application/x-gzip' length 678199 bytes (662 KB)
==================================================
downloaded 662 KB
trying URL 'https://cloud.r-project.org/src/contrib/isoband_0.2.3.tar.gz'
Content type 'application/x-gzip' length 1902568 bytes (1.8 MB)
==================================================
downloaded 1.8 MB
trying URL 'https://cloud.r-project.org/src/contrib/ggplot2_3.3.3.tar.gz'
Content type 'application/x-gzip' length 3058840 bytes (2.9 MB)
==================================================
downloaded 2.9 MB
* installing *source* package ‘testthat’ ...
** package ‘testthat’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -fpic -g -O2 -fdebug-prefix-map=/build/r-base-7BvS0x/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -fpic -g -O2 -fdebug-prefix-map=/build/r-base-7BvS0x/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c reassign.c -o reassign.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -fpic -g -O2 -fdebug-prefix-map=/build/r-base-7BvS0x/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c test-catch.cpp -o test-catch.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -fpic -g -O2 -fdebug-prefix-map=/build/r-base-7BvS0x/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c test-example.cpp -o test-example.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -fpic -g -O2 -fdebug-prefix-map=/build/r-base-7BvS0x/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c test-runner.cpp -o test-runner.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o testthat.so init.o reassign.o test-catch.o test-example.o test-runner.o -L/usr/lib/R/lib -lR
installing to /home/nick/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-testthat/00new/testthat/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘testthat’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/nick/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-testthat/00new/testthat/libs/testthat.so':
/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/nick/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-testthat/00new/testthat/libs/testthat.so)
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/nick/R/x86_64-pc-linux-gnu-library/4.0/testthat’
Warning in install.packages :
installation of package ‘testthat’ had non-zero exit status
ERROR: dependency ‘testthat’ is not available for package ‘isoband’
* removing ‘/home/nick/R/x86_64-pc-linux-gnu-library/4.0/isoband’
Warning in install.packages :
installation of package ‘isoband’ had non-zero exit status
ERROR: dependency ‘isoband’ is not available for package ‘ggplot2’
* removing ‘/home/nick/R/x86_64-pc-linux-gnu-library/4.0/ggplot2’
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpAwhI4K/downloaded_packages’
I figured from the first error message that the problem was testthat
is missing. I went here and tried running this command in hopes that I could install these prereqs to ggplot2
withr::with_makevars(c(PKG_LIBS = "-liconv"), install.packages("testthat"), assignment = "+=")
Yet, I still run into more errors:
Installing package into ‘/home/nick/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/testthat_3.0.1.tar.gz'
Content type 'application/x-gzip' length 678199 bytes (662 KB)
==================================================
downloaded 662 KB
* installing *source* package ‘testthat’ ...
** package ‘testthat’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -fpic -g -O2 -fdebug-prefix-map=/build/r-base-7BvS0x/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -fpic -g -O2 -fdebug-prefix-map=/build/r-base-7BvS0x/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c reassign.c -o reassign.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -fpic -g -O2 -fdebug-prefix-map=/build/r-base-7BvS0x/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c test-catch.cpp -o test-catch.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -fpic -g -O2 -fdebug-prefix-map=/build/r-base-7BvS0x/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c test-example.cpp -o test-example.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -fpic -g -O2 -fdebug-prefix-map=/build/r-base-7BvS0x/r-base-4.0.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c test-runner.cpp -o test-runner.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o testthat.so init.o reassign.o test-catch.o test-example.o test-runner.o -liconv -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -liconv
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:10: recipe for target 'testthat.so' failed
make: *** [testthat.so] Error 1
ERROR: compilation failed for package ‘testthat’
* removing ‘/home/nick/R/x86_64-pc-linux-gnu-library/4.0/testthat’
Warning in install.packages :
installation of package ‘testthat’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpAwhI4K/downloaded_packages’
I do not know a lot about R, so any assistance is greatly appreciated.