I'm getting an error with gfortran on a freshly installed Lion computer. The error is:
ld: library not found for -lgcc
I appreciate anyone who can offer some insights.
Well, the GFortran binaries are sourced from:
The latest binary was built against XCode 3.2.3, but works for 3.2.5 and 3.2.6. I cannot guarantee that it will work with XCode 4.0+.
I don't know if much can be done about this until Lion deployment becomes more wide-spread and open source projects publish needed updates.
Actually, are the other GCC compilers from XCode still working?
Yes, the version of GCC with XCode 4.1 works fine. It's just gfortran that's the problem.
Hmm... not sure what to do then. I can shoot Simon Urbanek an email and see if he's aware of the issue.
I won't really be able to dig into testing this until I upgrade to Lion---which won't be for a month or two as I prefer to let the dust settle a bit before adopting a major release.
As an alternative, you could install the GCC brew from Homebrew-alt and tell it to build you a fortran compiler:
brew install https://raw.github.com/adamv/homebrew-alt/master/duplicates/gcc.rb --enable-fortran
The resulting binary is named gfortran-4.6 to avoid clashing with other copies of GCC.
hey, I'm having the same problem on 10.7.
apple moved libgcc.a which gfortran is trying to link into binaries it produces.
find /usr/lib -name 'libgcc.a' gives
in 10.6 its in the same place but with darwin10.
so the obvious quick hack is to do export LIBRARY_PATH=/usr/lib/gcc/i686-apple-darwin11/4.2.1 and try again.
that seems to work for me - the linker didn't complain and this was enough to successfully complete a scipy build via pip - and pass all the tests - but I can see that the libgcc.a is a different size in the two versions so YMMV.
Allright, new GFortran binaries for Lion were released on r.research.att.com. I just updated the formula, but I need a couple of Guinea Pigs to test it out as I don't have a machine running 10.7 myself.
To try the formula, do:
cd `brew --prefix`
git checkout -b gfortran-test
brew pull https://github.com/Sharpie/homebrew/commit/2fc0198268204b8fa164fb36e607086472bb85c9
brew uninstall gfortran
brew install gfortran
Let me know if it works or if anything goes wrong.
It worked -- thanks!
Allright, submitted as pull request #6561.
@rtlee Thanks a bunch for testing.
This worked for me too, thanks!
Thanks for this. I was able to compile scipy thanks to this and @rsenk330's advice here: http://projects.scipy.org/scipy/ticket/1476#comment:20
Closed by #6561
I was having problems compiling numpy+atlas/lapack+gfortran until I found out that the libgfortran.a linked by this formula is the i386 one, instead of the x86_64 under Cellar/gfortran/4.2.4-5666.3/lib/gcc/i686-apple-darwin11/4.2.1/x86_64.
Would it be possible to have an install option or test in some way the arch of the system before linking?
GFortran should choose which libgfortran.a file gets linked based on the -arch flags that get passed to the compiler. I suspect numpy may be forcing an i386 build---the Python guys like to do that as wxWidgets is i386 only and a lot of Python modules use wxPython.
Recently had this issue trying to pip install scipy - solution was LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/usr/lib/llvm-gcc/4.2.1 pip install scipy. Just in case anyone else is looking.
pip install scipy
LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/usr/lib/llvm-gcc/4.2.1 pip install scipy