Issue with terra package when deploy Shiny App

Hello everyone,
I have a big issue since some weeks without any solution.
Your help will be very appreciated.

I want to deploy my shiny app and I have a problem with the compilers C++17 with terra package.
I got this error message :slight_smile:

Error: Command failed (1)

Failed to run system command:

'/opt/R/4.3.2/lib/R/bin/R' --vanilla CMD INSTALL --preclean '/opt/rstudio-connect/mnt/tmp/RtmpdwNoKA/packrat-install-1e2061469277/terra' --library='/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-pc-linux-gnu/4.3.2' --install-tests --no-docs --no-multiarch --no-demo 

The command failed with output:

  • installing source package ‘terra’ ...
    ** package ‘terra’ successfully unpacked and MD5 sums checked
    ** using staged installation
    configure: CC: gcc -std=gnu11
    configure: CXX: g++ -std=gnu++11
    checking for gdal-config... /usr/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 2.4.1
    checking GDAL version >= 2.0.1... yes
    checking for gcc... gcc -std=gnu11
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether the compiler supports GNU C... yes
    checking whether gcc -std=gnu11 accepts -g... yes
    checking for gcc -std=gnu11 option to enable C11 features... none needed
    checking for stdio.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for strings.h... yes
    checking for sys/stat.h... yes
    checking for sys/types.h... yes
    checking for unistd.h... yes
    checking for gdal.h... yes
    checking GDAL: linking with --libs only... yes
    checking GDAL: /opt/gdal/gdal-2.4.1/share/gdal/pcs.csv readable... yes
    checking GDAL: checking whether PROJ is available for linking:... yes
    checking GDAL: checking whether PROJ is available for running:... yes
    configure: GDAL: 2.4.1
    configure: pkg-config proj exists, will use it
    checking for proj_api.h... yes
    configure: PROJ: 4.8.0
    checking for pj_init_plus in -lproj... yes
    checking PROJ: epsg found and readable... yes
    checking for geos-config... /usr/bin/geos-config
    checking geos-config usability... yes
    configure: GEOS: 3.5.0
    checking GEOS version >= 3.4.0... yes
    checking for geos_c.h... yes
    checking geos: linking with -L/usr/lib64 -lgeos_c... yes
    configure: Package CPP flags: -I/opt/gdal/gdal-2.4.1/include -I/usr/include
    configure: Package LIBS: -lproj -L/usr/lib64 -lgdal -L/usr/lib64 -lgeos_c
    configure: creating ./config.status
    config.status: creating src/Makevars
    ** libs
    Error: C++17 standard requested but CXX17 is not defined
  • removing ‘/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-pc-linux-gnu/4.3.2/terra’

Unable to fully restore the R packages associated with this deployment.
Please review the preceding messages to determine which package
encountered installation difficulty and the cause of the failure.

An error occurred while building your content.
This link offers advice for this kind of error:
Posit Connect Documentation Version 2023.10.0 - Troubleshooting
Build error: An error occurred while building your content. (Error code: r-build-need-cxx-defined)

I read a lot of document and some proposition without resolving the issue.

Thanks for your help.

Hi, it might be related to this: Error in .shlib_internal(args) : C++17 standard requested but CXX17 is not defined - Languages / R - Travis CI Community (travis-ci.community)

Hello,
Thanks for you answer. But I tried to do the same without resolving the issue.
Maybe I didn't understand correctly.
What I did, is that I created a .travis.yml file and I put it in the folder that contains the R script.

Is it the write right thing Sould I do?
Thanks

I would try to manually implement what that travis file tries to do, which is two steps ( in the terminal, not in R)

  1. have an .R folder in your home, the -p flag should cause it to either do nothing if you already have it, or else make the missing dir so you can run
    mkdir -p ~/.R
  2. given that you either had the necessary folder before or have it now, create a Makevars file that will live there with the following command
    echo 'CXX17 = g++-7 -std=gnu++17 -fPIC' > ~/.R/Makevars
1 Like

This topic was automatically closed 54 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.