You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

gfortran无法识别macOS Ventura版本及编译报错求助

解决macOS Ventura下gfortran版本检测报错及configure脚本失败问题

问题现象

升级到macOS Ventura后,执行gfortran --version会出现版本识别警告:

gfortran: warning: could not understand version ‘13.00.00’
GNU Fortran (GCC) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

该警告会破坏依赖macOS版本检测的./configure脚本,例如编译LoopTools时会触发以下错误:

arm64-apple-darwin20.0.0-gfortran: warning: could not understand version '13.00.00'
ld: -rpath can only be used when targeting Mac OS X 10.5 or later
collect2: error: ld returned 1 exit status

解决办法

方法1:手动指定macOS目标版本

在执行./configure前,设置环境变量指定兼容的macOS版本,示例:

export MACOSX_DEPLOYMENT_TARGET=12.0

完成后再运行./configure及后续编译命令。该变量会告知编译器和链接器使用指定的系统版本标准,绕过错误的版本检测逻辑。

方法2:临时修改版本识别逻辑

打开项目的configure文件,搜索处理macOS版本的代码段,将版本号格式从13.00.00替换为13.0.0,让gfortran能够正确识别版本号。

方法3:升级gfortran到兼容Ventura的版本

若使用Homebrew安装的gfortran,执行以下命令升级到最新兼容版本:

brew update && brew upgrade gcc

新版本的gcc/gfortran已修复对macOS Ventura版本号的识别问题。


内容的提问来源于stack exchange,提问作者João Viana

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 09:05:27