Ubuntu 18.04: Cannot install library testthat

Hi,
I am running R version 4.0.3 in Rstudio 1.3.1093 on Ubuntu 18.04. I run into issues trying to do install.packages("testthat") which is concern because ultimately I want to install tidyverse and ggplot2.

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.2.tar.gz'
Content type 'application/x-gzip' length 680365 bytes (664 KB)
==================================================
downloaded 664 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 -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

The downloaded source packages are in
	‘/tmp/RtmpJRYZwm/downloaded_packages’

I checked in the specified folder I have no directory named 00LOCK-testthat. I was wondering, after reading this thread, if I should attempt to uninstall R and Rstudio and reinstall them in a particular way? I thought about this, but user of that thread is a Mac user while I am a Linux user, I didn't have issues loading other packages in my 4.0 directory, and I was not sure if there is a simpler solution to this so do not accidently make things worse when I reinstall.
Any assistance is greatly appreciated!

You seem to be missing a system library, try installing it from a system terminal.

sudo apt install libstdc++6

Hi there,
I already have libstdc++6 installed.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
libstdc++6 is already the newest version (8.4.0-1ubuntu1~18.04).
The following packages were automatically installed and are no longer required:
  linux-hwe-5.4-headers-5.4.0-42 linux-hwe-5.4-headers-5.4.0-53
  linux-hwe-5.4-headers-5.4.0-56 linux-hwe-5.4-headers-5.4.0-58
  linux-hwe-5.4-headers-5.4.0-59 linux-hwe-5.4-headers-5.4.0-60
  linux-hwe-5.4-headers-5.4.0-62 python-decorator python-numpy python-olefile
  python-pil
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
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.2.tar.gz'
Content type 'application/x-gzip' length 680365 bytes (664 KB)
==================================================
downloaded 664 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 -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

The downloaded source packages are in
	‘/tmp/Rtmpyb0amP/downloaded_packages’

Weird, it doesn't seem to recognize it or is not a compatible version, I would try filing an issue on the package's GitHub repository.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.