Search code examples
gccgfortranopenmpi

Error in gfortran make function: invalid option -- I


I have the following simple code running with brew linked to gcc and openmpi:

 mpif90 test.f90 ./test 

The following error is returned:

 /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>.

I am not sure what the problem is. Any thoughts? Thank you.


Solution

  • The problem was there were other /bin/ directories that had older versions of gcc and openmpi. When updating, the new files from /lib/ directories needed to be trasnfered to the /Cellar/ directories. The problem is fixed when first uninstalling all old macports and compilers with incorrect files and/or paths as sudo port -fp uninstall installed, and brew uninstall openmpi, and brew uninstall gcc. Then reinstall new homebrew compilers brew install gcc, brew install openmpi. This gives the correct paths with configured files when submitting a make file.