问题描述
我有以下简单的代码运行与 brew 链接到 gcc 和 openmpi:
mpif90 test.f90 ./test
返回以下错误:
/opt/local/bin/gfortran: invalid option -- I
Usage: gcov [OPTION]... SOURCE|OBJ...
Print code coverage information.
-h,--help Print this help,then exit
-a,--all-blocks Show information for every basic block
-b,--branch-probabilities Include branch probabilities in output
-c,--branch-counts Output counts of branches taken
rather than percentages
-d,--display-progress display progress information
-f,--function-summaries Output summaries for each function
-i,--intermediate-format Output .gcov file in intermediate text format
-l,--long-file-names Use long output file names for included
source files
-m,--demangled-names Output demangled function names
-n,--no-output Do not create an output file
-o,--object-directory DIR|FILE Search for object files in DIR or called FILE
-p,--preserve-paths Preserve all pathname components
-r,--relative-only Only show data for relative sources
-s,--source-prefix DIR Source prefix to elide
-u,--unconditional-branches Show unconditional branch counts too
-v,--version Print version number,then exit
For bug reporting instructions,please see:
<https://trac.macports.org/newticket>.
我不确定是什么问题。有什么想法吗?谢谢。
解决方法
问题在于其他 /bin/
目录具有较旧版本的 gcc 和 openmpi。更新时,需要将 /lib/
目录中的新文件传输到 /Cellar/
目录。当第一次卸载所有旧的 macports 和编译器时,该问题已解决,文件和/或路径不正确,如 sudo port -fp uninstall installed
、brew uninstall openmpi
和 brew uninstall gcc
。然后重新安装新的自制编译器 brew install gcc
、brew install openmpi
。这会在提交 make 文件时提供配置文件的正确路径。