Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Installing netcdf-fortran

ManishM
Novice
3,861 Views

I wanted to install netcdf-fortran on my Mac Big Sur and was wondering is there's any documentation which we need to follow for oneapi? I don't know in what path we need to install the library. Any help is appreciated. 

I was following this https://simplex.giss.nasa.gov/gcm/doc/UserGuide/Installing_NetCDF_library.html

 

When I compile it was giving me this error.

configure: error: HDF5 was not built with API compatibility version v18. Please recompile your libhdf5 install using '--with-default-api-version=v18'.

0 Kudos
5 Replies
mecej4
Honored Contributor III
3,829 Views

That "Installing NetCDF library in your computer" page pertains to an old version of NetCDF, i.e., 3.6.3. Contrary to what it says in its first paragraph, I think that you would be better off if you were able to find an Ifort-compatible prebuilt NetCDF (and dependencies such as HDF, SZIP) for your Mac and OS.

You did not state which version of NetCDF you attempted to build from sources. The error message is actually from the preliminary "configure" phase, and not from the compilation phase.

OneAPI was released less than a year ago; unless someone built NetCDF from source using a Mac and OneAPI already, you are probably at the "bleeding edge" of progress. 

0 Kudos
ManishM
Novice
3,811 Views

I tried other ways. Here's what I'm currently following. https://www.unidata.ucar.edu/software/netcdf/docs/building_netcdf_fortran.html

I configured and it was installed successfully but then I realized that it was installed for gfortran since I already had gfortran. When I uninstalled gfortran it throws an error that it can't find fortran compiler even though I specified the location of oneapi as FC=/opt/intel/oneapi

 

configure: error: in `/Users/manish/Downloads/netcdf-fortran-4.5.3':

configure: error: Can't find F90 compiler.

0 Kudos
mecej4
Honored Contributor III
3,799 Views

You did not have to uninstall Gfortran. The variable FC should evaluate to the name of the Fortran compiler driver, not the path. See https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html for details. For Intel Fortran, FC should be set to ifort.

0 Kudos
ManishM
Novice
3,778 Views

For some reason it's only compiling with gfortran even though I have specified the FC=ifort

# Compiling Options

-----------------

Fortran Compiler:               /usr/local/bin/gfortran

FFLAGS:                         -g -O2

LDFLAGS:        

AM_LDFLAGS:                     

Shared Library:         yes

Static Library:         yes

Extra libraries:         -lnetcdf -lm 

 

These are the outputs I'm getting for the compiler. When I uninstall and install netcdf-fortran, it throws an error saying there is no fortran compiler

0 Kudos
StephanRohr
Employee
2,888 Views

Try to pass FC, F77 and CC directly to the configure script via:

CPPFLAGS=-I${NCDIR}/include LDFLAGS=-L${NCDIR}/lib FC=ifx F77=ifx CC=icx ./configure --prefix=${NFDIR} --disable-fortran-type-check

 

This should fix your issues.

0 Kudos
Reply