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

fails to build with gcc 9.4.0

syedalihasany opened this issue · comments

  • version 4.5.4 and version 4.5.3 fails to build
  • OS Ubuntu 20.04
  • fails to build with the following errors shown on terminal:
IR/netcdf --disable-dap --disable-netcdf-4 --disable-shared
configure: WARNING: unrecognized options: --disable-dap, --disable-netcdf-4
configure: netCDF-Fortran 4.5.4
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
configure: checking user options
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/bohan/Build_WRF/LIBRARIES/netcdf-fortran-4.5.4':
configure: error: C compiler cannot create executables
See `config.log' for more details

config.log files says the following at lines 124 to 152:

configure:4450: checking whether the C compiler works
configure:4472: gcc  -I/home/bohan/Build_WRF/LIBRARIES/grib2/include -L/home/bohan/Build_WRF/LIBRARIES/grib2/lib conftest.c -lnetcdf -lz >&5
/usr/bin/ld: cannot find -lnetcdf
collect2: error: ld returned 1 exit status
configure:4476: $? = 1
configure:4516: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "netCDF-Fortran"
| #define PACKAGE_TARNAME "netcdf-fortran"
| #define PACKAGE_VERSION "4.5.4"
| #define PACKAGE_STRING "netCDF-Fortran 4.5.4"
| #define PACKAGE_BUGREPORT "support-netcdf@unidata.ucar.edu"
| #define PACKAGE_URL ""
| #define PACKAGE "netcdf-fortran"
| #define VERSION "4.5.4"
| /* end confdefs.h.  */
| 
| int
| main (void)
| {
| 
|   ;
|   return 0;
| }
configure:4521: error: in `/home/bohan/Build_WRF/LIBRARIES/netcdf-fortran-4.5.4':
configure:4523: error: C compiler cannot create executables
See `config.log' for more details

If you have a general question about the software, please view our Suggested Support Process.

/usr/bin/ld: cannot find -lnetcdf

You're missing a path to the NetCDF library. The build process for NetCDF-Fortran is a bit arcane, but is described here.