Mac OS XR error "ld: warning: directory not found for option"

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

* installing *source* package 'mclust' ... ** package 'mclust' successfully unpacked and MD5 sums checked ** libs gfortran-4.8 -fPIC -g -O2 -c mclust.f -o mclust.o gfortran-4.8 -fPIC -g -O2 -c mclustaddson.f -o mclustaddson.o clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o mclust.so mclust.o mclustaddson.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2' ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2' ld: library not found for -lquadmath clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [mclust.so] Error 1 ERROR: compilation failed for package 'mclust' * removing '/Library/Frameworks/R.framework/Versions/3.3/Resources/library/mclust' Warning in install.packages : installation of package 'mclust' had non-zero exit status 

I don't have /usr/local/lib/gcc/x86_64-apple-darwin13.0.0 , so it makes sense that it cannot be found. I have /usr/local/lib/gcc/i686-apple-darwin11 and /usr/local/lib/gcc/4.8 (a symbolic link to the Homebrew installation). Where does he get x86_64-apple-darwin13.0.0 from?

There are many links to a similar error on the Internet. However, all of them are related to compilation in Xcode and are allowed by updating project parameters that are not applicable here.

+5
source share
2 answers

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

Alternatively, this answer was given in more detail in @ kevin-ushey in Rcpp warning: "a directory not found for the option '-L / usr / local / Cellar / gfortran / 4.8.2 / gfortran'" .

What happens, your code does not run in gcc , but is sent to clang

You will need to change your compiled 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 

It is assumed that you have already installed gcc via homebrew under:

 brew install gcc 

(now gfortran ships with gcc to brew)

+10
source

From http://thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error/ you can fix this by downloading additional gfortran libraries from http: //r.research.att .com / libs / and extracting them. To do this, on the command line

 curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2 sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C / 
+6
source

Source: https://habr.com/ru/post/1245045/


All Articles