gfortran doesn't work on Mac OS X 10.9

与世无争的帅哥 提交于 2020-01-01 03:36:09

问题


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?


回答1:


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/S‌​DKs/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/S‌​DKs/MacOSX10.9.sdk/usr/lib/

This works for me as a temperary solution. I am also waiting for better solutions to come up.




回答2:


Gfortran has already been compiled for Mac OS X Mavericks 10.9 by http://hpc.sourceforge.net/

First, cd to the root of your Mavericks installation so the files extract recursively into the proper folders

cd /
sudo wget http://prdownloads.sourceforge.net/hpc/gcc-4.9-bin.tar.gz
tar -xvf gcc-4.9-bin.tar.gz

gfortran --help



回答3:


I had similar problems (ld: library not found for -lcrt0.o) but I discovered that they went away when I stopped using the -static flag with the gfortran command. The -static-libgcc flag seems to be OK.



来源:https://stackoverflow.com/questions/19261001/gfortran-doesnt-work-on-mac-os-x-10-9

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!