OS X 优胜美地 gcc 无法识别的命令行选项 'mdll' 后brew 安装 gcc

OS X Yosemite gcc unrecognized command line option 'mdll' after brew install gcc

本文关键字:gcc 选项 mdll 安装 brew 命令行 识别 OS      更新时间:2023-10-16

我使用brew安装gcc,因为我需要安装brew的Fortran包。brew install gcc安装的gcc包似乎不支持mdll标志。如何安装正确版本的Fortran和gcc?

$ which gcc
/usr/local/bin/gcc
$ gcc --version
gcc (GCC) 4.9.2 20141029 (prerelease)
Copyright (C) 2014 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.
$ gcc -mdll
gcc: error: unrecognized command line option ‘-mdll’
gcc: fatal error: no input files
compilation terminated.

根据gcc(1)手册:

-mdll
  This option is available for Cygwin and MinGW targets. It
  specifies that a DLL---a dynamic link library---is to be generated,
  enabling the selection of the required runtime startup object and
  entry point.

由于OS X既不是Cygwin也不是MinGW,所以可以放心地假设没有版本的GCC会在OS X上启用它。

如果您试图构建一个动态链接的对象(UNIX术语中的"共享对象"),请查看-dynamic/-dynamiclib标志。它们似乎是OS x上的大致等价物。