Re: [netcdfgroup] Problem compiling netcdf4

Carlos Moffat <raghos@xxxxxxxxx> writes:

> 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?

Howdy Carlos!

As Rob pointed out, your first problem was because you were not use
mpif90 as your fortran compiler. 

Also, you don't need to set LIBS, the netCDF makefiles will do this for
you.

Did you set -DpgiFortran somewhere? I don't see it in your evironment
vars, but it is in your output. How did it get there?

Due to some peculiarities in the way fortran is handled, it's safest to
do a make distclean and then rerun configure. Can you try that?

Thanks,

Ed

-- 
Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx



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