&quot'c.lang(LLVM选项解析):未知命令行参数&quot"在Mac上运行GFORTRAN时

发布于 2025-02-02 17:01:21 字数 597 浏览 3 评论 0原文

我正在尝试编译一个“ Hello World”文本文件,但是在我的Mac终端中继续收到错误:

    (base) name@Names-MacBook-Pro-3 File % gfortran -o test.exe try.f90
    c.lang (LLVM option parsing): Unknown command line argument '-x86-pad-for- 
    align=false'.  Try: 'clang (LLVM option parsing) --help'.

我的Fortran版本:

   GNU Fortran (Homebrew GCC 11.3.0_1) 11.3.0

文本文件(try.f90),我在VS中写了:

    program try

     print*,'hello world!'

    end program try 

我尝试了一个空间,没有空间打印。我使用的代码是来自使用Atom Text Editor的YouTuber,该视频是从2020年开始的

。我被卡住了。请帮忙。

I am trying to compile a "hello world" text file, but keep receiving an error in my mac terminal:

    (base) name@Names-MacBook-Pro-3 File % gfortran -o test.exe try.f90
    c.lang (LLVM option parsing): Unknown command line argument '-x86-pad-for- 
    align=false'.  Try: 'clang (LLVM option parsing) --help'.

My fortran version:

   GNU Fortran (Homebrew GCC 11.3.0_1) 11.3.0

text file (try.f90) that I wrote in VS:

    program try

     print*,'hello world!'

    end program try 

I tried with a space and without a space before print. The code I am using is from a youtuber who uses Atom text editor and the video is from 2020.

I am stuck. Please help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

肥爪爪 2025-02-09 17:01:21

我遇到了同样的问题,似乎根本原因是xcode vs 命令行工具。可能有些不一致(例如,我可能已经升级了CLI,但没有升级GUI)。

无论如何,在

$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer/

我用

$ sudo xcode-select -switch /Library/Developer/CommandLineTools

Homebrewgcc-12 按预期工作之前。

FWIW

$ clang --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ gcc-12 --version
gcc-12 (Homebrew GCC 12.2.0) 12.2.0
Copyright (C) 2022 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.

I faced the same issue and it seems the root cause was Xcode vs Command Line Tools were used. Probably some inconsistency (e.g. I might have upgraded the cli but not the gui).

Anyway, before

$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer/

I fixed this with

$ sudo xcode-select -switch /Library/Developer/CommandLineTools

and then gcc-12 or gfortran from homebrew worked as expected.

FWIW

$ clang --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ gcc-12 --version
gcc-12 (Homebrew GCC 12.2.0) 12.2.0
Copyright (C) 2022 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.
枯寂 2025-02-09 17:01:21

我通过更新Xcode解决了问题。 Gfortran和Clang之间存在不相容性。要查看可用的更新:

softwareupdate --list see the list of outdated software.
softwareupdate --install <name>

I resolved my issue by updating Xcode. There was an incompatibility between gfortran and clang. To see available updates:

softwareupdate --list see the list of outdated software.
softwareupdate --install <name>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文