NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: [netcdfgroup] Problem compiling netcdf4

  • To: Carlos Moffat <raghos@xxxxxxxxx>
  • Subject: Re: [netcdfgroup] Problem compiling netcdf4
  • From: Rob Latham <robl@xxxxxxxxxxx>
  • Date: Wed, 2 Sep 2009 15:58:55 -0500
On Wed, Sep 02, 2009 at 04:50:29PM -0400, Carlos Moffat wrote:
> Hello,
>
> I'm trying to compile NetCDF v4.0.1 to run the ROMS model  
> (http://www.myroms.org) in a parallel configuration.
>
> What I've done so far is to install MPICH2 with the configuration
>
> ./configure --enable-f90 --with-mpe --with-romio --prefix=/usr/local

looks good

> and HDF5 (v1.8.3) with the options:
>
> CC=mpicc LIBS="-lm -lz" CPPFLAGS="-DpgiFortran" ./configure  
> --enable-parallel --enable-fortran  --prefix=/usr/local
>
> (I believe the "LIBS" options are not necessary here but they don't  
> hurt). A 'make check' works nicely here.

yup, this looks good too.

> I have the intel fortran compiler installed (v11.0). When I compile  
> netcdf v4.0.1 with:
>
> CC=mpicc CPPFLAGS="-DpgiFortran" LIBS="-lm -lz -lhdf5" ./configure  
> --enable-netcdf-4 --prefix=/usr/local
>
> using 'make check', the the build fails with the output I've pasted  
> below. It looks like the HDF5 libraries were compiled without the  
> necessary MPI support, but my understanding is that the  
> '--enable-parallel' flag should do this. Am I missing something?

Actually the errors you get *confirm* that HDF5 was compiled with MPI
support: it's the HDF5 library that is requesting MPI symbols, but
there is no mpi library in your link command.

> libtool: link: ifort -I../fortran -I../libsrc4 -I../f90 -g -o nf_test  
> test_get.o test_put.o nf_error.o nf_test.o test_read.o test_write.o  
> util.o fortlib.o  ../libsrc4/.libs/libnetcdf.a -lhdf5_hl -lm -lz -lhdf5
> ../libsrc4/.libs/libnetcdf.a(nc4file.o): In function `nc_check_for_hdf5':
> /home/cmoffat/Sandbox/netcdf-4.0.1/libsrc4/nc4file.c:141: undefined  
> reference to `MPI_File_open'

I don't know why libtool wants to link with ifort here.  I think instead you
need to link with mpif90.  If you would prefer to link "by hand", then
you will have to add the '-L/path/to/mpi -lmpich2' commands to your
link step.

you could also compile/link with the 'h5pcc' script, but that's
essentially the mpi wrapper scripts with one or two more HDF5
libraries in there.  You've accomplished the same thing with your
'LIBS=' line when compiling netcdf4.

Maybe if you try setting the fortran compiler to mpif90 when you configure
netcdf 4 that will make things work better?  

==rob

-- 
Rob Latham
Mathematics and Computer Science Division
Argonne National Lab, IL USA



  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: