adeverse / ade4

Analysis of Ecological Data : Exploratory and Euclidean Methods in Environmental Sciences
http://adeverse.github.io/ade4/
39 stars 10 forks source link

installation on Mac OS from source with error #5

Closed rsamantha closed 7 years ago

rsamantha commented 7 years ago

Hi, I have installed ade4 1.7-5 from source on my Mac (with Sierra). I have installed gcc with brew (which now ships also gfortran). I received the following error:

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 -lgfortran clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [ade4.so] Error 1 ERROR: compilation failed for package ‘ade4’

I solved the problem with an hack, that I report here for other users' convenience, creating a symbolic link in the gcc folder installed via brew. In particular, brew creates the directory /usr/local/lib/gcc/6 and I created the folder /usr/local/lib/gcc/x86_64-apple-darwin13.0.0 and inside it the folder 4.8.2 linking /usr/local/lib/gcc/6. Obviously, reinstalling gcc rewrites all the folder /usr/local/lib/gcc/ thus removing the needed folder.

The alternative for me was to install from binaries which ended successfully.

Thank you for your work.

Samantha

hypotheses commented 7 years ago

Hi Samantha

I ran into similar issue with gfortran missing on MacOS. The solution I found was to install the fortran library provided from CRAN website: https://cran.r-project.org/bin/macosx/tools Another info I found was to install xcode-select --install which will install gfortran and a few other required libraries for developers on MacOS. http://mailman.ucar.edu/pipermail/ncl-install/2015-December/001955.html

ernstki commented 7 years ago

For the benefit of others who find themselves here through a web search for ld: library not found for -lgfortran and are using the version of R from MacPorts: down this path lies much frustration.

Even after installing (what I thought was) the appropriate gfortran package from https://cran.r-project.org/bin/macosx/tools, I still got a compiler error for libquadmath:

ld: library not found for -lquadmath
clang: error: linker command failed with exit code 1 (use -v to see invocation)

After uninstalling MacPorts' R package version 3.4.1 and switching to the official OS X installer from https://cran.r-project.org/bin/macosx/, it seems this problem went away.

This blog post (thecoatlessprofessor.com) had some background on the problem (and a complex problem it is) that eventually led me to a solution (use the "official" installer package), after some experimentation.

In the end, I did not need to install any gfortran package (in fact, I uninstalled it beforehand) or make any changes to ~/.R/Makevars.

sdray commented 7 years ago

Thanks a lot Kevin. Note also that Jean Thioulouse produced binaries of Github versions of 'ade' packages for Mac OS and Windows at http://pbil.univ-lyon1.fr/members/thioulouse/bin/

Cheers