Installing cmdstan for cmdstanr

I am a UNIX sysadmin and I have a user who has asked for cmdstanr be installed on our system (Centos 7). I can load the library in R 4.1.0 but it has a issue when I try to install_cmdstan() see below. I would like to do the install so it is available system wide for all users.

> library(cmdstanr)
This is cmdstanr version 0.4.0
- Online documentation and vignettes at mc-stan.org/cmdstanr
- Use set_cmdstan_path() to set the path to CmdStan
- Use install_cmdstan() to install CmdStan
> install_cmdstan()
The C++ toolchain required for CmdStan is setup properly!
* Latest CmdStan release is v2.27.0
* Installing CmdStan v2.27.0 in /udd/salbb/.cmdstanr/cmdstan-2.27.0
* Downloading cmdstan-2.27.0.tar.gz from GitHub...
* Download complete
* Unpacking archive...
* Building CmdStan binaries...
cp bin/linux-stanc bin/stanc
g++ -std=c++1y -pthread -D_REENTRANT -Wno-sign-compare -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include   -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_5.7.0/include    -DBOOST_DISABLE_ASSERTS         -c -fvisibility=hidden -o bin/cmdstan/stansummary.o src/cmdstan/stansummary.cpp
chmod +x bin/stanc
g++ -std=c++1y -pthread -D_REENTRANT -Wno-sign-compare -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include   -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_5.7.0/include    -DBOOST_DISABLE_ASSERTS         -c -fvisibility=hidden -o bin/cmdstan/print.o src/cmdstan/print.cpp
/app/gcc-8.2.0@i86-rhel7.0/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/cc1plus: error while loading shared libraries: libmpfr.so.6: cannot open shared object file: No such file or directory
/app/gcc-8.2.0@i86-rhel7.0/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/cc1plus: error while loading shared libraries: libmpfr.so.6: cannot open shared object file: No such file or directory
make: *** [bin/cmdstan/stansummary.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [bin/cmdstan/print.o] Error 1

Warning message:
There was a problem during installation. See the error message(s) above. 

I downloaded the source for cmdstan. I ran make build in the top directory and got this error

salbb % make build
curl -L https://github.com/stan-dev/stanc3/releases/download/nightly/linux-stanc -o bin/stanc --retry 5 --retry-delay 10
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   619  100   619    0     0   1577      0 --:--:-- --:--:-- --:--:--  1620
100 17.1M  100 17.1M    0     0  10.0M      0  0:00:01  0:00:01 --:--:-- 16.4M
chmod +x bin/stanc
g++    -c -fvisibility=hidden -o bin/cmdstan/stansummary.o src/cmdstan/stansummary.cpp
src/cmdstan/stansummary.cpp:1:10: fatal error: cmdstan/stansummary_helper.hpp: No such file or directory
 #include <cmdstan/stansummary_helper.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [bin/cmdstan/stansummary.o] Error 1

Is there a simple fix that I may be missing?
Thanks

It’s not finding libmpfr, which is provided in the “Multi precision floating point” library. If dnf is your package manager

sudo dnf install mpfr-devel

should work.

Thank you. I tried installing the mpfr-devel and I am still getting the same error when I run the install inside my R session.
Compiling the code from source on the command line I get a different error:

salbb %  cd cmdstan-2.27.0
salbb %  make build
g++    -c -fvisibility=hidden -o bin/cmdstan/stansummary.o src/cmdstan/stansummary.cpp
src/cmdstan/stansummary.cpp:1:10: fatal error: cmdstan/stansummary_helper.hpp: No such file or directory
 #include <cmdstan/stansummary_helper.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [bin/cmdstan/stansummary.o] Error 1

For the libmpfr error, try installing the libmpfr6 package

When installing from the cmdstan source, you need to make sure that the the source code for the linked repositories (Stan & Math) are also downloaded. In this case, you’ll want to use install_cmdstan instead.