Unidata / netcdf-cxx4

Official GitHub repository for netCDF-C++ libraries and utilities.
Other
124 stars 49 forks source link

compile failure ncVar.cpp:630:11 error: 'nc_def_var_filter' was not declared in this scope (on static build) #115

Closed goldenautumnday closed 2 years ago

goldenautumnday commented 2 years ago

I am building a fully static netCDF4 stack and get a compilation error on netcdf-cxx4 stage:

mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /home/goldenautumnday/git/aps8/opt/bin/g++ -DHAVE_CONFIG_H -I. -I.. -I/home/goldenautumnday/static/include -g -O2 -MT ncVar.lo -MD -MP -MF .deps/ncVar.Tpo -c ncVar.cpp -o ncVar.o
ncVar.cpp: In member function 'void netCDF::NcVar::setFilter(unsigned int, size_t, const unsigned int*) const':
ncVar.cpp:630:11: error: 'nc_def_var_filter' was not declared in this scope
   ncCheck(nc_def_var_filter(groupId,myId,id,nparams,parms),__FILE__,__LINE__);
           ^~~~~~~~~~~~~~~~~
ncVar.cpp:630:11: note: suggested alternative: 'nc_def_var_fill'
   ncCheck(nc_def_var_filter(groupId,myId,id,nparams,parms),__FILE__,__LINE__);
           ^~~~~~~~~~~~~~~~~
           nc_def_var_fill
ncVar.cpp: In member function 'void netCDF::NcVar::getFilter(unsigned int*, size_t*, unsigned int*) const':
ncVar.cpp:636:11: error: 'nc_inq_var_filter' was not declared in this scope
   ncCheck(nc_inq_var_filter(groupId, myId, idp, nparamsp, params),__FILE__,__LINE__);
           ^~~~~~~~~~~~~~~~~
ncVar.cpp:636:11: note: suggested alternative: 'nc_inq_var_fill'
   ncCheck(nc_inq_var_filter(groupId, myId, idp, nparamsp, params),__FILE__,__LINE__);
           ^~~~~~~~~~~~~~~~~
           nc_inq_var_fill
make[2]: *** [ncVar.lo] Error 1

I used the following sources:

And the below script. This was done with the standard GCC compiler and a newer self-compiled GCC compiler.


which gcc
gcc --version
uname -a
more /etc/redhat-release

git init

# zlib

tar xf src/zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --static --prefix=$HOME/static
make install
cd ..
git add lib include share
git commit -m 'zlib static'

# jpeg

tar xf src/jpegsrc.v9d.tar.gz
cd jpeg-9d
./configure --prefix=$HOME/static --disable-shared --enable-static
make install
cd ..
git add bin lib include share
git commit -m 'jpeg static'

#  hdf4

tar xf src/hdf-4.2.15.tar.gz
cd hdf-4.2.15
./configure --prefix=$HOME/static --disable-shared --enable-static --enable-hdf4-xdr --disable-fortran --disable-netcdf --enable-static-exec
make && make install
cd ..
git add bin lib include share
git commit -m 'hdf4 static'

#  hdf5

tar xf src/hdf5-1.12.0.tar.gz
cd hdf5-1.12.0
./configure --prefix=$HOME/static --disable-shared --enable-static --enable-static-exec --enable-fortran
make && make install
cd ..
git add bin lib include share
git commit -m 'hdf5 static'

#  netcdf-c

tar xf src/netcdf-c-4.7.3.tar.gz
cd netcdf-c-4.7.3
CPPFLAGS=-I$HOME/static/include LDFLAGS=-L$HOME/static/lib ./configure --prefix=$HOME/static --disable-shared --enable-static --enable-static-exec --disable-dap --enable-netcdf-4 --enable-hdf4
make && make install
cd ..
git add bin lib include share
git commit -m 'netcdf-c static'

#  netcdf-c++

tar xf src/netcdf-cxx4-4.3.1.tar.gz
cd netcdf-cxx4-4.3.1
CPPFLAGS=-I$HOME/static/include LDFLAGS=-L$HOME/static/lib ./configure --prefix=$HOME/static --disable-shared --enable-static
make && make install
cd ..
git add bin lib include share
git commit -m 'netcdf-cxx static'
goldenautumnday commented 2 years ago

Looks like I forgot to add CPPFLAGS/LDFLAG to hdf4/hdf5 which failed to compile causing netcdf-c to fail. Apologies.