Unidata / netcdf-fortran

Official GitHub repository for netCDF-Fortran libraries, which depend on the netCDF C library. Install the netCDF C library first.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MacOS doesn't recognize single dash for version information

HathewayWill opened this issue · comments

Trying to install Netcdf-Fortran on MacOS 13

gcc (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 have attached the compile log for netcdf-C (which installs) & netcdf-fortran (which doesn't)

The issue seems to be that netcdf-fortran calls the version info for MacOS using the single dash (-) whereas netcdf-c calls the version info for MacOS using the double dash (--)

Since single dash is not accepted in MacOS this causes netcdf-fortran to fail always.

An example of the output from GCC in MacOS 13:

gcc: error: unrecognized command-line option '-V'
gcc: fatal error: no input files
compilation terminated.

will@wills-MacBook-Pro ~ % gcc -version
gcc: error: unrecognized command-line option '-version'
gcc: fatal error: no input files
compilation terminated.

will@wills-MacBook-Pro ~ % gcc -qversion
gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.

will@wills-MacBook-Pro ~ % gcc --V
gcc: error: unrecognized command-line option '--V'
gcc: fatal error: no input files
compilation terminated.

will@wills-MacBook-Pro ~ % gcc --version
gcc (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.

will@wills-MacBook-Pro ~ % gcc --qversion
gcc: error: unrecognized command-line option '--qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.


netcdf-c-config.log
netcdf-fortran-config.log

Thanks for providing the config files; the issue with netcdf-fortran appears to be related to the failure to link against the libraries specified by the LIBS env value. Looking at the following in netcdf-fortran-config.log:

180: ac_cv_env_LIBS_value='-lnetcdf -lm -lcurl libcurl4-openssl-dev -lhdf5_hl -lhdf5 -lz -ldl'

It looks like a stray libcurl4-openssl-dev has found its way into the LIBS environmental variable. What happens if you remove that from LIBS and re-run ./configure for netcdf-fortran?

Thanks for providing the config files; the issue with netcdf-fortran appears to be related to the failure to link against the libraries specified by the LIBS env value. Looking at the following in netcdf-fortran-config.log:

180: ac_cv_env_LIBS_value='-lnetcdf -lm -lcurl libcurl4-openssl-dev -lhdf5_hl -lhdf5 -lz -ldl'

It looks like a stray libcurl4-openssl-dev has found its way into the LIBS environmental variable. What happens if you remove that from LIBS and re-run ./configure for netcdf-fortran?

That was the problem, seems there was a sneaky libcurl that did find it's way into the code.

Great! Glad that took care of this issue :)