Reputation: 51
I installed R on Mac OS using homebrew. Until now everything was smooth. Today, I wanted to use arbitrary precision on some calculations on R. I saw that Rmpfr
package is easy to use, so I decided to install it. First, I used the usual:
install.packages("Rmpfr")
and I received this message:
checking for mpfr.h... no
configure: error: Header file mpfr.h not found; maybe use --with-mpfr-include=INCLUDE_PATH
ERROR: configuration failed for package ‘Rmpfr’
So I discovered that the mpfr headers were in /usr/local/Cellar/mpfr/3.1.3/include
, but not in /usr/include
or /usr/local/include
I symlink them, and also the libs in /usr/local/Cellar/mpfr/3.1.3/
to /usr/lib
or /usr/local/lib
. After that, it starts to compile, but then I received the following message:
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -o Rmpfr.so Ops.o Summary.o convert.o init.o utils.o -lmpfr -lgmp -F/usr/local/Cellar/r/3.2.2_1/R.framework/.. -framework R -lintl -Wl,-framework -Wl,CoreFoundation
ld: library not found for -lmpfr
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Rmpfr.so] Error 1
ERROR: compilation failed for package ‘Rmpfr’
Any ideas what can I do?
Upvotes: 1
Views: 1114
Reputation: 6349
You can simply run brew link gmp mpfr
to create the missing symlinks.
Upvotes: 2
Reputation: 51
After several hours trying different options, finally I discovered a work around.
I simlink the libs to the R path:
cd /usr/local/Cellar/r/3.2.2_1/R.framework/Resources/lib
ln -s /usr/local/Cellar/mpfr/3.1.3/lib/libmpfr.* .
ln -s /usr/local/Cellar/gmp/6.0.0a/lib/libgmp* .
After that, I ran:
install.packages('Rmpfr', type = "source", configure.args=c('--with-mpfr-include=/usr/local/include','--with-mpfr-lib=/usr/local/lib'))
And everything compiled OK.
Upvotes: 2