Re: [netcdfgroup] issue compiling netcdf4 with mpi

Joe Buck <jbbuck@xxxxxxxxx> writes:

> I've built mpi2 v 1.2.1 with these flags:
> CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
> -fPIC" ./configure --enable-f90 --enable-f77 --with-mpe --with-romio
> --prefix=/install/mpich2-121
>
> I then build hdf5 v1.8 with these flags:
> FC=mpif90 F77=mpif77 F90=mpif90 CC=mpicc CFLAGS="-D_LARGEFILE_SOURCE
> -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" LIBS="-lz -lm"
> ./configure --enable-parallel --enable-fortran --prefix=/install/hdf5-1.8
> --disable-shared
>
> and everything with hdf5 checked out with "make check"
>
> Finally I configured netcdf v4.0.1 like so:
> buck@bender:/tmp/netcdf-4.0.1$ CPPFLAGS="-I/install/mpich2-121/include
> -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC"
> CFLAGS="-I/install/mpich2-121/include -D_LARGEFILE_SOURCE
> -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" F77=mpif77 F90=mpif90
> FC=mpif90 CC=mpicc CXX=mpicxx LIBS="-lz -lm" ./configure --enable-netcdf-4
> --prefix=/install/netcdf-4.0.1 --enable-large-file-tests
> --with-hdf5=/install/hdf5-1.8 --with-zlib=/usr
> --enable-separate-fortran

Firstly you don't want to use the -fPIC option. If you want shared HDF5
you must use -fPIC with zlib, then --enable-shared with HDF5. For netCDF
use --enable-shared, not -fPIC.

>
> make works just fine but when I run "make check" I get errors when it
> tries to build fortran files that start like this:
> /bin/sh ../libtool --tag=F77�� --mode=link mpif77 -I../fortran
> -I/install/hdf5-1.8/include -I/usr/include� -I../libsrc4��� -I../f90 
> -g
> -L/lib -L/install/hdf5-1.8/lib -L/usr/lib���� -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
> ../fortran/[1]libnetcdff.la -lm ../libsrc4/[2]libnetcdf.la�� -lhdf5_hl
> -lhdf5��� -lz -lm
> libtool: link: mpif77 -I../fortran -I/install/hdf5-1.8/include
> -I/usr/include -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� -L/lib
> -L/install/hdf5-1.8/lib -L/usr/lib ../fortran/.libs/libnetcdff.a
> /tmp/netcdf-4.0.1/libsrc4/.libs/libnetcdf.a ../libsrc4/.libs/libnetcdf.a
> /install/hdf5-1.8/lib/libhdf5_hl.a /install/hdf5-1.8/lib/libhdf5.a -lz -lm
> test_get.o: In function `test_nf_get_var1_text':
> /tmp/netcdf-4.0.1/nf_test/test_get.F:25: undefined reference to `nf_open_'
> /tmp/netcdf-4.0.1/nf_test/test_get.F:34: undefined reference to
> `nf_get_var1_text_'
> /tmp/netcdf-4.0.1/nf_test/test_get.F:38: undefined reference to
> `nf_get_var1_text_'
> ....
>

You need to specify the fortran compiler you are using by setting
CPPFLAGS and rerunning netCDF configure. Set -DgFortran if you are using
gfortran, -DpgiFortran for PGI or Intel fortran, and -Df2cFortran for
everything else.

Also support questions are best sent to support-netcdf@xxxxxxxxxxxxxxxx,
where they will be entered in our support database.

Thanks, and good luck,

Ed

-- 
Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx



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