简体   繁体   中英

Problem installing R package “ld: warning: directory not found for option ”

I'm trying to install the package gradientForest in R by using

install.packages("gradientForest", repos="http://R-Forge.R-project.org")

And I'm getting this error

ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran

I've already tried the answer from this thread , and this thread .

According to these threads, I've installed gcc using

brew install gcc

and my Makevars looks like

## With Rcpp 0.11.0 and later, we no longer need to set PKG_LIBS as there is
## no user-facing library. The include path to headers is already set by R.
#PKG_LIBS = 

## With R 3.1.0 or later, you can uncomment the following line to tell R to 
## enable compilation with C++11 (or even C++14) where available
CXX_STD = CXX17

VER=-9
CC=gcc$(VER)
CXX=g++$(VER)
CXX11=g++$(VER)
CXX14=g++$(VER)
CXX17=g++$(VER)
CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
FLIBS=-L`gfortran -print-file-name=libgfortran.dylib | xargs dirname`

but unfortunately it does not change anything on the error I'm having. My R version is 3.6.1 and I am on MacOS Catalina.

If somebody is able to help me, I would be very grateful. Thanks

Below is a snippet from R official docs on how to install R on Mac, and related errors:


CC = /usr/local/clang7/bin/clang
CXX = /usr/local/clang7/bin/clang++
CXX11 = $CXX
CXX14 = $CXX
CXX17 = $CXX
CFLAGS = -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion
CXXFLAGS = -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion
CXX11FLAGS = $CXXFLAGS
CXX14FLAGS = $CXXFLAGS
CXX17FLAGS = $CXXFLAGS
and gfortran by (El Capitan)

FC = /usr/local/gfortran/bin/gfortran
FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0
  -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
or (Sierra or High Sierra)

FC = /usr/local/gfortran/bin/gfortran
FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin16/6.3.0
  -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
or (Mojave or later)

FC = /usr/local/gfortran/bin/gfortran
FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0
  -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
(with lines broken here for legibility).

If using the C/C++ compilers from the Command Line Tools (which do not have OpenMP support) one will need to include

SHLIB_OPENMP_CFLAGS =
SHLIB_OPENMP_CXXFLAGS =

For more information visit the below link at 6.3.2

https://cran.r-project.org/doc/manuals/r-patched/R-admin.html

This might help you.

Got the same compilation error. Manual re-installation of both Clang and GFortran solved my problem. The instructions I used: R COMPILER TOOLS FOR RCPP ON MACOS

(on Catalina 10.15.3; R 3.6.2; RStudio 1.2.5)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM