【发布时间】:2018-05-03 10:42:42
【问题描述】:
我在安装了 High Sierra 的新 Mac mini 上使用 gfortran 编译时遇到了很多麻烦。
我用自制软件安装了 gcc,没有错误消息。如果我尝试编译一个基本的 hello world 代码或一段已在我的其他计算机上成功编译并使用 gfortran 运行的代码,我每次都会收到此错误(编译 gfortran helloworld.f90 -o hw 的完整错误)。
FATAL:/opt/local/bin/../libexec/as/x86_64/as: I don't understand 'm' flag!
我不明白这个错误,但由于我可以在 Sierra 上编译和运行相同的代码片段,我不得不假设这在 gfortran/gcc 和 High Sierra 之间不起作用。
我真的很想知道是否有其他人有同样的问题,或者认为它是否是由其他原因引起的并且知道如何解决它。
编辑:
编译一个基本的 hello world C 代码可以正常工作。没有错误。
对于gcc -v:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin17.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
对于gfortran -v:
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/7.2.0/libexec/gcc/x86_64-apple-darwin17.0.0/7.2.0/lto-wrapper
Target: x86_64-apple-darwin17.0.0
Configured with: ../configure --build=x86_64-apple-darwin17.0.0 --prefix=/usr/local/Cellar/gcc/7.2.0 --libdir=/usr/local/Cellar/gcc/7.2.0/lib/gcc/7 --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-7 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --enable-checking=release --with-pkgversion='Homebrew GCC 7.2.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-nls
Thread model: posix
gcc version 7.2.0 (Homebrew GCC 7.2.0)
对于as -v:
Apple Inc version cctools-895, GNU assembler version 1.38
但这会被挂断,必须用 ctrl+c 取消。
我正在运行 OS X 10.13.1 并使用自制软件安装了 gcc v7.2(均使用自制软件网页上的标准说明安装)。 Xcode 是 v9.1 并且是最新的。我在 tcsh 窗口中工作,但在 bash 中测试时出现相同的错误。
【问题讨论】:
-
该错误是由
as报告的,它是GNU Binutils gnu.org/software/binutils 的一部分,而不是由gfortran 报告的。请尝试编译一些非常简单的 C 代码,并向我们展示您的确切详细信息。您的编译命令a 和带有错误的complete 输出、as -v、gcc -v和gfortran -v的输出以及您能想到的更多细节。准确告诉我们您从哪里安装了哪个版本的软件。 -
(对不起所有cmets中的编码问题......我是论坛的新手!)
-
啊,谢谢。我会这样做的。
标签: macos gcc gfortran binutils macos-high-sierra