簡體   English   中英

安裝 R package “ld:警告:找不到選項的目錄”時出現問題

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

我正在嘗試通過使用在 R 中安裝 package gradientForest

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

我收到了這個錯誤

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

我已經嘗試過這個線程這個線程的答案。

根據這些線程,我安裝了 gcc 使用

brew install gcc

我的 Makevars 看起來像

## 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`

但不幸的是,它並沒有改變我遇到的錯誤。 我的 R 版本是 3.6.1,我在 MacOS Catalina 上。

如果有人能夠幫助我,我將不勝感激。 謝謝

以下是 R 官方文檔中有關如何在 Mac 上安裝 R 以及相關錯誤的片段:


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 =

欲了解更多信息,請訪問以下鏈接 6.3.2

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

這可能會幫助你。

得到相同的編譯錯誤。 手動重新安裝 Clang 和 GFortran 解決了我的問題。 我使用的說明: R MACOS 上的 RCPP 編譯器工具

(在 Catalina 10.15.3 上;R 3.6.2;RStudio 1.2.5)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM