zhengxwen / SNPRelate

R package: parallel computing toolset for relatedness and principal component analysis of SNP data (Development version only)
http://www.bioconductor.org/packages/SNPRelate
98 stars 25 forks source link

library not found for -lgfortran #2

Closed igordot closed 9 years ago

igordot commented 10 years ago

I am trying to install SNPRelate on a Mac using: install_github("zhengxwen/SNPRelate") I was able to install gdsfmt just fine this way. However, with SNPRelate, I get the following error:

ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [SNPRelate.so] Error 1
ERROR: compilation failed for package 'SNPRelate'
* removing '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/SNPRelate'
Error: Command failed (1)

It appears that the problem is with locating the gfortran shared library (libgfortran.a). I have the library. I am not sure why it was not found (maybe it's due to the fact that it was installed using Homebrew). After I copied libgfortran.a to /usr/local/lib, the installation was able to complete successfully.

I am not sure why the installer is looking for those three directories that generate the warnings. I don't have any of them. Instead of /usr/local/lib/gcc/i686-apple-darwin8/4.2.3, I have /usr/local/lib/gcc/i686-apple-darwin11/4.2.1 where libgfortran.a is located. The installer has the right general idea, but I don't knew where it's getting the darwin8 directory (corresponds to Mac OS X 10.4, so this seems to be some legacy issue). I couldn't find any references to those directories in the source files.

I don't know if this is an easy fix, but certainly something to look into.

zhengxwen commented 10 years ago

Your problem is not relevant to the SNPRelate package itself, and the library gfortran is the default library the R system uses. Reinstalling R with the latest version should be able to solve your problem.

igordot commented 10 years ago

I have a fresh install of R.

I have never had the directory /usr/local/lib/gcc/i686-apple-darwin8/4.2.3. I think it's very odd that it is coming up.

jllegras commented 10 years ago

I have met the same problem with the installation of SNPrelate, with exactly the same error messages. see:

jllegras commented 10 years ago

It is a Mac book, with Mac OS10.95, and R3.03.

zhengxwen commented 10 years ago

gfortran has to be installed in your Apple system (http://hpc.sourceforge.net).

jllegras commented 10 years ago

Dear Xiuwen Thank you for your answer. Installing gfortran was not enough. There is a path issue in the R framework (/Library/Frameworks/R.framework/Resources/etc/Makeconf): this line: FLIBS = -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64 -L/usr/local/lib/x86_64 -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3 -lgfortran

has to be changed to FLIBS = -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64 -L/usr/local/lib/x86_64 -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3 -L/usr/local/lib/x86_64-apple-darwin13.1.0/4.9.0 -lgfortran

in order to update the version of darwin. In fact I should have removed ancient version which are not found on the computer.

I managed to compile from Gihub, after these change, and got a package. However when using SNPRelate I got error messages (may be gdsfmt?). Meanwhile, thanks to snphylo website, from I realized that I had not witen the proper interaction for installing the package so that with “source “ option it worked. I also ad to downgrade the version of gdsfmt.

Now it works. Thank you for all. Best.

JL

Le 21 sept. 2014 à 01:27, Xiuwen Zheng notifications@github.com a écrit :

gfortran has to be installed in your Apple system (http://hpc.sourceforge.net).

— Reply to this email directly or view it on GitHub.

zhengxwen commented 10 years ago

If you get an error like:

> library(SNPRelate)
Error : .onAttach failed in attachNamespace() for 'SNPRelate', details:
 call: fun(libname, pkgname)
 error: function 'GDS_Mach_GetNumOfCPU' not provided by package 'gdsfmt'
Error: package or namespace load failed for ‘SNPRelate’

Please reinstall the SNPRelate package (v0.99.2) from Bioconductor.

megancamilla commented 9 years ago

I have also struggled with this same error: Solved my compiling issues by replacing the line in (/Library/Frameworks/R.framework/Resources/etc/Makeconf): FLIBS = -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64 -L/usr/local/lib/x86_64 -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3 -lgfortran

with this line: FLIBS = -L/usr/local/lib/gcc/x86_64-apple-darwin13.4.0/4.9.2/ -lgfortran