gfortran在Mac OS X 10.9上不起作用。

时间:2022-08-15 16:48:12

I updated my Mac to OS X 10.9 GM, then I found that gfortran does not work. When building any program, it shows:

我把Mac升级到OS X 10.9 GM,然后发现gfortran不管用。在构建任何程序时,它显示:

ld: library not found for -lcrt1.10.5.o
collect2: ld return 1

Does anyone know how I might solve this?

有人知道我怎么解决这个问题吗?

3 个解决方案

#1


4  

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.

这个问题是因为OS X 10.9完全删除了/Developer目录,其中包含了crt1.10.5库。o用于定位。库已经转移到新的Xcode目录(确保Xcode也更新到最新的5.0.1+版本)。我发现crt1.10.5。o是深藏在这里/应用程序/ xcode /内容/开发/平台/ MacOSX.platform /开发/ S‌dk / MacOSX10.9.sdk / usr / lib。我认为应该有一种自动重定向ld的方法,但我不知道如何重定向。现在我使用-L标志进行编译。

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


3  

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

Gfortran已经由http://hpc.sourceforge.net/为Mac OS X Mavericks 10.9编译

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

首先,cd到Mavericks安装的根目录,以便文件递归地提取到适当的文件夹中

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


0  

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.

我也遇到过类似的问题(ld: library not found for -lcrt0.o),但我发现,当我停止使用-static标志和gfortran命令时,这些问题就消失了。静态-libgcc标志似乎还可以。

#1


4  

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.

这个问题是因为OS X 10.9完全删除了/Developer目录,其中包含了crt1.10.5库。o用于定位。库已经转移到新的Xcode目录(确保Xcode也更新到最新的5.0.1+版本)。我发现crt1.10.5。o是深藏在这里/应用程序/ xcode /内容/开发/平台/ MacOSX.platform /开发/ S‌dk / MacOSX10.9.sdk / usr / lib。我认为应该有一种自动重定向ld的方法,但我不知道如何重定向。现在我使用-L标志进行编译。

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


3  

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

Gfortran已经由http://hpc.sourceforge.net/为Mac OS X Mavericks 10.9编译

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

首先,cd到Mavericks安装的根目录,以便文件递归地提取到适当的文件夹中

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


0  

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.

我也遇到过类似的问题(ld: library not found for -lcrt0.o),但我发现,当我停止使用-static标志和gfortran命令时,这些问题就消失了。静态-libgcc标志似乎还可以。