Mac OS X R error “ld: warning: directory not found for option”

前端 未结 7 1481
梦毁少年i
梦毁少年i 2020-12-01 04:38

I am trying to install an R package from source, but getting an error:

* installing *source* package ‘mclust’ ...
** package ‘mclust’ successfully unpacked a         


        
7条回答
  •  庸人自扰
    2020-12-01 05:27

    You need to modify the ~/.R/Makevars file. For a greater overview of this see: https://cran.r-project.org/doc/manuals/r-release/R-admin.html#OS-X-packages

    Alternatively, this has been answered before in a bit more depth by @kevin-ushey in Rcpp warning: "directory not found for option '-L/usr/local/Cellar/gfortran/4.8.2/gfortran'".

    What is happening is your code is not being run under gcc instead it is being forwarded to clang

    You will need to change your compile statements in ~/.R/Makevars/ to gcc using:

    VER=-5.3.0 
    CC=gcc$(VER)
    CXX=g++$(VER)
    CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
    CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
    FLIBS=-L/usr/local/Cellar/gcc/5.3.0/lib/gcc/5
    

    This assumes you have already installed gcc via homebrew under:

    brew install gcc
    

    (gfortran ships with gcc in brew now)

提交回复
热议问题