[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #AZL-185988]: Error when building/configure NetCDF-FORTRAN Interface



Hi,

> I've successfully built the NetCDF-C libraries and executables as
> summarized here:
> bash-3.2$ nc-config --all
> 
> This netCDF 4.3.3.1 has been built with the following features:
> 
> --cc        -> gcc
> --cflags    ->  -I/usr/local/include
> --libs      -> -L/usr/local/lib -lnetcdf
> 
> --has-c++   -> no
> --cxx       ->
> --has-c++4  -> no
> --cxx4      ->
> 
> --fc        ->
> --fflags    ->
> --flibs     ->
> --has-f90   -> no
> 
> --has-dap   -> yes
> --has-nc2   -> yes
> --has-nc4   -> yes
> --has-hdf5  -> yes
> --has-hdf4  -> no
> --has-pnetcdf-> no
> 
> --prefix    -> /usr/local
> --includedir-> /usr/local/include
> --version   -> netCDF 4.3.3.1
> 
> I tested the executables and all were working fine (e.g. ncdump).
> However, when I built the Fortran interface, it says that my gfortran has
> different version than the one being built.

I suspect you are just referring to the error messages in config.log generated
when the configure script tries different ways to determine the version of the
Fortran compiler, such as

    configure:4967: gfortran -qversion >&5
    gfortran: error: unrecognized command line option '-qversion'
      ...
    configure:4967: gfortran -V >&5
    gfortran: error: unrecognized command line option '-V'

which occur after configure has already found the version:

    configure:4967: gfortran --version >&5
    GNU Fortran (GCC) 4.9.2 20141029 (prerelease)
    Copyright (C) 2014 Free Software Foundation, Inc.

You can ignore all such errors in config.log and other errors
if it completes successfully, with last line

    configure: exit 0

Your configure completed successfully, so you should only have
to run "make check" and "make install" (or "sudo make install").

However, I suspect if you do that, you will get other errors,
indicating the netCDF-C library couldn't be found, because it
appears that the CPPFLAGS and LDFLAGS environment variables
weren't passed correctly to your configure script.  The config.log 
file has

    CPPFLAGS=''
    LDFLAGS=''

where I would expect it should have

    CPPFLAGS='-I/usr/local/include'
    LDFLAGS='-L/usr/local/lib'

It looks like you are using bash, so the following should have
worked

    $ NCDIR=/usr/local
    $ CPPFLAGS=-I${NCDIR}/include LDFLAGS=-L${NCDIR}/lib \
      ./configure --prefix=${NCDIR} --disable-fortran-type-check

but it didn't, according to the config.log you sent. Until you
can get that working to show the right values for CPPFLAGS and
LDFLAGS in config.log, make won't work right.

Make sure you aren't trying to run the configure command as root
or with sudo, as that prevents environment variables from being
inherited by shell scripts.

I hope this helps you find the problem, If not, you might try the cmake
build, which uses a different method than configure, or try downloading
prebuilt libraries with homebrew, which only requires running

  $ brew install netcdf --with-fortran

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: AZL-185988
Department: Support netCDF
Priority: Critical
Status: Closed