[MITgcm-devel] Re: Netcdf, ifc and g77

Ed Hill ed at eh3.com
Fri Jul 9 14:29:06 EDT 2004


Hi Alistair,

I'm forwarding this to the devel list since I'm hoping that other people
will start using NetCDF more and they're likely to encounter the same
issues.


On Fri, 2004-07-09 at 13:20, Alistair Adcroft wrote:
> Did you try compiling netcdf libraries with ifc? I don't think the RPM you
> built works with F90 code compiled with ifc (obviously can't use g77 since
> it's fortran 90); I've been trying to link a call to nf_inq_libvers() from a
> hello_netcdf.F90 program and it barfs.

I have compiled the NetCDF library with a few compilers and the
resulting libraries are installed (on the "authors" machines) at:

  /usr/local/pkg/netcdf/netcdf-3.5.1/lib/${COMPILER_NAME}

and I'll be happy to do the builds for more compilers than the ones
currently listed.  You're probably going to need the the following
options:

  ${COMPILER_NAME} -I/usr/local/pkg/netcdf/netcdf-3.5.1/include  \
     -L/usr/local/pkg/netcdf/netcdf-3.5.1/${COMPILER_NAME}  \
     ...your_code...  -lnetcdf

in the order that I show above.  Note that the ORDER can be significant
since that is how many compilers do symbol resolution.


> I've back-tracked to using g77 on a hello_netcdf.F program and even that's
> failing! I'm getting to old for this ...
> 
> % cat hello_netcdf.F
>       program hello_netcdf
> #include "netcdf.inc"
>       print *,nf_inq_libvers()
>       end
> % g77 -lnetcdf hello_netcdf.F
> /tmp/ccAW2U9w.o: In function `MAIN__':
> /tmp/ccAW2U9w.o(.text+0x22): undefined reference to `nf_inq_libvers__'
> collect2: ld returned 1 exit status
> 
> Any ideas?

Please try it with:

  g77 -lnetcdf hello_netcdf.F -lnetcdf

and/or with

  g77 -L/yourpath/to/thenetcdf/lib  hello_netcdf.F -lnetcdf 

and I bet that will fix it.
 

> Do we know whether the new mnc dependence on netcdf will still work with all
> compilers on our own system?

It should work with basically every compiler out there.  Its been tested
on most of the ones we have (except the very latest ifort Intel v8). 
I'll do the builds for all the rest of the ifc/ifort versions (6, 7, &
8) ASAP.

Also, at least two commercial compilers are loudly proclaiming "binary
compatibility" with GCC 3.x.y:

  http://www.pathscale.com/products1.html
  http://www.intel.com/software/products/compilers/clin/clinux.htm

which is going to make builds a good bit easier on ia32 machines.

Ed

-- 
Edward H. Hill III, PhD
office:  MIT Dept. of EAPS;  Rm 54-1424;  77 Massachusetts Ave.
             Cambridge, MA 02139-4307
emails:  eh3 at mit.edu                ed at eh3.com
URLs:    http://web.mit.edu/eh3/    http://eh3.com/
phone:   617-253-0098
fax:     617-253-4464




More information about the MITgcm-devel mailing list