How to run "sf" package in RStudio under Linux Mint 20.3

Hello folks,

I run Linux Mint 20.3 on my computer and already installed R and RStudio.

I recently tried to download and run the "sf" package. Whilst it was possible for me to download the package, I am unable to either run the package nor to find it in my library within RStudio.

this is the result after inserting the command install.packages("sf") within the console of RStudio:

  • installing source package ‘e1071’ ...
    ** Paket ‘e1071’ erfolgreich entpackt und MD5 Summen überprüft
    ** using staged installation
    ** libs
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Rsvm.c -o Rsvm.o
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c cmeans.c -o cmeans.o
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c cshell.c -o cshell.o
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c floyd.c -o floyd.o
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
    g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c svm.cpp -o svm.o
    /bin/bash: g++: Befehl nicht gefunden
    make: *** [/usr/lib/R/etc/Makeconf:177: svm.o] Fehler 127
    ERROR: compilation failed for package ‘e1071’
  • removing ‘/home/edward/R/x86_64-pc-linux-gnu-library/3.6/e1071’
    Warning in install.packages :
    installation of package ‘e1071’ had non-zero exit status
  • installing source package ‘wk’ ...
    ** Paket ‘wk’ erfolgreich entpackt und MD5 Summen überprüft
    ** using staged installation
    ** libs
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c bbox-handler.c -o bbox-handler.o
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c count-handler.c -o count-handler.o
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c debug-filter.c -o debug-filter.o
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c flatten-filter.c -o flatten-filter.o
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c handle-crc.c -o handle-crc.o
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c handle-rct.c -o handle-rct.o
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c handle-sfc.c -o handle-sfc.o
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c handle-wkb.c -o handle-wkb.o
    g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c handle-wkt.cpp -o handle-wkt.o
    /bin/bash: g++: Befehl nicht gefunden
    make: *** [/usr/lib/R/etc/Makeconf:177: handle-wkt.o] Fehler 127
    ERROR: compilation failed for package ‘wk’
  • removing ‘/home/edward/R/x86_64-pc-linux-gnu-library/3.6/wk’
    Warning in install.packages :
    installation of package ‘wk’ had non-zero exit status
  • installing source package ‘Rcpp’ ...
    ** Paket ‘Rcpp’ erfolgreich entpackt und MD5 Summen überprüft
    ** using staged installation
    ** libs
    g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/ -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c api.cpp -o api.o
    /bin/bash: g++: Befehl nicht gefunden
    make: *** [/usr/lib/R/etc/Makeconf:177: api.o] Fehler 127
    ERROR: compilation failed for package ‘Rcpp’
  • removing ‘/home/edward/R/x86_64-pc-linux-gnu-library/3.6/Rcpp’
    Warning in install.packages :
    installation of package ‘Rcpp’ had non-zero exit status
    ERROR: dependency ‘e1071’ is not available for package ‘classInt’
  • removing ‘/home/edward/R/x86_64-pc-linux-gnu-library/3.6/classInt’
    Warning in install.packages :
    installation of package ‘classInt’ had non-zero exit status
    ERROR: dependencies ‘Rcpp’, ‘wk’ are not available for package ‘s2’
  • removing ‘/home/edward/R/x86_64-pc-linux-gnu-library/3.6/s2’
    Warning in install.packages :
    installation of package ‘s2’ had non-zero exit status
    ERROR: dependency ‘Rcpp’ is not available for package ‘units’
  • removing ‘/home/edward/R/x86_64-pc-linux-gnu-library/3.6/units’
    Warning in install.packages :
    installation of package ‘units’ had non-zero exit status
    ERROR: dependencies ‘classInt’, ‘Rcpp’, ‘s2’, ‘units’ are not available for package ‘sf’
  • removing ‘/home/edward/R/x86_64-pc-linux-gnu-library/3.6/sf’
    Warning in install.packages :
    installation of package ‘sf’ had non-zero exit status

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

Can someone please help me to resolve this issue?

The installation is failing because you don't have g++ installed in your system (not in R), try installing it with this command on a system terminal.

sudo apt install g++

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.