问题描述
我尝试升级到El-Capitan和Xcode 7.0,现在gfortran不起作用。每次运行gfortran时,我都会得到一些Google搜索似乎无法解决的错误,所以我要求堆栈溢出:
我试图编译一个最小示例程序:
程序hello
print *,Hello World
结束程序hello
当我运行 gfortran test.f
gfortran:警告:无法理解kern.osversion '15 .0.0
ld:找不到-lgcc_s.10.4 $ b $的库b collect2:error:ld返回1退出状态
我不担心警告,但错误的ld是什么真的困扰着我。在/ usr / lib文件夹中有 libgcc_s.10.4.tbd
,但它似乎不被gfortran使用。
任何人都可以帮我解决这个问题,因为我想用gfortran来编译一些库吗?
更多信息:运行 gfortran -v
b
$ b $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $%在规格。
COLLECT_GCC = gfortran
COLLECT_LTO_WRAPPER = / usr / local / libexec / gcc / x86_64-apple-darwin12.2.0 / 4.8.0 / lto-wrapper
目标:x86_64-apple-darwin12.2.0
配置:../gcc-4.8-20120930/configure --enable languages = c ++,fortran
线程模型:posix
gcc版本4.8.0 20120930(实验)(GCC)
gfortran的版本c $ c> / usr / local )并不是GCC的版本,苹果可能会用Xcode发布(afaik在切换到llvm之前,它们从未将它转换为新版本的GCC, Fortran前端。在el capitan上使用Xcode 7发布的gcc版本标识为:
配置为:--prefix = / Applications / Xcode.app /目录/ Developer / usr --with-gxx-include-dir = / usr / include / c ++ / 4.2.1
Apple LLVM版本7.0.0(clang-700.0.72)
目标:x86_64-apple-darwin15.0.0
线程模型:posix
您的版本来自其他地方,并且已经足够老,不知道 x86_64-apple-darwin15.0.0
目标。您需要更新该编译器才能使用 gfortran
。 macports和homebrew都提供了在OS X el capitan上轻松安装各种版本的gcc / gfortran,我推荐使用其中的一个来安装gcc。或者,您可以追踪以前安装gcc 4.8的任何内容,看看它们是否为el capitan提供更新。
I tried upgrading to El-Capitan and Xcode 7.0 and now gfortran doesn't work. Everytime I run gfortran, I get errors which google search doesn't seem to resolve so I'm asking stack overflow:
I'm trying to compile a minimal example program:
program hello
print *, "Hello World"
end program hello
When I run gfortran test.f
gfortran: warning: couldn’t understand kern.osversion ‘15.0.0
ld: library not found for -lgcc_s.10.4
collect2: error: ld returned 1 exit status
I'm not worried about the warning but the error of the ld is what's really bothering me. There's libgcc_s.10.4.tbd
in the /usr/lib folder but it seems not be used by gfortran.
Can anyone help me resolve this as I would like to use gfortran for compiling some libraries?
MORE info: running gfortran -v
outputs
gfortran: warning: couldn’t understand kern.osversion ‘15.0.0
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin12.2.0/4.8.0/lto-wrapper
Target: x86_64-apple-darwin12.2.0
Configured with: ../gcc-4.8-20120930/configure --enable languages=c++,fortran
Thread model: posix
gcc version 4.8.0 20120930 (experimental) (GCC)
The version of gfortran you have (4.8 installed into /usr/local
) is not a version of GCC that apple would have distributed with Xcode (afaik they never made it to a version of GCC that new before switching to llvm, which has no Fortran front-end. The version of gcc distributed with Xcode 7 on el capitan identifies itself as:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
Your version came from somewhere else and is old enough to not know the x86_64-apple-darwin15.0.0
target. You'll need to update that compiler to get a working gfortran
. Both macports and homebrew provide easy installations of various versions of gcc/gfortran on OS X el capitan, and I'd recommend using one of those to install gcc. Alternatively you can track down whatever you used to install gcc 4.8 before and see if they provide an update for el capitan.
这篇关于升级到El Capitan后,gfortran不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!