Skip to content

Installing netcdf fortran in docker container #471

@niravshah241

Description

@niravshah241

Hello,

I am trying to install netcdf-fortran 4.6.2 in a Docker image. I am using ubuntu:latest as base image. I installed netcdf-c 4.9.3 using

CC=$(which mpicc) CPPFLAGS="-I${H5DIR}/include -I${PNDIR}/include -I${ZLDIR}/include" \
LDFLAGS="-L${H5DIR}/lib -L${PNDIR}/lib -L${ZLDIR}/lib" \
LIBS="-L${H5DIR}/lib -lhdf5_hl -lhdf5 -L${PNDIR}/lib -lpnetcdf -L${ZLDIR}/lib -lz -lm" \
./configure --enable-pnetcdf --enable-parallel-tests --disable-libxml2 --disable-shared \
--enable-static --prefix=${NCDIR} && \
make && \
make install

The H5DIR is HDF5 installation directory and similarly PNDIR, ZLDIR are PnetCDF and Zlib installation directories. The netcdf-c installation location is NCDIR .

CC=$(which mpicc) FC=$(which mpif90) F77=$(which mpif77) \
CPPFLAGS="-I${NCDIR}/include -I${H5DIR}/include -I${PNDIR}/include -I${ZLDIR}/include" \
LDFLAGS=$(nc-config --libs) \
./configure --disable-shared --enable-parallel-tests --prefix=${NFDIR} && \
make && \
make install

However, it gives me error

 Could not link to netcdf C library. Please set LDFLAGS; for static builds set LIBS to the results of nc-config --libs.

I tried removing LDFLAGS and setting LIBS=$(nc-config --libs). I got the same error again. Can some one help?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions