'RShiny Deployment, CMake issue

I have written an app, which I can deploy on shinyapps.io with no problem from my old laptop with Windows 10, R version 4.1.0. When I try to deploy the exact same app from my new laptop with Windows 11 and R version 4.1.3. I get the following error after the line building: Building package: nloptr in the tasks log:

[2022-03-18T16:07:17.299014302+0000] Building R package: nloptr (2.0.0)
/mnt/packages/build /mnt
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 we are using the GNU C++ compiler... yes
checking whether g++ -std=gnu++14 accepts -g... yes
checking how to run the C++ preprocessor... g++ -std=gnu++14 -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ -std=gnu++14 accepts -g... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking if pkg-config knows NLopt... no
using NLopt via local cmake build on x86_64 

------------------ CMAKE NOT FOUND --------------------

CMake was not found on the PATH. Please install CMake:

 - yum install cmake          (Fedora/CentOS; inside a terminal)
 - apt install cmake          (Debian/Ubuntu; inside a terminal).
 - pacman -S cmake            (Arch Linux; inside a terminal).
 - brew install cmake         (MacOS; inside a terminal with Homebrew)
 - port install cmake         (MacOS; inside a terminal with MacPorts)

Alternatively install CMake from: <https://cmake.org/>

-------------------------------------------------------

configure: creating ./config.status
config.status: creating src/Makevars
make: Entering directory '/tmp/RtmpIsrN7b/R.INSTALL8fd1a60cdae/nloptr/src'
gcc -I"/opt/R/4.1.3/lib/R/include" -DNDEBUG -I../inst/include  -I'/opt/R/4.1.3/lib/R/library/testthat/include' -I/usr/local/include   -fpic  -g -O2  -c init_nloptr.c -o init_nloptr.o
gcc -I"/opt/R/4.1.3/lib/R/include" -DNDEBUG -I../inst/include  -I'/opt/R/4.1.3/lib/R/library/testthat/include' -I/usr/local/include   -fpic  -g -O2  -c nloptr.c -o nloptr.o
g++ -std=gnu++11 -I"/opt/R/4.1.3/lib/R/include" -DNDEBUG -I../inst/include  -I'/opt/R/4.1.3/lib/R/library/testthat/include' -I/usr/local/include   -fpic  -g -O2  -c test-C-API.cpp -o test-C-API.o
g++ -std=gnu++11 -I"/opt/R/4.1.3/lib/R/include" -DNDEBUG -I../inst/include  -I'/opt/R/4.1.3/lib/R/library/testthat/include' -I/usr/local/include   -fpic  -g -O2  -c test-runner.cpp -o test-runner.o
g++ -std=gnu++11 -shared -L/opt/R/4.1.3/lib/R/lib -L/usr/local/lib -o nloptr.so init_nloptr.o nloptr.o test-C-API.o test-runner.o -llapack -lblas -lgfortran -lm -lquadmath -Lnlopt/lib -lnlopt -L/opt/R/4.1.3/lib/R/lib -lR
make: Leaving directory '/tmp/RtmpIsrN7b/R.INSTALL8fd1a60cdae/nloptr/src'
make: Entering directory '/tmp/RtmpIsrN7b/R.INSTALL8fd1a60cdae/nloptr/src'
make: Leaving directory '/tmp/RtmpIsrN7b/R.INSTALL8fd1a60cdae/nloptr/src'
Warning: unknown option ‘--vanilla’
* installing to library ‘/opt/R/4.1.3/lib/R/library’
* installing *source* package ‘nloptr’ ...
** package ‘nloptr’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
/usr/bin/ld: cannot find -lnlopt
collect2: error: ld returned 1 exit status
make: *** [/opt/R/4.1.3/lib/R/share/make/shlib.mk:10: nloptr.so] Error 1
ERROR: compilation failed for package ‘nloptr’
* removing ‘/opt/R/4.1.3/lib/R/library/nloptr’
################################# End Task Log ################################# 
Error: Unhandled Exception: Child Task 1119580121 failed: Error building image: Build exited with non-zero status: 1
Execution halted

Could someone please help me with this? The app runs locally on the new computer with no issues, I have downloaded CMake from https://cmake.org and included it into my system path.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source