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:32:10 -0400
Rob Latham wrote:
On Wed, Sep 02, 2009 at 05:11:10PM -0400, Carlos Moffat wrote:
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_'

all of your undefined references are fortran symbols with a trailing
underscore.  this is a common yet irritating problem with fortran
compilers.  Unfortunately the easiest way to fix this is to ensure
that you build netcdf4, mpich2, and HDF5 with the same fortran
compiler.
If you do an 'mpif90 -show', do you see 'gfortran' or 'ifort' as the
compiler being used?

mpif90 -show
ifort -I/usr/local/include -I/usr/local/include -L/usr/local/lib -L/usr/local/lib -lmpichf90 -lmpichf90 -lmpich -lopa -lpthread -lrt

and I've definitely compiled everything with the same compiler, as I've made sure it's the only one I have compiled. Although I guess I didn't try the "-DpgiFortran" option when compiling mpich2.


The -DpgiFortran looks odd to me but since I rarely build the netcdf4
fortran interfaces, maybe that's just the way to do it.

To be honest, I'm just following the advice of the ROMS guys, but the make fails without it (although this is probably due to me compiling HDF5 with that option too).


Any more ideas are welcome.

Carlos



==rob




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