Error code: r-compiler-failure

Good day, when I upload my API to my RConnect server it gives me the following error. When I test it in development mode, my API works correctly, this error appears when I want to put it into production.

[Connect] 2023/07/20 20:11:00.596607064
[Connect] 2023/07/20 20:11:00.596618235 The command failed with output:
[Connect] 2023/07/20 20:11:00.596619217 * installing source package ‘KernSmooth’ ...
[Connect] 2023/07/20 20:11:00.596627813 ** package ‘KernSmooth’ successfully unpacked and MD5 sums checked
[Connect] 2023/07/20 20:11:00.596629056 ** using staged installation
[Connect] 2023/07/20 20:11:00.596637641 ** libs
[Connect] 2023/07/20 20:11:00.596638763 using C compiler: ‘gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0’
[Connect] 2023/07/20 20:11:00.596647410 sh: 1: gfortran: not found
[Connect] 2023/07/20 20:11:00.596648302 gfortran -fpic -g -O2 -ffile-prefix-map=/build/r-base-sYMOIw/r-base-4.3.1=. -fstack-protector-strong -c blkest.f -o blkest.o
[Connect] 2023/07/20 20:11:00.596657568 /bin/bash: line 1: gfortran: command not found
[Connect] 2023/07/20 20:11:00.596658791 make: *** [/usr/lib/R/etc/Makeconf:214: blkest.o] Error 127
[Connect] 2023/07/20 20:11:00.596666886 ERROR: compilation failed for package ‘KernSmooth’
[Connect] 2023/07/20 20:11:00.596667658 * removing ‘/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-pc-linux-gnu/4.3.1/KernSmooth’
[Connect] 2023/07/20 20:11:00.596676454
[Connect] 2023/07/20 20:11:00.596677195 Unable to fully restore the R packages associated with this deployment.
[Connect] 2023/07/20 20:11:00.596685431 Please review the preceding messages to determine which package
[Connect] 2023/07/20 20:11:00.596686281 encountered installation difficulty and the cause of the failure.
[Connect] An error occurred while building your content.
[Connect] This link offers advice for this kind of error:
[Connect] Posit Connect Documentation - Troubleshooting
[Connect] Build error: An error occurred while building your content. (Error code: r-compiler-failure)
Api deployment failed with error: An error occurred while building your content. (Error code: r-compiler-failure)

These error messages indicate that the Fortran compiler is missing on your connect server. Typically this is installed as a dependency of the used R package. Can you tell us which OS is used on the Connect server and how R was installed?

1 Like

Thanks for your reply. Yes, indeed it was that I needed to install gfortran on my ubuntu 22 server. I fixed the problem with:
sudo apt install gfortran

1 Like