Re: [netcdfgroup] Problem compiling netcdf4

  • To: Rob Latham <robl@xxxxxxxxxxx>
  • Subject: Re: [netcdfgroup] Problem compiling netcdf4
  • From: Carlos Moffat <raghos@xxxxxxxxx>
  • Date: Wed, 02 Sep 2009 17:11:10 -0400
Hi Rob,

Rob Latham wrote:
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?

Ok, I tried this:

FC=mpif90 CC=mpicc CPPFLAGS="-DpgiFortran" LIBS="-lm -lz -lhdf5" ./configure --enable-netcdf-4 --prefix=/usr/local


and now fails with (so it goes a bit farther):

mpif90 -DHAVE_CONFIG_H -I. -I.. -I../fortran -DpgiFortran -I../fortran -I../libsrc4 -I../f90 -g -c -o ftst_vars.o ftst_vars.F mpif90 -I../fortran -I../libsrc4 -I../f90 -g -c -o handle_err.o handle_err.f /bin/bash ../libtool --tag=F77 --mode=link mpif90 -I../fortran -I../libsrc4 -I../f90 -g -o ftst_vars ftst_vars.o fortlib.o handle_err.o ../libsrc4/libnetcdf.la -lhdf5_hl -lhdf5 -lm -lz -lhdf5 -L/usr/local/bin/mpif90 libtool: link: mpif90 -I../fortran -I../libsrc4 -I../f90 -g -o ftst_vars ftst_vars.o fortlib.o handle_err.o ../libsrc4/.libs/libnetcdf.a -L/usr/local/bin/mpif90 -lhdf5_hl -lm -lz -lhdf5
ftst_vars.o: In function `ftst_vars':
/home/cmoffat/Sandbox/netcdf-4.0.1/nf_test/ftst_vars.F:57: undefined reference to `nf_set_chunk_cache_' /home/cmoffat/Sandbox/netcdf-4.0.1/nf_test/ftst_vars.F:62: undefined reference to `nf_get_chunk_cache_' /home/cmoffat/Sandbox/netcdf-4.0.1/nf_test/ftst_vars.F:89: undefined reference to `nf_def_var_chunking_' /home/cmoffat/Sandbox/netcdf-4.0.1/nf_test/ftst_vars.F:94: undefined reference to `nf_def_var_endian_' /home/cmoffat/Sandbox/netcdf-4.0.1/nf_test/ftst_vars.F:98: undefined reference to `nf_def_var_deflate_' /home/cmoffat/Sandbox/netcdf-4.0.1/nf_test/ftst_vars.F:100: undefined reference to `nf_def_var_fletcher32_' /home/cmoffat/Sandbox/netcdf-4.0.1/nf_test/ftst_vars.F:104: undefined reference to `nf_inq_var_deflate_' /home/cmoffat/Sandbox/netcdf-4.0.1/nf_test/ftst_vars.F:109: undefined reference to `nf_inq_var_fletcher32_' /home/cmoffat/Sandbox/netcdf-4.0.1/nf_test/ftst_vars.F:112: undefined reference to `nf_inq_var_chunking_' /home/cmoffat/Sandbox/netcdf-4.0.1/nf_test/ftst_vars.F:117: undefined reference to `nf_inq_var_endian_' /home/cmoffat/Sandbox/netcdf-4.0.1/nf_test/ftst_vars.F:143: undefined reference to `nf_inq_var_deflate_' /home/cmoffat/Sandbox/netcdf-4.0.1/nf_test/ftst_vars.F:148: undefined reference to `nf_inq_var_fletcher32_' /home/cmoffat/Sandbox/netcdf-4.0.1/nf_test/ftst_vars.F:151: undefined reference to `nf_inq_var_chunking_' /home/cmoffat/Sandbox/netcdf-4.0.1/nf_test/ftst_vars.F:156: undefined reference to `nf_inq_var_endian_'
make[2]: *** [ftst_vars] Error 1
make[2]: Leaving directory `/home/cmoffat/Sandbox/netcdf-4.0.1/nf_test'
make[1]: *** [check-am] Error 2
make[1]: Leaving directory `/home/cmoffat/Sandbox/netcdf-4.0.1/nf_test'
make: *** [check-recursive] Error 1


Any ideas?

Thanks!
Carlos


==rob




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