Closed khou2020 closed 5 years ago
This has been fixed in 6f2c74a6f2ec0f56aee457ee9723b5870a0baf8e please check and close this PR
6f2c74a only returns error from NetCDF. I added a debug trance so we can know where is the error first known in pnetcdf.
This pr also allow linking against netcdf with pnetcdf support where it is blocked in the master branch.
What is the configure command used to allow to build PnetCDF with NetCDF4 that is built with --enable-pnetcdf? Did you tried both static and shared?
I removed the section that detects pnetcdf support and allow configure to continue. The error is now a warning. It is tested in static link but not shared.
This issue has been reported #33. Run "make check" and see. The other way around, i.e. building NetCDF4 with PnetCDF built with --enable-netcdf4, also failed.
I didn't encounter this error while I run make check. fortran test also passed. It may only apply to shared link or it's a special case in their system.
Try the followings. (all static builds)
I already tried it on my desktop (ubuntu) before made the change. I built the master branch of pnetcdf without nc4. Then, I build netcdf using the pnetcdf i built. Later I build pnetcdf with nc4 using that netcdf. I am using netcdf 4.6.3.
If that passed in your case, you must be using the same folder for all installations.
They are in different folders. Only hdf5 and original pnetcdf (for netcdf) are in the same folder (/home/khl7265/.local).
netcdf: ./configure --disable-shared --enable-parallel-tests --prefix=/home/khl7265/.local/netcdf --enable-pnetcdf --with-pnetcdf=/home/khl7265/.local/ncmpi_nc4 --disable-dap --with-pnetcdf is not used by netcdf config.
~/.local/netcdf/bin/nc-config --libs -L/home/khl7265/.local/netcdf/lib -L/home/khl7265/.local/lib -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -lm -ldl -lz
pnetcdf_nc4: ./configure --enable-debug --disable-shared --enable-netcdf4 --with-netcdf4=/home/khl7265/.local/netcdf MPICC=mpicc MPICXX=mpicxx MPIF77=mpif77 MPIF90=mpif90
I think your build uses the PnetCDF library already installed under /use/local. You can verify by search "checking for full path of header file pnetcdf.h" in the file config.log. Also, the path is set in variable ac_cv_header_path_pnetcdf_h
I don't have pre build pnetcdf on my desktop. It is indeed using the one i built for testing.
configure:18559: checking for full path of header file pnetcdf.h configure:18575: mpicc -E -I/home/khl7265/.local/include conftest.c
ac_cv_header_path_pnetcdf_h=/home/khl7265/.local/include/pnetcdf.h
How did your netcdf build find the installation path of your pnetcdf under /home/khl7265/.local? Your configure command for netcdf does not contain that path, and somehow the line below from your config.log shows
configure:18575: mpicc -E -I/home/khl7265/.local/include conftest.c
Check line 7 of your config.log for the full configure command used.
NetCDF does not take --with-
Here's the command found in my terminal history. I added --with-pnetcdf at first but turns out it does not recognize such option.
CC=mpicc CPPFLAGS="-I/home/khl7265/.local/include" LDFLAGS="-L/home/khl7265/.local/lib" LDADD="-lnetcdf" ./configure --disable-shared --enable-parallel-tests --prefix=/home/khl7265/.local/netcdf --enable-pnetcdf --with-pnetcdf=/home/khl7265/.local/ncmpi_nc4 --disable-dap
Your global environment variable CPPFLAGS is reused when building PnetCDF. PnetCDF users may not follow this way to build NetCDF and PnetCDF.
I did not set CPPFLAGS when building pnetcdf with nc4. Setting CPPFLAGS is the way suggested by netcdf document to enable pnetcdf support. I believe it is the only way user can do to enable pnetcdf support. https://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html
Check CPPFLAGS in config.log of your PnetCDF build. It should not show there.
It is empty.
CONFIGURE_ARGS_CLEAN='--enable-debug --disable-shared --enable-netcdf4 --with-netcdf4=/home/khl7265/.local/netcdf MPICC=mpicc MPICXX=mpicxx MPIF77=mpif77 MPIF90=mpif90' CONFIG_DATE='Sat May 4 20:30:16 CDT 2019' CPP='/usr/bin/mpicc -E' CPPFLAGS='' CXX='/usr/bin/mpicxx ' CXXCPP='/usr/bin/mpicxx -E' CXXDEPMODE='depmode=gcc3' CXXFLAGS='-g -O0' CYGPATH_W='echo' DECL_MPI_OFFSET_FALSE='#'
Here is the explanation. The PnetCDF library used to build your NetCDF is installed in /home/khl7265/.local/lib. Then your NetCDF library is built and installed in /home/khl7265/.local/netcdf/lib When building PnetCDF with --enable-netcdf4, the configure only knows /home/khl7265/.local/netcdf/lib, but not /home/khl7265/.local/lib
The reason your build knows /home/khl7265/.local/lib is because of nc-config command. But one some systems, such as Cori, nc-config is not installed.
It is not a good idea to allow to use a NetCDF that is already built with PnetCDF. There is no point to support this option. I will keep it disabled.
not merged
allow linking to netcdf built with pnetcdf support