gfortran在Mac OS X 10.9上不起作用
我将Mac更新为OS X 10.9 GM,然后发现gfortran不起作用. 构建任何程序时,它显示:
I updated my Mac to OS X 10.9 GM, then I found that gfortran does not work. When building any program, it shows:
ld: library not found for -lcrt1.10.5.o
collect2: ld return 1
有人知道我该怎么解决吗?
Does anyone know how I might solve this?
此问题是因为OS X 10.9已完全删除了用于查找库crt1.10.5.o的/Developer目录.库已移至新的Xcode目录(确保Xcode也已更新至最新版本5.0.1+).我发现crt1.10.5.o实际上隐藏在/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib中.我相信应该有一种自动重定向ld的方法,但是我不知道如何.所以现在我正在使用-L标志进行编译.
This problem is because OS X 10.9 has removed the /Developer directory completely where the library crt1.10.5.o used to locate. The libraries have been moved to the new Xcode directory (make sure that Xcode is also updated to the latest version 5.0.1+). I found that crt1.10.5.o is actually hidden deep in here /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib. I believe there should be a way to redirect ld automatically, but I do not know how. So for now I am using the -L flag to compile.
gfortran ... -L /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/
这对我来说是一个临时的解决方案.我也在等待更好的解决方案.
This works for me as a temperary solution. I am also waiting for better solutions to come up.