From 844480aa377041a549d078d8728b6c394a3fcb7f Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 29 Jun 2022 19:03:25 -0400 Subject: [PATCH 01/25] DEV: Add autools-generated files to .gitignore. They weren't in git; I'm assuming that's on purpose. --- .gitignore | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.gitignore b/.gitignore index ec501e2dcc..9abf05757e 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,20 @@ dap4_test/findtestserver4.c dap4_test/pingurl4.c ncdap_test/findtestserver.c +Makefile.in +aclocal.m4 +compile +config.guess +config.h.in +config.sub +configure +depcomp +install-sh +ltmain.sh +m4 +missing +test-driver + ##### # End ignored generated files. ##### From a69308e5b7e3b03d71b203e952fdd73f854aaf78 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 29 Jun 2022 18:58:31 -0400 Subject: [PATCH 02/25] CI: Add Cygwin CI run. --- .github/workflows/run_tests_win_cygwin.yml | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/run_tests_win_cygwin.yml diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml new file mode 100644 index 0000000000..55b7be9934 --- /dev/null +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -0,0 +1,60 @@ +name: Run Cygwin-based tests + +on: [push, pull_request, workflow_dispatch] + +env: + SHELLOPTS: igncr + CHERE_INVOKING: 1 + CYGWIN_NOWINPATH: 1 + +jobs: + build-and-test: + runs-on: windows-latest + defaults: + run: + shell: bash -eo pipefail -o igncr "{0}" + timeout-minutes: 30 + + name: Cygwin-based tests + + steps: + - name: Fix line endings + run: git config --global core.autocrlf input + + - uses: actions/checkout@v2 + + - uses: cygwin/cygwin-install-action@v2 + with: + platform: x86_64 + packages: >- + git automake libtool autoconf2.5 make cmake libhdf5-devel + libhdf4-devel zipinfo libxml2-devel perl zlib-devel + libzstd-devel libbz2-devel libaec-devel libzip-devel + libdeflate-devel gcc-core + + - name: (Autotools) Run autoconf and friends + run: | + cp -f /bin/dash /bin/sh + mkdir m4 + /bin/dash /usr/bin/libtoolize --force --copy --verbose + /usr/bin/autoreconf-2.69 --force --install --verbose --debug + + - name: (Autotools) Configure in-tree build + run: >- + /bin/dash ./configure --enable-hdf5 --enable-shared + --disable-static --enable-dap --disable-dap-remote-tests + --enable-plugins --disable-nczarr-filters + --disable-nczarr-s3 --disable-nczarr-s3-tests --disable-nczarr + + - name: Look at config.log if error + if: ${{ failure() }} + run: cat config.log + + - name: Print summary + run: cat libnetcdf.settings + + - name: (Autotools) Build library and utilities + run: make -j8 SHELL=/bin/dash + + - name: (Autotools) Build and run tests + run: make check -j8 SHELL=/bin/dash From 086eed0e396f2b3dab0439fa70d38143c888551d Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 30 Jun 2022 08:18:55 -0400 Subject: [PATCH 03/25] CI, TST: Check that test plugins don't get installed with DESTDIR This caused problems for packagers (unidata/netcdf-c#2431) --- .github/workflows/run_tests_win_cygwin.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index 55b7be9934..23430b8aef 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -13,7 +13,6 @@ jobs: defaults: run: shell: bash -eo pipefail -o igncr "{0}" - timeout-minutes: 30 name: Cygwin-based tests @@ -56,5 +55,15 @@ jobs: - name: (Autotools) Build library and utilities run: make -j8 SHELL=/bin/dash + - name: (Autotools) Test DESTDIR install + run: | + make install DESTDIR=/tmp/pretend-root SHELL=/bin/dash + if [ -d "/tmp/pretend-root/$(pwd)" ]; + then + find /tmp/pretend-root/$(pwd) + if [ $(find /tmp/pretend-root/$(pwd) -type f | wc -l) -gt 0 ]; then exit 1; fi + fi + - name: (Autotools) Build and run tests + timeout-minutes: 30 run: make check -j8 SHELL=/bin/dash From 0eed60a295eef045003acd43fe5a492b350fd674 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 30 Jun 2022 06:58:36 -0400 Subject: [PATCH 04/25] BLD: Get netCDF4 build working on Windows. Most changes are to get plugins working. libdispatchdreg.c went in in unidata/netcdf-c#2460, after I'd done it here. Summary of individual changes below. BLD: Remove declspec(dllexport); in dreg.c. By removing the explicit handling, the automatic handling (equivalent to --export-all-symbols with recent GNU tools) will be enabled again, so the generated library will have more than one function exported. BLD: Link plugins against libnetcdf on Cygwin. BLD: Add AM_LDFLAGS to plugin _LDFLAGS to pass -no-undefined. BLD: Link ncz*filters plugins against libnetcdf. BLD: Add AM_LDFLAGS to test plugin _LDFLAGS. Also move rpath from AM_LDFLAGS to test plugin _LDFLAGS. TST: Don't run nczarr_test/run_specific_filters.sh on Cygwin. It takes over half an hour to complete, where the others take a minute or less. TST: Try to find the hanging Cygwin test. --- libdispatch/dreg.c | 1 - nczarr_test/Makefile.am | 4 +++- plugins/Makefile.am | 33 ++++++++++++++++++++------------- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/libdispatch/dreg.c b/libdispatch/dreg.c index 9e65ddcbde..cd16032d38 100644 --- a/libdispatch/dreg.c +++ b/libdispatch/dreg.c @@ -19,7 +19,6 @@ #ifdef _WIN32 __declspec(dllexport) #endif - int getmountpoint(char* keyvalue, size_t size) { diff --git a/nczarr_test/Makefile.am b/nczarr_test/Makefile.am index 1798455aa5..a54a7f2487 100644 --- a/nczarr_test/Makefile.am +++ b/nczarr_test/Makefile.am @@ -96,7 +96,7 @@ TESTS += run_nczfilter.sh # Echo filter tests from nc_test4 check_PROGRAMS += testfilter testfilter_misc testfilter_order testfilter_repeat testfilter_multi test_filter_avail TESTS += run_filter.sh -TESTS += run_unknown.sh +TESTS += run_unknown.sh TESTS += run_specific_filters.sh endif #ENABLE_FILTER_TESTING @@ -116,8 +116,10 @@ zs3parse_SOURCES = zs3parse.c if ENABLE_NCZARR_S3 noinst_PROGRAMS += s3util s3util_SOURCES = s3util.c +if !ISCYGWIN TESTS += run_s3_cleanup.sh endif +endif # Given a netcdf4|NCZarr file, dump the actual chunk contents. # Used to validate nczarr chunking code. diff --git a/plugins/Makefile.am b/plugins/Makefile.am index c69679a574..3c7edcdc27 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -5,7 +5,7 @@ include $(top_srcdir)/lib_flags.am AM_LDFLAGS += -module -avoid-version -shared -export-dynamic \ - -rpath ${abs_builddir} ${NOUNDEFINED} + $(NOUNDEFINED) # Create an alternate directory if not installing or for noinst installs. ALTPLUGINDIR = ${abs_top_builddir}/plugins/plugindir @@ -33,6 +33,10 @@ plugin_version_info = -version-info 0:0:0 if ISMINGW LDADD = ${top_builddir}/liblib/libnetcdf.la endif +if ISCYGWIN +LDADD = $(top_builddir)/liblib/libnetcdf.la +LIBADD = $(top_builddir)/liblib/libnetcdf.la +endif EXTRA_DIST = CMakeLists.txt @@ -55,15 +59,15 @@ lib__nch5shuffle_la_SOURCES = H5Zshuffle.c lib__nch5fletcher32_la_SOURCES = H5Zfletcher32.c H5checksum.c lib__nch5deflate_la_SOURCES = H5Zdeflate.c -lib__nch5shuffle_la_LDFLAGS = ${plugin_version_info} -lib__nch5deflate_la_LDFLAGS = ${plugin_version_info} -lib__nch5fletcher32_la_LDFLAGS = ${plugin_version_info} +lib__nch5shuffle_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) +lib__nch5deflate_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) +lib__nch5fletcher32_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) # Need our version of szip if libsz available and we are not using HDF5 if HAVE_SZ plugin_LTLIBRARIES += lib__nch5szip.la lib__nch5szip_la_SOURCES = H5Zszip.c H5Zszip.h -lib__nch5szip_la_LDFLAGS = ${plugin_version_info} +lib__nch5szip_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) endif endif # ENABLE_NCZARR_FILTERS @@ -72,7 +76,10 @@ if ENABLE_PLUGINS # The NCZarr codec libraries lib__nczstdfilters_la_SOURCES = NCZstdfilters.c +lib__nczstdfilters_la_LIBADD = $(LIBADD) lib__nczhdf5filters_la_SOURCES = NCZhdf5filters.c +lib__nczhdf5filters_la_LIBADD = $(LIBADD) + lib__nczstdfilters_la_LDFLAGS = ${plugin_version_info} lib__nczhdf5filters_la_LDFLAGS= ${plugin_version_info} @@ -82,13 +89,13 @@ plugin_LTLIBRARIES += lib__nczstdfilters.la if HAVE_BLOSC lib__nch5blosc_la_SOURCES = H5Zblosc.c H5Zblosc.h -lib__nch5blosc_la_LDFLAGS = ${plugin_version_info} +lib__nch5blosc_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) plugin_LTLIBRARIES += lib__nch5blosc.la endif if HAVE_ZSTD lib__nch5zstd_la_SOURCES = H5Zzstd.c H5Zzstd.h -lib__nch5zstd_la_LDFLAGS = ${plugin_version_info} +lib__nch5zstd_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) plugin_LTLIBRARIES += lib__nch5zstd.la endif @@ -98,18 +105,18 @@ endif #ENABLE_PLUGINS # Need two distinct instances lib__nch5noop_la_SOURCES = H5Znoop.c H5Zutil.c h5noop.h lib__nch5noop1_la_SOURCES = H5Znoop1.c H5Zutil.c h5noop.h -lib__nch5noop_la_LDFLAGS = ${plugin_version_info} -lib__nch5noop1_la_LDFLAGS = ${plugin_version_info} +lib__nch5noop_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs +lib__nch5noop1_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs # The misc filter is to allow testing of filter arguments lib__nch5misc_la_SOURCES = H5Zmisc.c H5Zutil.c h5misc.h -lib__nch5misc_la_LDFLAGS = ${plugin_version_info} +lib__nch5misc_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs lib__nczmisc_la_SOURCES = NCZmisc.c -lib__nczmisc_la_LDFLAGS = ${plugin_version_info} +lib__nczmisc_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs # Provide a filter to test missing filter lib__nch5unknown_la_SOURCES = H5Zunknown.c -lib__nch5unknown_la_LDFLAGS = ${plugin_version_info} +lib__nch5unknown_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs tmp_LTLIBRARIES += lib__nch5noop.la lib__nch5noop1.la lib__nch5misc.la lib__nczmisc.la lib__nch5unknown.la @@ -120,7 +127,7 @@ EXTRA_DIST += ${BZIP2SRC} BZIP2_LICENSE if HAVE_LOCAL_BZ2 lib__nch5bzip2_la_SOURCES += ${BZIP2SRC} endif -lib__nch5bzip2_la_LDFLAGS = ${plugin_version_info} +lib__nch5bzip2_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) plugin_LTLIBRARIES += lib__nch5bzip2.la endif #ENABLE_FILTER_TESTING From 927829e26730d1df33a9cf309590dd3c6811c38e Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 30 Jun 2022 10:49:15 -0400 Subject: [PATCH 05/25] DEV, TST: Move test plugins to check_LTLIBRARIES instead of tmp_LTLIBRARIES. Don't install test plugins; don't install any plugins if not requested. DEV: Remove plugins installed to ALTPLUGINDIR. These get put in the build tree if ENABLE_PLUGIN_DIR is not true. I want to remove these first, then look into skipping the plugins directory if plugins are disabled. DEV: don't install plugins if there's no install dir Still build them, since they might be needed for tests, but don't mark them for install. BLD, FIX: Add -rpath to noinst plugin links. Since I stopped installing the plugins, I need to manually add `-rpath` to their link line so `libtool` actually bothers linking them. --- plugins/Makefile.am | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 3c7edcdc27..670349aedf 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -15,15 +15,17 @@ if ENABLE_PLUGIN_DIR plugindir = @PLUGIN_INSTALL_DIR@ else plugindir = ${ALTPLUGINDIR} +AM_LDFLAGS += -rpath $(abs_builddir)/.libs endif plugin_LTLIBRARIES = +plugins_to_install = # Apparently one cannot have plugin_LTLIBRARIES and also noinst_LTLIBRARIES. # So create a tmp location for "noinst" shared libraries. -tmpdir = ${ALTPLUGINDIR} +# tmpdir = ${ALTPLUGINDIR} -tmp_LTLIBRARIES = +check_LTLIBRARIES = # This linker flag specifies libtool version info. # See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning @@ -54,7 +56,7 @@ EXTRA_DIST += H5checksum.c if ENABLE_FILTER_TESTING if ENABLE_NCZARR_FILTERS -plugin_LTLIBRARIES += lib__nch5fletcher32.la lib__nch5shuffle.la lib__nch5deflate.la +plugins_to_install += lib__nch5fletcher32.la lib__nch5shuffle.la lib__nch5deflate.la lib__nch5shuffle_la_SOURCES = H5Zshuffle.c lib__nch5fletcher32_la_SOURCES = H5Zfletcher32.c H5checksum.c lib__nch5deflate_la_SOURCES = H5Zdeflate.c @@ -65,7 +67,7 @@ lib__nch5fletcher32_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) # Need our version of szip if libsz available and we are not using HDF5 if HAVE_SZ -plugin_LTLIBRARIES += lib__nch5szip.la +plugins_to_install += lib__nch5szip.la lib__nch5szip_la_SOURCES = H5Zszip.c H5Zszip.h lib__nch5szip_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) endif @@ -80,23 +82,22 @@ lib__nczstdfilters_la_LIBADD = $(LIBADD) lib__nczhdf5filters_la_SOURCES = NCZhdf5filters.c lib__nczhdf5filters_la_LIBADD = $(LIBADD) - lib__nczstdfilters_la_LDFLAGS = ${plugin_version_info} lib__nczhdf5filters_la_LDFLAGS= ${plugin_version_info} -plugin_LTLIBRARIES += lib__nczhdf5filters.la -plugin_LTLIBRARIES += lib__nczstdfilters.la +plugins_to_install += lib__nczhdf5filters.la +plugins_to_install += lib__nczstdfilters.la if HAVE_BLOSC lib__nch5blosc_la_SOURCES = H5Zblosc.c H5Zblosc.h lib__nch5blosc_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -plugin_LTLIBRARIES += lib__nch5blosc.la +plugins_to_install += lib__nch5blosc.la endif if HAVE_ZSTD lib__nch5zstd_la_SOURCES = H5Zzstd.c H5Zzstd.h lib__nch5zstd_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -plugin_LTLIBRARIES += lib__nch5zstd.la +plugins_to_install += lib__nch5zstd.la endif endif #ENABLE_PLUGINS @@ -118,7 +119,7 @@ lib__nczmisc_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -rpath $(abs_buil lib__nch5unknown_la_SOURCES = H5Zunknown.c lib__nch5unknown_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs -tmp_LTLIBRARIES += lib__nch5noop.la lib__nch5noop1.la lib__nch5misc.la lib__nczmisc.la lib__nch5unknown.la +check_LTLIBRARIES += lib__nch5noop.la lib__nch5noop1.la lib__nch5misc.la lib__nczmisc.la lib__nch5unknown.la # Bzip2 is used to test more complex filters lib__nch5bzip2_la_SOURCES = H5Zbzip2.c h5bzip2.h @@ -128,10 +129,16 @@ if HAVE_LOCAL_BZ2 lib__nch5bzip2_la_SOURCES += ${BZIP2SRC} endif lib__nch5bzip2_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -plugin_LTLIBRARIES += lib__nch5bzip2.la +plugins_to_install += lib__nch5bzip2.la endif #ENABLE_FILTER_TESTING +if ENABLE_PLUGIN_DIR +plugin_LTLIBRARIES = $(plugins_to_install) +else +noinst_LTLIBRARIES = $(plugins_to_install) +endif + BUILT_SOURCES = H5Znoop1.c DISTCLEANFILES = H5Znoop1.c H5Znoop2.c ncjson.h H5Znoop1.c: Makefile H5Znoop.c @@ -152,4 +159,3 @@ bzip2:: # Custom clean clean-local: rm -fr ${ALTPLUGINDIR} - From f000e15cb5e9242badeb5b5caa2e968c574a4b63 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 30 Jun 2022 16:01:45 -0400 Subject: [PATCH 06/25] BLD: Try fixing the export-symbols problem on MinGW It's not exporting symbols at the moment, and I'd prefer to avoid -Wl,--export-all-symbols. --- .github/workflows/run_tests_win_mingw.yml | 8 +++++--- libncpoco/cp_win32.c | 12 ++++++++++++ plugins/Makefile.am | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_tests_win_mingw.yml b/.github/workflows/run_tests_win_mingw.yml index 46771aae07..8813120e2d 100644 --- a/.github/workflows/run_tests_win_mingw.yml +++ b/.github/workflows/run_tests_win_mingw.yml @@ -6,8 +6,10 @@ name: Run MSYS2, MinGW64-based Tests +env: + CPPFLAGS: "-D_BSD_SOURCE" -on: [pull_request, workflow_dispatch] +on: [push, pull_request, workflow_dispatch] jobs: @@ -35,7 +37,7 @@ jobs: run: autoreconf -if - name: (Autotools) Configure Build - run: ./configure --enable-hdf5 --enable-dap --disable-dap-remote-tests --disable-static --disable-plugins --disable-byterange --disable-dap-remote-tests --disable-logging + run: ./configure --enable-hdf5 --enable-dap --disable-dap-remote-tests --disable-static --disable-byterange --disable-dap-remote-tests --disable-logging --enable-plugins --disable-nczarr-filters if: ${{ success() }} - name: (Autotools) Look at config.log if error @@ -46,7 +48,7 @@ jobs: run: cat libnetcdf.settings - name: (Autotools) Build Library and Utilities - run: make -j 8 LDFLAGS="-no-undefined -Wl,--export-all-symbols" + run: make -j 8 LDFLAGS='-Wl,--export-all-symbols' if: ${{ success() }} - name: (Autotools) Build and Run Tests diff --git a/libncpoco/cp_win32.c b/libncpoco/cp_win32.c index cb696e0c0e..5653dd279b 100755 --- a/libncpoco/cp_win32.c +++ b/libncpoco/cp_win32.c @@ -28,6 +28,18 @@ static const char* driveletters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS /* Forward */ static int isAbsolutePath(const char* path); +#if !defined(nulldup) && !defined(HAVE_STRDUP) +extern char *nulldup(const char* s) { + if (s) { + char *result = malloc(strlen(s) + 1); + strcpy(result, s); + return result; + } else { + return s; + } +} +#endif + /**************************************************/ int diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 670349aedf..1b3f36095f 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -34,6 +34,7 @@ plugin_version_info = -version-info 0:0:0 if ISMINGW LDADD = ${top_builddir}/liblib/libnetcdf.la +LIBADD = $(LDADD) endif if ISCYGWIN LDADD = $(top_builddir)/liblib/libnetcdf.la From 1ef000cae156dbe100c2afff1fb89a73a037229d Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 1 Jul 2022 08:32:46 -0400 Subject: [PATCH 07/25] CI, DBG: Upload MinGW test logs on failure. --- .github/workflows/run_tests_win_mingw.yml | 19 +++++++++++++++++-- plugins/Makefile.am | 9 ++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run_tests_win_mingw.yml b/.github/workflows/run_tests_win_mingw.yml index 8813120e2d..85f4278819 100644 --- a/.github/workflows/run_tests_win_mingw.yml +++ b/.github/workflows/run_tests_win_mingw.yml @@ -48,9 +48,24 @@ jobs: run: cat libnetcdf.settings - name: (Autotools) Build Library and Utilities - run: make -j 8 LDFLAGS='-Wl,--export-all-symbols' + run: make -j 8 LDFLAGS="-Wl,--export-all-symbols" if: ${{ success() }} + - name: Check for plugins + run: | + dir ./plugins + dir ./plugins/.libs + - name: (Autotools) Build and Run Tests - run: make check -j 8 + run: make check -j 8 LDFLAGS="-Wl,--export-all-symbols" if: ${{ success() }} + id: tests + + - name: Upload test failures + if: ${{ failure() && steps.tests.conclusion == 'failure' }} + uses: actions/upload-artifact@v3 + with: + name: test-logs + path: | + */*.log + */*.trs diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 1b3f36095f..bc7c7c1006 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -26,6 +26,7 @@ plugins_to_install = # tmpdir = ${ALTPLUGINDIR} check_LTLIBRARIES = +noinst_LTLIBRARIES = # This linker flag specifies libtool version info. # See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning @@ -120,7 +121,9 @@ lib__nczmisc_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -rpath $(abs_buil lib__nch5unknown_la_SOURCES = H5Zunknown.c lib__nch5unknown_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs -check_LTLIBRARIES += lib__nch5noop.la lib__nch5noop1.la lib__nch5misc.la lib__nczmisc.la lib__nch5unknown.la +check_LTLIBRARIES += lib__nch5noop.la lib__nch5noop1.la lib__nch5unknown.la +# findplugin.sh needs these plugins, and I want to see if these get built properly +noinst_LTLIBRARIES += lib__nch5misc.la lib__nczmisc.la # Bzip2 is used to test more complex filters lib__nch5bzip2_la_SOURCES = H5Zbzip2.c h5bzip2.h @@ -135,9 +138,9 @@ plugins_to_install += lib__nch5bzip2.la endif #ENABLE_FILTER_TESTING if ENABLE_PLUGIN_DIR -plugin_LTLIBRARIES = $(plugins_to_install) +plugin_LTLIBRARIES += $(plugins_to_install) else -noinst_LTLIBRARIES = $(plugins_to_install) +noinst_LTLIBRARIES += $(plugins_to_install) endif BUILT_SOURCES = H5Znoop1.c From 5c9722f5bf483fc42094f8a05d424ab372658a7e Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 1 Jul 2022 10:14:54 -0400 Subject: [PATCH 08/25] TST: Add code for MinGW to findplugin.sh. --- nc_test4/findplugin.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nc_test4/findplugin.in b/nc_test4/findplugin.in index 7146bb0382..b9dad13d2a 100755 --- a/nc_test4/findplugin.in +++ b/nc_test4/findplugin.in @@ -36,6 +36,7 @@ findpluginext() { TSO=`find ${TOPBUILDDIR}/plugins -name '*misc.so'` TDY=`find ${TOPBUILDDIR}/plugins -name '*misc.dylib'` TCYG=`find ${TOPBUILDDIR}/plugins -name 'cyg*misc.dll'` + TMING=`find ${TOPBUILDDIR}/plugins -name lib*misc.dll` TDLL=`find ${TOPBUILDDIR}/plugins -name '*misc.dll'` if test "x$TSO" != x ; then FP_PLUGIN_EXT="so" @@ -45,7 +46,10 @@ findpluginext() { FP_PLUGIN_PRE="lib__nc" elif test "x$TCYG" != x ; then FP_PLUGIN_EXT="dll" - FP_PLUGIN_PRE="cyg__nc" + FP_PLUGIN_PRE="cyg__nc" + elif test "x$TMING" != x ; then + FP_PLUGIN_EXT="dll" + FP_PLUGIN_PRE="lib__nc" elif test "x$TDLL" != x ; then FP_PLUGIN_EXT="dll" FP_PLUGIN_PRE="__nc" From c805b021436a3de1f37fa9747bfa3eafcc2b7f59 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 5 Jul 2022 10:54:35 -0400 Subject: [PATCH 09/25] TST: Mark tst_filter.sh XFAIL on MinGW Attempting to add a filter to a netCDF file using `nccopy` results in a file without `_Filter` attribute set. I suspect this is a problem with HDF5, but I don't remember why and never got around to testing that. The rest of the plugin tests pass, so I'm telling the test runner to expect this one test to fail and see if there are other failures. --- nc_test4/Makefile.am | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nc_test4/Makefile.am b/nc_test4/Makefile.am index 0cc2cb389b..58e7aa1bd4 100644 --- a/nc_test4/Makefile.am +++ b/nc_test4/Makefile.am @@ -49,6 +49,12 @@ endif # Build test programs plus programs used in test scripts. check_PROGRAMS = $(NC4_TESTS) tst_empty_vlen_unlim tst_charvlenbug tst_vlenstr TESTS = $(NC4_TESTS) run_empty_vlen_test.sh +XFAIL_TESTS = + +if ISCYGWIN +TESTS += tst_h_strbug tst_h_refs +XFAIL_TESTS += tst_h_strbug tst_h_refs +endif # Add these if large file tests are turned on. if LARGE_FILE_TESTS @@ -89,7 +95,10 @@ TESTS += tst_filter.sh TESTS += tst_unknown.sh TESTS += tst_specific_filters.sh TESTS += tst_bloscfail.sh -endif +if ISMINGW +XFAIL_TESTS += tst_filter.sh +endif # ISMINGW +endif # ENABLE_FILTER_TESTING endif # USE_HDF5 endif # BUILD_UTILITIES From d33e3155d88e65c344a84e0afe498d6ce90b214a Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 5 Jul 2022 11:24:38 -0400 Subject: [PATCH 10/25] CI: Try to skip failing NCZarr Plugin tests on MinGW --- .github/workflows/run_tests_win_mingw.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_tests_win_mingw.yml b/.github/workflows/run_tests_win_mingw.yml index 85f4278819..947e45b1a3 100644 --- a/.github/workflows/run_tests_win_mingw.yml +++ b/.github/workflows/run_tests_win_mingw.yml @@ -37,7 +37,7 @@ jobs: run: autoreconf -if - name: (Autotools) Configure Build - run: ./configure --enable-hdf5 --enable-dap --disable-dap-remote-tests --disable-static --disable-byterange --disable-dap-remote-tests --disable-logging --enable-plugins --disable-nczarr-filters + run: ./configure --enable-hdf5 --enable-dap --disable-dap-remote-tests --disable-static --disable-byterange --disable-dap-remote-tests --disable-logging --enable-plugins --disable-nczarr-filters --disable-nczarr-s3 --disable-nczarr-s3-tests if: ${{ success() }} - name: (Autotools) Look at config.log if error From a71c60680281b0359933271e2f42bc8b29d86eb7 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 5 Jul 2022 11:28:33 -0400 Subject: [PATCH 11/25] TST: Mark NCZarr plugins XFAIL on MinGW Not sure why --disable-nczarr-filters doesn't exclude them, but let's check the rest of the functionality. --- nczarr_test/Makefile.am | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nczarr_test/Makefile.am b/nczarr_test/Makefile.am index a54a7f2487..f9532212f4 100644 --- a/nczarr_test/Makefile.am +++ b/nczarr_test/Makefile.am @@ -99,6 +99,10 @@ TESTS += run_filter.sh TESTS += run_unknown.sh TESTS += run_specific_filters.sh +if ISMINGW +XFAIL_TESTS = run_filter.sh run_unknown.sh run_specific_filters.sh +endif # ISMINGW + endif #ENABLE_FILTER_TESTING endif #BUILD_UTILITIES From 8b600d3499e3b47e8098be4230902d05d749e077 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 5 Jul 2022 12:32:33 -0400 Subject: [PATCH 12/25] TST: tst_h_strbug and tst_h_refs pass on Cygwin now Mark them un-xfail --- nc_test4/Makefile.am | 8 -------- 1 file changed, 8 deletions(-) diff --git a/nc_test4/Makefile.am b/nc_test4/Makefile.am index 58e7aa1bd4..bacccc9512 100644 --- a/nc_test4/Makefile.am +++ b/nc_test4/Makefile.am @@ -41,21 +41,13 @@ if HAS_PAR_FILTERS NC4_TESTS += tst_alignment endif -# Temporary I hoped, but hoped in vain. -if !ISCYGWIN NC4_TESTS += tst_h_strbug tst_h_refs -endif # Build test programs plus programs used in test scripts. check_PROGRAMS = $(NC4_TESTS) tst_empty_vlen_unlim tst_charvlenbug tst_vlenstr TESTS = $(NC4_TESTS) run_empty_vlen_test.sh XFAIL_TESTS = -if ISCYGWIN -TESTS += tst_h_strbug tst_h_refs -XFAIL_TESTS += tst_h_strbug tst_h_refs -endif - # Add these if large file tests are turned on. if LARGE_FILE_TESTS check_PROGRAMS += tst_large tst_large2 From 543e27c8afa1570406a106cd6b6319e2c58ae2d9 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sun, 10 Jul 2022 16:26:08 -0400 Subject: [PATCH 13/25] BLD: Use host platform instead of build platform for platform-specific checks. --- configure.ac | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index fafb3034e5..561c5b7157 100644 --- a/configure.ac +++ b/configure.ac @@ -102,13 +102,15 @@ AM_INIT_AUTOMAKE([foreign dist-zip subdir-objects]) AC_CONFIG_SRCDIR([include/netcdf.h]) # Figure out platforms of special interest -case "`uname`" in - CYGWIN*) ISCYGWIN=yes;; - Darwin*) ISOSX=yes;; - WIN*) ISMSVC=yes;; - MINGW*) ISMINGW=yes;; - MSYS*) ISMINGW=yes;; -esac +AC_CANONICAL_HOST +AS_CASE([$host], + [*-*-cygwin], [ISCYGWIN=yes], + [*-*-darwin*], [ISOSX=yes], + [*-*-mingw*], [ISMINGW=yes], + [*-*-msys], [ISMINGW=yes], + [*-*-win*], [ISMSVC=yes], + [] +) if test "x$MSYSTEM" != x ; then ISMINGW=yes From b85c929a9746499f27365d224673bfe378e4fe4a Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Mon, 11 Jul 2022 15:42:07 -0400 Subject: [PATCH 14/25] CI: Prep Cygwin CI run for adding CMake build. --- .github/workflows/run_tests_win_cygwin.yml | 65 +++++++++++++++++++++- .github/workflows/run_tests_win_mingw.yml | 48 +++++++++++++++- 2 files changed, 108 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index 23430b8aef..aff3169800 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -8,13 +8,13 @@ env: CYGWIN_NOWINPATH: 1 jobs: - build-and-test: + build-and-test-autotools: runs-on: windows-latest defaults: run: shell: bash -eo pipefail -o igncr "{0}" - name: Cygwin-based tests + name: Cygwin-based Autotools tests steps: - name: Fix line endings @@ -26,7 +26,7 @@ jobs: with: platform: x86_64 packages: >- - git automake libtool autoconf2.5 make cmake libhdf5-devel + git automake libtool autoconf2.5 make libhdf5-devel libhdf4-devel zipinfo libxml2-devel perl zlib-devel libzstd-devel libbz2-devel libaec-devel libzip-devel libdeflate-devel gcc-core @@ -67,3 +67,62 @@ jobs: - name: (Autotools) Build and run tests timeout-minutes: 30 run: make check -j8 SHELL=/bin/dash + + build-and-test-cmake: + runs-on: windows-latest + defaults: + run: + shell: bash -eo pipefail -o igncr "{0}" + + name: Cygwin-based CMake tests + + steps: + - name: Fix line endings + run: git config --global core.autocrlf input + + - uses: actions/checkout@v2 + + - uses: cygwin/cygwin-install-action@v2 + with: + platform: x86_64 + packages: >- + git make cmake ninja m4 libhdf5-devel libhdf4-devel + libjpeg-devel zipinfo libxml2-devel perl zlib-devel + libzstd-devel libbz2-devel libaec-devel libzip-devel + libdeflate-devel gcc-core gcc-g++ libcurl-devel doxygen + libiconv-devel + + - uses: egor-tensin/cleanup-path@v1 + with: + dirs: "C:\\cygwin\\bin;C:\\cygwin\\lib\\lapack" + + - name: (CMake) Configure project + run: | + mkdir build + cd build + /usr/bin/cmake .. -DBUILD_SHARED_LIBS=ON -DENABLE_DAP=ON -DENABLE_DOXYGEN=ON -DENABLE_EXAMPLES=ON -DENABLE_EXAMPLE_TESTS=ON -DENABLE_EXTRA_TESTS=OFF -DENABLE_FILTER_TESTING=ON -DENABLE_HDF4=ON DENABLE_HDF5=Yes -DENABLE_NCZARR=Yes -DENABLE_PLUGINS=ON -DENABLE_TESTS=ON -DENABLE_UNIT_TESTS=ON + + - name: Print summary + run: >- + cd build && cat libnetcdf.settings + + - name: (CMake) Build all + run: >- + cd build && /usr/bin/cmake --build . --verbose -j8 + + - name: (CMake) Test + id: cmake-tests + run: >- + cd build && /usr/bin/ctest -j8 . + + - name: (CMake) Verbose output of CTest failures + if: failure() && steps.cmake-tests.conclusion == 'failure' + run: >- + cd build && /usr/bin/ctest --output-on-failure -j8 --rerun-failed -VV . + + - uses: actions/upload-artifact@v3 + if: failure() && steps.cmake-tests.conclusion == 'failure' + with: + name: cygwin-cmake-test-logs + path: | + build/Testing/ diff --git a/.github/workflows/run_tests_win_mingw.yml b/.github/workflows/run_tests_win_mingw.yml index 947e45b1a3..2621ce76f2 100644 --- a/.github/workflows/run_tests_win_mingw.yml +++ b/.github/workflows/run_tests_win_mingw.yml @@ -13,7 +13,7 @@ on: [push, pull_request, workflow_dispatch] jobs: - build-and-test: + build-and-test-autotools: runs-on: windows-latest defaults: @@ -65,7 +65,51 @@ jobs: if: ${{ failure() && steps.tests.conclusion == 'failure' }} uses: actions/upload-artifact@v3 with: - name: test-logs + name: mingw-autotools-test-logs path: | */*.log */*.trs + + build-and-test-cmake: + + runs-on: windows-latest + env: + CPPFLAGS: -I/mingw64/include/libxml2/ + defaults: + run: + shell: msys2 {0} + + steps: + + - uses: actions/checkout@v2 + - uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: >- + git mingw-w64-x86_64-toolchain make cmake m4 + mingw-w64-x86_64-hdf5 unzip mingw-w64-x86_64-libxml2 + + - name: (CMake) Configure project + run: | + mkdir build + cd build + cmake .. -DENABLE_HDF5=TRUE + + - name: Print summary + run: >- + cd build && cat libnetcdf.settings + + - name: (CMake) Build all + run: >- + cd build && cmake --build -j8 + + - name: (CMake) Run tests + id: cmake-run-tests + run: >- + cd build && ctest --output-on-failure -j8 . + + - name: (CMake) Verbose output of CTest failures + if: failure() && steps.cmake-run-tests.conclusion == 'failure' + run: >- + cd build && ctest --output-on-failure -j8 --rerun-failed -VV . From adde7f55ab065fb709864c32541feeab1688adbf Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Mon, 11 Jul 2022 15:48:04 -0400 Subject: [PATCH 15/25] BLD: Get CMake build compiling on Cygwin. Mostly changing to Markdown files to a format Doxygen recognizes. --- CMakeLists.txt | 2 +- RELEASE_NOTES.md | 12 ++-- docs/filters.md | 12 ++-- docs/known_problems.md | 155 ++++++++++++++++++++--------------------- docs/nczarr.md | 6 +- 5 files changed, 94 insertions(+), 93 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f987eb53d9..feca465369 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -215,7 +215,7 @@ FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake DESTINATION ${CMAKE_CURR # Set Memory test program for non-MSVC based builds. # Assume valgrind for now. -IF((NOT MSVC) AND (NOT MINGW)) +IF((NOT MSVC) AND (NOT MINGW) AND (NOT ISCYGWIN)) SET(CTEST_MEMORYCHECK_COMMAND valgrind CACHE STRING "") ENDIF() diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 035877eabc..e64526c1a4 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -277,11 +277,13 @@ See [GitHub #1251](https://github.com/Unidata/netcdf-c/issues/1251). ### 4.5.0-rc1 - June 5, 2017 * [Enhancement] DAP4 is now included. Since dap2 is the default for urls, dap4 must be specified by -(1) using "dap4:" as the url protocol, or -(2) appending "#protocol=dap4" to the end of the url, or -(3) appending "#dap4" to the end of the url -Note that dap4 is enabled by default but remote-testing is -disabled until the testserver situation is resolved. + 1. using "dap4:" as the url protocol, or + 2. appending "\#protocol=dap4" to the end of the url, or + 3. appending "\#dap4" to the end of the url + + Note that dap4 is enabled by default but remote-testing is + disabled until the testserver situation is resolved. + * [Enhancement] The remote testing server can now be specified with the `--with-testserver` option to ./configure. * [Enhancement] Modified netCDF4 to use ASCII for NC_CHAR. See [Github Pull request #316](https://github.com/Unidata/netcdf-c/pull/316) for more information. * [Bug Fix] Corrected an error with how dimsizes might be read. See [Github #410](https://github.com/unidata/netcdf-c/issues/410) for more information. diff --git a/docs/filters.md b/docs/filters.md index 0d4be5c658..540fe394e7 100644 --- a/docs/filters.md +++ b/docs/filters.md @@ -438,7 +438,7 @@ This means that some mechanism is needed to translate between the HDF5 id+parame 3. It must be possible to modify the set of visible parameters in response to environment information such as the type of the associated variable; this is required to mimic the corresponding HDF5 capability. 4. It must be possible to use filters even if HDF5 support is disabled. -Note that the term "visible parameters" is used here to refer to the parameters provided by "nc_def_var_filter" or those stored in the dataset's metadata as provided by the JSON codec. The term "working parameters" refers to the parameters given to the compressor itself and derived from the visible parameters. +Note that the term "visible parameters" is used here to refer to the parameters provided by `nc_def_var_filter` or those stored in the dataset's metadata as provided by the JSON codec. The term "working parameters" refers to the parameters given to the compressor itself and derived from the visible parameters. The standard authority for defining Zarr filters is the list supported by the NumCodecs project [7]. Comparing the set of standard filters (aka codecs) defined by NumCodecs to the set of standard filters defined by HDF5 [3], it can be seen that the two sets overlap, but each has filters not defined by the other. @@ -514,8 +514,8 @@ This interrogation operates by seeing if certain well-known (function) names are There will be two library types: -1. HDF5 — exports a specific API: "H5Z_plugin_type" and "H5Z_get_plugin_info". -2. Codec — exports a specific API: "NCZ_get_codec_info" +1. HDF5 — exports a specific API: `H5Z_plugin_type` and `H5Z_get_plugin_info`. +2. Codec — exports a specific API: `NCZ_get_codec_info` Note that a given library can export either or both of these APIs. This means that we can have three types of libraries: @@ -605,7 +605,7 @@ is stored in the JSON dictionary form described earlier. The Codec style, using JSON, has the ability to provide very complex parameters that may be hard to encode as a vector of unsigned integers. It might be desirable to consider exporting a JSON-base API out of the netcdf-c API to support user access to this complexity. -This would mean providing some alternate version of "nc_def_var_filter" that takes a string-valued argument instead of a vector of unsigned ints. +This would mean providing some alternate version of `nc_def_var_filter` that takes a string-valued argument instead of a vector of unsigned ints. This extension is unlikely to be implemented until a compelling use-case is encountered. One bad side-effect of this is that we then may have two classes of plugins. @@ -812,7 +812,7 @@ The h5 tag indicates that they assume that the result of the parse is a set of u * idp will contain the first constant — the filter id * nparamsp will contain the number of params * paramsp will contain a vector of params — the caller must free -This function can parse single filter spec strings as defined in the section on \ref filters_syntax. +This function can parse single filter spec strings as defined in the section on [Filter Specification Syntax](#filters_syntax). 2. *int ncaux\_h5filterspec\_parselist(const char* txt, int* formatp, size\_t* nspecsp, struct NC\_H5\_Filterspec*** vectorp);* * txt contains the text of a sequence '|' separated filter specs. * formatp currently always returns 0. @@ -852,7 +852,7 @@ The include file *netcdf\_meta.h* contains the following definition. ```` #define NC_HAS_MULTIFILTERS 1 ```` -This, in conjunction with the error code *NC\_ENOFILTER* in *netcdf.h* can be used to see what filter mechanism is in place as described in the section on \ref filters_compatibility. +This, in conjunction with the error code *NC\_ENOFILTER* in *netcdf.h* can be used to see what filter mechanism is in place as described in the section on [incompatibities](#filters_compatibility). 1. !defined(NC\_ENOFILTER) && !defined(NC\_HAS\_MULTIFILTERS) — indicates that the old pre-4.7.4 mechanism is in place. It does not support multiple filters. diff --git a/docs/known_problems.md b/docs/known_problems.md index 07318f2f79..831f7b2e6c 100644 --- a/docs/known_problems.md +++ b/docs/known_problems.md @@ -47,7 +47,7 @@ Known Problems with netCDF 4.1.1 ------------------------------------------------------------------------ -### The clang compiler (default on OSX 10.9 Mavericks) detects error building ncgen3 +### The clang compiler (default on OSX 10.9 Mavericks) detects error building ncgen3 {#clang-ncgen3} Building the netCDF C library with the clang C compiler, the default /usr/bin/cc on OSX 10.9 Mavericks, detects an error in compiling @@ -60,7 +60,7 @@ ncgen3/genlib.h. This fix will be in the next release. -### Fortran options of nc-config utility (--fflags, --flibs, --has-f90) don't work correctly +### Fortran options of nc-config utility (--fflags, --flibs, --has-f90) don't work correctly {#nc-config-fortran} Beginning with version 4.2 of the C-based netCDF software, the netCDF Fortran library is built from an independent netcdf-fortran release with @@ -69,7 +69,7 @@ detect whether nf-config is installed and make use of its output to preserve backward compatibility with nc-config from previous releases. This problem is fixed in netCDF-4.2.1-rc1 and later releases. -### Using "--with-hdf5=..." configure option doesn't seem to work +### Using "--with-hdf5=..." configure option doesn't seem to work {#with-hdf5} With releases of netCDF-4 after version 4.1.2 (this includes 4.1.3, 4.2, 4.2.1, ...) you don't use "--with-hdf5" to specify the location of the @@ -80,7 +80,7 @@ HDF5 libraries, you use CPPFLAGS and LDFLAGS, as in The reason for this change is explained [here](https://www.unidata.ucar.edu/jira/browse/NCF-20). -### nccopy -d and -c options for compression and chunking don't work on netCDF-4 input files +### nccopy -d and -c options for compression and chunking don't work on netCDF-4 input files {#nccopy-compression-bug} Due to a bug in nccopy, the "-d n" and "-c" options only work for classic and 64-bit input files, producing netCDF-4 classic model output @@ -93,7 +93,7 @@ issue tracker. The bug has been fixed in all releases since 4.1.3, including the netcdf-4.2-rc1 release candidate. -### Debug statement left in F90 source +### Debug statement left in F90 source {#f90-debug-segfault} The debugging statement @@ -104,13 +104,13 @@ and should be removed. If the variable has a second dimension less than 4, this can cause a segfault. The problem has been fixed in the subsequent netcdf-fortran-4.2 release. -### Ncgen is known to produce bad output. +### Ncgen is known to produce bad output. {#bad-ncgen} Dave Allured at NOAA has reported that the ncgen for 4.1.1 produces bad .nc files under circumstances. We recommend that this version of ncgen should not be used. -### Building with Intel Fortran on Mac OS X +### Building with Intel Fortran on Mac OS X {#intel-fortran-macosx} Setting the environment variable **lt\_cv\_ld\_force\_load=no** before invoking the configure script is a workaround to successfully build @@ -127,7 +127,7 @@ C and Fortran libraries and passing all tests on Lion: building and testing the legacy netCDF-3 C++ API, because of an as yet unsolved error that's not relevant to this Fortran problem.) -### Accessing OPeNDAP servers using a constraint expression +### Accessing OPeNDAP servers using a constraint expression {#dap-413} The use of subsetting by specifying a URL with subsetting information to dap-enabled netCDF is broken for stable release 4.1.3. This can be @@ -140,13 +140,13 @@ in the error message This bug is fixed in 4.2 releases after 2011-09-11, as well as by fixing the 4.1.3 release using the 3 replacement source files in the 4.1.3-fix.tar file. -### Configuring with "--enable-benchmarks" option +### Configuring with "--enable-benchmarks" option {#enabling-benchmarks} Using the "--enable-benchmarks" option to the configure script fails with a compile error on some platforms, and has been reported to fail in other ways on some other platforms. -### Problem with disabling fill mode when using Lustre (or other large blksize file system) +### Problem with disabling fill mode when using Lustre (or other large blksize file system) {#lustre} Joerg Henrichs has reported a bug when writing netCDF classic format data with fill mode disabled, on a file system such as Lustre that uses @@ -180,7 +180,7 @@ using nc\_\_create with a blocksize outside the range in which erroneous writes occur. Some of these workarounds slow the write performance of netCDF. -### "make check" fails when linked with HDF5-1.8.6 +### "make check" fails when linked with HDF5-1.8.6 {#incompat-411-186} When built with HDF5 version 1.8.6, version 4.1.1 fails one of the tests invoked by "make check": @@ -212,7 +212,7 @@ The HDF5 1.8.5-patch1 release is available from the HDF5 site at or from the netCDF-4 ftp site at . -### Make tries to regenerate documentation with texi2dvi command +### Make tries to regenerate documentation with texi2dvi command {#texi2dvi} After building netCDF-4.1.1, invoking "make clean", and then building it again with "make all" or "make check", a failure to find the texi2dvi @@ -237,7 +237,7 @@ without invoking "make clean" until after the software and documentation is successfully installed. An alternative workaround is to just invoke "make install" after the error above and use online documentation. -### Accessing a multidimensional variable with more than 4 billion values on a 32-bit platform +### Accessing a multidimensional variable with more than 4 billion values on a 32-bit platform {#big-mvar-32bit} Kari Hoijarvi has reported a bug in implementation of large variable support that has been in netCDF software since at least 1997, and which @@ -283,14 +283,14 @@ Known Problems with netCDF 4.0.1 - [With Sun C compiler, 64-bit ncdump fails](#suncc-m64-ncdump) - [Portland Group compilers can't build shared fortran 90 or shared C++ library, or 64-bit C++ API](#PG_shared) -- [Intel 10.1 64-bit C++ compiler problem](#intel_10.1_64_bit_c++) +- [Intel 10.1 64-bit C++ compiler problem](#intel_10-1_64_bit_cpp) - [Intel 9.1 C++ compiler problem doesn't build C++ - API](#intel_9.1__c++) + API](#intel_9-1__cpp) - [ncgen/ncdump test failure with Intel version 11 compilers](#intel_11-ncgen) - ["ncdump -v group/var" reports "group not found"](#ncdump-v) -### Including mpi.h before netcdf.h breaks MPI +### Including mpi.h before netcdf.h breaks MPI {#include_mpi_order} Luis Kornblueh reports a subtle bug in netcdf 4.0.1. In the netcdf.h header file, the following mpi entities are defined: @@ -305,7 +305,7 @@ header file, the following mpi entities are defined: If mpi.h is included before netcdf.h, these defines (may) break the MPI implementation. -### With Sun C compiler, 64-bit ncdump fails +### With Sun C compiler, 64-bit ncdump fails {#suncc-m64-ncdump} As identified by Udo Grabowski, using the "-m64" option to build netCDF with the Sun C compiler results in a failed test when running "make @@ -333,7 +333,7 @@ little data at a time, there is no benefit to a 64-bit ncdump. The 32-bit ncdump handles classic, 64-bit offset, and netCDF-4 files correctly even if they are larger than 4 GiB. -### Portland Group compilers can't build shared fortran 90 library or shared C++ library +### Portland Group compilers can't build shared fortran 90 library or shared C++ library {#PG_shared} The portland group compilers can't build netCDF shared fortran 90 library. They fail with this error: @@ -389,7 +389,7 @@ here as [Technical Problem Report This bug was also previously [reported by a user](https://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg03783.html). -### Intel 10.1 64-bit C++ compiler problem +### Intel 10.1 64-bit C++ compiler problem {#intel_10-1_64_bit_cpp} On my test machine, the intel 10.1 C++ compiler cannot build the netCDF C++ API in 64-bit mode. I get an error like this: @@ -428,7 +428,7 @@ six-mile deep mine shaft.) Put the bin directory at the beginning of your PATH, and the lib (or lib64) directory at the beginning at the LD\_LIBRARY\_PATH. Then rebuild. -### Intel 9.1 C++ compiler problem doesn't build C++ API +### Intel 9.1 C++ compiler problem doesn't build C++ API {#intel_9-1__cpp} On my test machine, the intel 9.1 C++ compile fails like this: @@ -466,7 +466,7 @@ On my test machine, the intel 9.1 C++ compile fails like this: Anyone who can shed light on this should send email to support-netcdf@unidata.ucar.edu. -### ncgen/ncdump test failure with Intel version 11 compilers +### ncgen/ncdump test failure with Intel version 11 compilers {#intel_11-ncgen} Ed Anderson reports that the tests of the netcdf-4.0 (and presumable 4.0.1 and 3.6.3) package fail with the recently released version 11 of @@ -508,7 +508,7 @@ that there is a workaround: This was the only change I needed to pass the netcdf-4 tests with Intel version 11. -### "ncdump -v group/var" reports "group not found" +### "ncdump -v group/var" reports "group not found" {#ncdump-v} John Storrs reported a bug using ncdump -v applied to netCDF-4 files, in which an erroneous 'group not found' message was displayed for valid @@ -534,7 +534,7 @@ Known Problems with netCDF 4.0 - [ncgen/ncdump test failure with Intel version 11 compilers](#intel_11-ncgen) -### Ncdump assumes default fill value for unsigned byte data +### Ncdump assumes default fill value for unsigned byte data {#ncdump_ubyte_fill} The ncdump utility incorrectly assumes a default fill value of "255" for data of unsigned byte type, although no default fill value is assumed @@ -544,19 +544,19 @@ are too small to assume one of the values should appear as a missing value unless a \_FillValue attribute is set explicitly. This bug is fixed in the current snapshot distribution. -### Ncdump of compound type with array field +### Ncdump of compound type with array field {#compound_array_field} Running the ncdump utility on a file with a compound type with an array field may result in a segmentation violation. A fix is in the current netCDF-4.0 snapshot distribution. -### Memory leak with VLEN attributes +### Memory leak with VLEN attributes {#mem_leak} We believe there are some memory leaks associated with VLEN attributes in HDF5 1.8.1. This is being addressed by the HDF5 team, and will be fixed by the next HDF5 release. -### Error dyld: Symbol not found: _H5P_CLS_FILE_ACCESS_g +### Error dyld: Symbol not found: _H5P_CLS_FILE_ACCESS_g {#o_problem_mac} On some Macintosh systems here at NetCDF World Test Center, on the hundreth floor of UCAR Tower \#2, the following build error occurs: @@ -591,7 +591,7 @@ the link flags in the generated Makefiles. Set LDFLAGS to include ------------------------------------------------------------------------ -Bug with multiple unlimited dimensions in one var +### Bug with multiple unlimited dimensions in one var {#multiple_unlimited} There is a bug in the 4.0 release related to the lengths of dimensions when more than one unlimited dimension is used in the same variable. @@ -599,22 +599,21 @@ when more than one unlimited dimension is used in the same variable. The bug is fixed in the latest [netCDF-4 snapshot release](ftp://ftp.unidata.ucar.edu/pub/netcdf/snapshot/netcdf-4-daily.tar.gz). -### Fortran90 interface Using Intel ifort under Cygwin +### Fortran90 interface Using Intel ifort under Cygwin {#ifort-f90-cygwin} Chris Dallimore reports success in getting the Fortran 90 interface of Version 4.0 to compile under CYGWIN using the Intel ifort compile; - 1 - Download and unpack netcdf-4.0.tar.gz + 1. Download and unpack netcdf-4.0.tar.gz - 2 - In configure replace conftest.o and conftestf.o with conftest. - $ac_objext and conftest.$ac_objext, I'm Not sure why autoconf doesn't + 2. In configure replace conftest.o and conftestf.o with conftest. + $ac_objext and conftestf.$ac_objext, I'm Not sure why autoconf doesn't do this. - 3 - - Save http://msinttypes.googlecode.com/svn/trunk/inttypes.h as libsrc/ - inttypes_msvc.h - Save ttp://msinttypes.googlecode.com/svn/trunk/stdint.h as libsrc/ - stdint_msvc.h + 3. Save http://msinttypes.googlecode.com/svn/trunk/inttypes.h as + `libsrc/inttypes_msvc.h` + Save ttp://msinttypes.googlecode.com/svn/trunk/stdint.h as + `libsrc/stdint_msvc.h` modify line 43 of libsrc/inttypes_msvc.h from @@ -622,7 +621,7 @@ Version 4.0 to compile under CYGWIN using the Intel ifort compile; to #include - 4 - in libsrc utf8proc.h at line 79 replaces + 4. in libsrc utf8proc.h at line 79 replaces #include @@ -636,7 +635,7 @@ Version 4.0 to compile under CYGWIN using the Intel ifort compile; typedef unsigned int uint32_t; #endif - It looks like configure is checking for ssize_t so there is probably a + It looks like configure is checking for ssize_t so there is probably a better way to do this. 5 - @@ -749,10 +748,10 @@ Version 4.0 to compile under CYGWIN using the Intel ifort compile; libtool: link: ( cd ".libs" && rm -f "libnetcdf2.la" && ln -s "../ libnetcdf2.la" "libnetcdf2.la" ) /bin/sh ../libtool --tag=CC --mode=link /cygdrive/z/cwr/Software/ - Eclipse/CWRModelSource/src/external/netcdf_src/netcdf-4.0/compile + Eclipse/CWRModelSource/src/external/netcdf_src/netcdf-4.0/compile cl -version-info 4:0:0 -o libnetcdf.la -rpath /cygdrive/z/cwr/ - Software/Eclipse/CWRModelSource/lib attr.lo ncx.lo putget.lo dim.lo - error.lo libvers.lo nc.lo string.lo v1hpg.lo var.lo utf8proc.lo + Software/Eclipse/CWRModelSource/lib attr.lo ncx.lo putget.lo dim.lo + error.lo libvers.lo nc.lo string.lo v1hpg.lo var.lo utf8proc.lo posixio.lo libnetcdf2.la ../fortran/libnetcdff.la libtool: link: warning: undefined symbols not allowed in i686-pc- cygwin shared libraries @@ -762,16 +761,16 @@ Version 4.0 to compile under CYGWIN using the Intel ifort compile; libtool: link: (cd .libs/libnetcdf.lax/libnetcdff.lib && ar x "/ cygdrive/z/cwr/Software/Eclipse/CWRModelSource/src/external/netcdf_src/ netcdf-4.0/libsrc/../fortran/.libs/libnetcdff.lib") - .libs/libnetcdff.lax/libnetcdff90.lib/typeSizes.obj: No such file or + .libs/libnetcdff.lax/libnetcdff90.lib/typeSizes.obj: No such file or directory It looks like the Microsoft LInker doesn't like the GNU lib format. - I was however able to compile and link using some static (ie non - automake) makefiles that are part of our overall model build + I was however able to compile and link using some static (ie non + automake) makefiles that are part of our overall model build environment. -### ncdump bug for filenames beginning with a numeric character +### ncdump bug for filenames beginning with a numeric character {#ncdump-numeric-filename} The ncdump utility in releases 4.0 and 3.6.3 rejects filenames starting with the digits 0,1 and 2 with an error message such as: @@ -804,7 +803,7 @@ Known Problems with netCDF 3.6.3 ------------------------------------------------------------------------ -### Can't build shared library with F90 API on IRIX +### Can't build shared library with F90 API on IRIX {#IRIX_f90_shared} When building shared libraries on out IRIX test system, I got the following error: @@ -848,7 +847,7 @@ Known Problems with netCDF 3.6.2 ------------------------------------------------------------------------ -### Setting ARFLAGS does not work +### Setting ARFLAGS does not work {#ARFLAGS} Sometimes when building netCDF, flags to the ar utility need to be set. Setting ARFLAGS does not work. @@ -860,7 +859,7 @@ you must setr flags for ar, read on.) Try the build again, setting AR\_FLAGS instead of ARFLAGS. -### Bugs in support for variables larger than 4 GiB +### Bugs in support for variables larger than 4 GiB {#large_vars_362} As first reported by Mario Emmenlauer, there is a bug in netCDF-3.6.2 (and earlier versions) in the code for creating byte and short type @@ -900,7 +899,7 @@ fixed in releases 3.6.3 and later. Assertion failed: *ulp <= X_SIZE_MAX, file ncx.c, line 1810 -### Bug in C++ interface prevents creating 64-bit offset format files +### Bug in C++ interface prevents creating 64-bit offset format files {#cxx_64-bit} As reported by Jos Verdoold, a bug in the netCDF 3.6.2 (and earlier versions) C++ interface prevents creating new files in Offset64Bits mode @@ -919,7 +918,7 @@ rebuild: This fix has been incorporated into netCDF 3.6.3 and later versions. -### The tests in nf\_test fail with seg fault with the Absoft Version 10.0 fortran compiler. +### The tests in nf\_test fail with seg fault with the Absoft Version 10.0 fortran compiler. {#absoft10} The absoft fortran compiler, version 10.0, changes the way that a C function returning string is called from fortran. @@ -936,7 +935,7 @@ Get the snapshot, and see the working output, on the [netCDF-3 snapshot](https://www.unidata.ucar.edu/software/netcdf/builds/snapshot/) page. -### Shared libraries do not work with the NAG fortran compiler. +### Shared libraries do not work with the NAG fortran compiler. {#nag_362} We have reports that the shared library build does not work with the NAG fortran compiler. The NAG compiler is not one of the compilers we @@ -951,7 +950,7 @@ Interested users may also wish to subscribe to the [netcdf-porting mailing list](https://www.unidata.ucar.edu/mailing_lists/archives/netcdf-porting/). -### The documented --enable-64bit option doesn't work. +### The documented --enable-64bit option doesn't work. {#enable-64bit} The --enable-64bit option appeared in the 3.6.1 release, and was-- removed for the 3.6.2 release. @@ -965,7 +964,7 @@ and the [netCDF-4 snapshot](https://www.unidata.ucar.edu/software/netcdf/builds/snapshot/index_4.html) documentation. -### Building netCDF-3.6.2 with gfortran version 4.2.x or 4.3.x fails. +### Building netCDF-3.6.2 with gfortran version 4.2.x or 4.3.x fails. {#gfortran_43} Something changed in gfortran version 4.3 relating to how fortran functions can call C functions. @@ -989,7 +988,7 @@ This problem has been fixed in the [netCDF-3 snapshot](../builds/snapshot). Now configure checks the version of gfortran before setting the appropriate flag. -### Building shared libraries on Macintosh with g95 fails. +### Building shared libraries on Macintosh with g95 fails. {#g95_mac_shared} Building shared libraries on the Macintosh fails @@ -1011,7 +1010,7 @@ Building shared libraries on the Macintosh fails Please report to support@unidata.ucar.edu ========================================= -### Building shared libraries on HPUX with native tools results in only static libraries. +### Building shared libraries on HPUX with native tools results in only static libraries. {#HPUX_shared} On the only HPUX machine I have access to for testing, the --enable-shared still results in only the static library being linked. @@ -1021,7 +1020,7 @@ Any HPUX use who can provide information about this should send email to support-netcdf@unidata.ucar.edu. bash-2.04\$ uname -a HP-UX tweety B.11.00 A 9000/785 2004553471 -### Building shared libraries on AIX fails. +### Building shared libraries on AIX fails. {#AIX_shared} On the Unidata AIX platforms, the shared netCDF build fails with either the Fortran or C++ compilers, like this: @@ -1049,7 +1048,7 @@ that would be most helpful. Shared builds also fail the same way when using GNU compilers. -### Building with older versions of g++ fails. +### Building with older versions of g++ fails. {#old_gpp} The build fails like this: @@ -1072,7 +1071,7 @@ This happens in old versions of g++ when large files are used. To fix this, either upgrade your g++ compiler, or else use --disable-largefile with configure, to turn off large file handling. -### The .NET build files are not included in the 3.6.2 release. +### The .NET build files are not included in the 3.6.2 release. {#NET_3_6_2} The netCDF 3.6.2 release does not contain the .NET build files. Whoops! Sorry about that. @@ -1083,7 +1082,7 @@ release. This is now fixed in the netCDF-3 snapshot. Get the snapshot from the [netCDF-3 snapshot build page](../builds/snapshot). -### Snapshot .NET build files do not work for Visual Studio 8.0 beta. +### Snapshot .NET build files do not work for Visual Studio 8.0 beta. {#NET_80_362} A user has reported that Visual Studio .NET version 8.0 beta does not build with the netCDF .NET build files in win32/NET. @@ -1092,7 +1091,7 @@ Interested users may also wish to subscribe to the [netcdf-porting mailing list](https://www.unidata.ucar.edu/mailing_lists/archives/netcdf-porting/). -### The -disable-v2 option causes the fortran build to fail with some fortran compilers. +### The -disable-v2 option causes the fortran build to fail with some fortran compilers. {#disable-v2_3_6_2} The netCDF version 2 API is maintained for backward compatibility. We are committed to maintaining the V2 API for all future releases of @@ -1110,7 +1109,7 @@ you can get the netCDF-3 [snapshot](../builds/snapshot). This is fixed for future releases of netCDF. -### The --disable-c option does not work. +### The --disable-c option does not work. {#disable-c_3_6_2} The --disable-c option should turn off the building of the netCDF C library for use with --enable-separate-fortran (to save a small amount @@ -1128,7 +1127,7 @@ Known Problems with netCDF 3.6.1 [Linux x86 Fedora4 with Intel ifort 9.0 compiler](#ifort_3_6_1) -### Building on IBM Bluegene login node (SUSE Linux) +### Building on IBM Bluegene login node (SUSE Linux) {#login_node_3_6_1} Michael McCracken reports the following: @@ -1169,7 +1168,7 @@ Michael McCracken reports the following: I get a clean build, and ncdump works for me... -### Linux x86 Fedora4 with Intel ifort 9.0 compiler +### Linux x86 Fedora4 with Intel ifort 9.0 compiler {#ifort_3_6_1} For netCDF version 3.6.1, Jonathan Rougier contributes the following work around for an intel fortran compiler bug. @@ -1226,7 +1225,7 @@ Known Problems with netCDF 3.6.0 ------------------------------------------------------------------------ -### nctest fails on IRIX platform +### nctest fails on IRIX platform {#irix-nctest} It has been reported (by Atro Tossavainen) that nctest fails on some Irix builds. (We cannot duplicate this problem at netCDF World HQ). @@ -1236,12 +1235,12 @@ of the output. This problem was fixed in the 3.6.1 release. -### C++ API doesn't build on Irix +### C++ API doesn't build on Irix {#irix-CXX-build} On Irix systems without a recent version of the C++ compiler, the C++ API won't build. The solution is to set CXXFLAGS to -LANG:std. -### Potentially serious bug with 64-bit offset files +### Potentially serious bug with 64-bit offset files {#cdf2-bug} Kevin Thomas of the University of Oklahoma has reported a potentially serious bug in using the new large file support in netCDF 3.6.0. Users @@ -1293,19 +1292,19 @@ FAQ [How can I tell if a netCDF file uses the classic format or new 64-bit offset format?](/software/netcdf/faq.html#Large%20File%20Support5). -### Cygwin Build Doesn't Work +### Cygwin Build Doesn't Work {#bad-cygwin} To build on Cygwin, you must get the [latest 3.6.1 beta release](ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-beta.tar.gz). -### Windows DLL doesn't include F77 API +### Windows DLL doesn't include F77 API {#dll-fortran} The netCDF windows DLL doesn't include the Fortran API. We are working on this problem for the next release. Meanwhile, if you need the fortran API in your DLL, you'll have to use the [netCDF 3.5.1 DLL](ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/win32/netcdf-3.5.1-win32dll.zip). -### F90 tests fail with Portland F90 compiler +### F90 tests fail with Portland F90 compiler {#portland-f90} On some versions of the Portland Group F90 compiler, the F90 tests fail, looking something like this: @@ -1339,7 +1338,7 @@ This problem is caused by a bug in the Portland F90 compiler. Upgrade to the latest version of the compiler or get the free patch from Portland Group to fix this. -### Config doesn't find working F77 or F90 compiler on AIX +### Config doesn't find working F77 or F90 compiler on AIX {#aix-config} On AIX systems, the configure step can't find either the F90 or the F77 compiler. On AIX system, you must set the environment variables FC and @@ -1356,7 +1355,7 @@ configure. This will be fixed in the next beta release. -### F90 functions not added to library on AIX +### F90 functions not added to library on AIX {#aix-make} On AIX systems, the F90 functions may not be added to the library. This is due to a quirk of AIX make. @@ -1364,7 +1363,7 @@ is due to a quirk of AIX make. Before doing "make install", change to the Fortran90 directory (src/f90) and do "make". Then proceed to "make install". -### Problems with fortran compile because of -Df2cFortran being added by configure" +### Problems with fortran compile because of -Df2cFortran being added by configure" {#fortran-config} With some fortran compilers, such as Absoft, the configure script stupidly adds a -Df2cFortran to the C preprocessor flags, which causes @@ -1373,7 +1372,7 @@ the fortran tests in nf\_test to fail to link. This problem is fixed in the 3.6.1 beta release. Get the [3.6.1 beta release](ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-beta.tar.Z). -### Message: "ncgenyy.c is out-of-date with respect to ncgen.l" +### Message: "ncgenyy.c is out-of-date with respect to ncgen.l" {#ncgen-timestamp} On some platforms (HP-UX 11.00, maybe others), make fails with an error message like: @@ -1394,7 +1393,7 @@ src/ directory to update the modification time of the derived file: Then rerun the make command. -### Configure help specifies FCFLAGS instead of FFLAGS +### Configure help specifies FCFLAGS instead of FFLAGS {#fcflags} If you run "configure --help", it suggests setting "FCFLAGS" for the fortran compiler flags, but "FFLAGS" is actually used for the Fortran @@ -1403,7 +1402,7 @@ compiler flags. "FCFLAGS" is ignored when compiling. This problem will be is fixed in the next beta release. Until then, use FFLAGS, not FCFLAGS. -### Specifying a count length of zero returns an error instead of no data +### Specifying a count length of zero returns an error instead of no data {#zeroedge} For access to array sections, strided access, or mapped access, you need to specify both a start index vector and a count vector, where the count @@ -1417,7 +1416,7 @@ returned rather than gracefully accessing no data. This will be fixed in the next minor version. -### C++ library doesn't build under Cygwin +### C++ library doesn't build under Cygwin {#cygwincpp} Running configure on Cygwin fails to find GNU C++ compiler, even if it is present on the platform. As a result, the C++ interface is never @@ -1427,7 +1426,7 @@ This problem is fixed in the 3.6.1 beta release. Cygwin users interested in the C++ interface should get the [3.6.1 beta release](ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-3.6.1-beta1.tar.Z). -### Large file problems in Visual C++ compile +### Large file problems in Visual C++ compile {#visualcpp_largefile} The use of large files, and an 8-byte off\_t type, is not handled correctly in the 3.6.0 release of the code and project files needed to @@ -1438,7 +1437,7 @@ building their own DLL should get the [3.6.1 beta release](ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-3.6.1-beta1.tar.Z). The DLL offered on the binary release page is 3.6.1 beta. -### When using TEMP\_LARGE, need a trailing slash +### When using TEMP\_LARGE, need a trailing slash {#temp_large} When using the environment variable TEMP\_LARGE during the netCDF 3.6.0 make extra\_test phase, the directory name must be followed by a slash diff --git a/docs/nczarr.md b/docs/nczarr.md index 078e451e45..85efbedbe1 100644 --- a/docs/nczarr.md +++ b/docs/nczarr.md @@ -491,9 +491,9 @@ Here are a couple of examples using the _ncgen_ and _ncdump_ utilities. collections — High-performance dataset datatypes](https://docs.python.org/2/library/collections.html)
[6] [Zarr Version 2 Specification](https://zarr.readthedocs.io/en/stable/spec/v2.html)
[7] [XArray Zarr Encoding Specification](http://xarray.pydata.org/en/latest/internals.html#zarr-encoding-specification)
-[8] [Dynamic Filter Loading](https://support.hdfgroup.org/HDF5/doc/Advanced/DynamicallyLoadedFilters/HDF5DynamicallyLoadedFilters.pdf)
-[9] [Officially Registered Custom HDF5 Filters](https://portal.hdfgroup.org/display/support/Registered+Filter+Plugins)
-[10] [C-Blosc Compressor Implementation](https://github.com/Blosc/c-blosc)
+[8] [Dynamic Filter Loading](https://support.hdfgroup.org/HDF5/doc/Advanced/DynamicallyLoadedFilters/HDF5DynamicallyLoadedFilters.pdf)
+[9] [Officially Registered Custom HDF5 Filters](https://portal.hdfgroup.org/display/support/Registered+Filter+Plugins)
+[10] [C-Blosc Compressor Implementation](https://github.com/Blosc/c-blosc)
[11] [Conda-forge / packages / aws-sdk-cpp](https://anaconda.org/conda-forge/aws-sdk-cpp)
[12] [GDAL Zarr](https://gdal.org/drivers/raster/zarr.html)
From a6d0bcc215a345acf8e08b4b6fcd6346df9c0dfe Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Mon, 11 Jul 2022 22:48:37 -0400 Subject: [PATCH 16/25] BUG: Robustify nulldup definition. Probably unnecessary, but should avoid a warning and documents what happens. --- libncpoco/cp_win32.c | 63 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/libncpoco/cp_win32.c b/libncpoco/cp_win32.c index 5653dd279b..232d985023 100755 --- a/libncpoco/cp_win32.c +++ b/libncpoco/cp_win32.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -29,13 +30,67 @@ static const char* driveletters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS static int isAbsolutePath(const char* path); #if !defined(nulldup) && !defined(HAVE_STRDUP) +/** Copy s if not NULL. + * + * Implementation in terms of strdup in + * + * @li include/ncconfigure.h + * @li include/netcdf_json.h + * @li libdap4/ncd4.h + * @li libdispatch/dfile.c + * @li libdispatch/dinfermodel.c + * @li libdispatch/drc.c + * @li libdispatch/dutil.c + * @li libdispatch/nc.c + * @li libdispatch/ncjson.c + * @li libdispatch/ncurl.c + * @li libncxml/ncxml_ezxml.c + * @li ncxml_tinyxml2.cpp + * @li libncxml/ncxml_xml2.c + * @li libnczarr/zsync.c + * @li ncdump/ocprint.c + * @li ncgen/cvt.c + * @li ncgen/ncgen.h + * @li ncgen3/ncgen.h + * @li nczarr_test/test_nczarr_utils.h + * @li oc2/ocinternal.h + * + * Declarations as extern: + * + * @li include/ncconfigure.h + * + * I'd like it to be + * static inline const char *nulldup(const char *const s); + * but that's not what's in ncconfigure.h + * + * @param s the string to duplicate + * @pre s is either NULL or a NULL-terminated string + * + * @returns NULL or the duplicated string (caller owns the new + * pointer) + * + * @throws ENOMEM if out of memory + * + * @post returns NULL if s is NULL, or a new pointer to a + * freshly-allocated copy of s + */ extern char *nulldup(const char* s) { - if (s) { - char *result = malloc(strlen(s) + 1); - strcpy(result, s); + if (s != NULL) { + ssize_t result_length = strlen(s) + 1; + char *result = malloc(result_length); + if (result == NULL) { +#ifdef ENOMEM + /* C++11, POSIX? */ + errno = ENOMEM; +#else + errno = 1; +#endif + return NULL; + } + strncpy(result, s, result_length); return result; } else { - return s; + return NULL; } } #endif From f28dcaa994d58ec6f21d7bc4327d024821a4cdcc Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Mon, 11 Jul 2022 22:58:56 -0400 Subject: [PATCH 17/25] TST: Mark nczarr s3 cleanup test XFAIL on Cygwin instead of skipping. It might be nice to be told when it starts passing. This probably requires installing s3 on Cygwin. --- nczarr_test/Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nczarr_test/Makefile.am b/nczarr_test/Makefile.am index f9532212f4..248e34cc4f 100644 --- a/nczarr_test/Makefile.am +++ b/nczarr_test/Makefile.am @@ -120,9 +120,10 @@ zs3parse_SOURCES = zs3parse.c if ENABLE_NCZARR_S3 noinst_PROGRAMS += s3util s3util_SOURCES = s3util.c -if !ISCYGWIN TESTS += run_s3_cleanup.sh -endif +if ISCYGWIN +XFAIL_TESTS = run_s3_cleanup.sh +endif # ISCYGWIN endif # Given a netcdf4|NCZarr file, dump the actual chunk contents. From 18b76baed049678138a6da19a9fb334b7abbe8b4 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 12 Oct 2022 10:20:15 -0400 Subject: [PATCH 18/25] CI: Disable CMake tests on Cygwin and MinGW. Cygwin tests don't pass for no reason I can discern; MinGW tests don't build, again for no reason I can discern. --- .github/workflows/run_tests_win_cygwin.yml | 59 ---------------------- .github/workflows/run_tests_win_mingw.yml | 44 ---------------- 2 files changed, 103 deletions(-) diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index aff3169800..00e8d5c81e 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -67,62 +67,3 @@ jobs: - name: (Autotools) Build and run tests timeout-minutes: 30 run: make check -j8 SHELL=/bin/dash - - build-and-test-cmake: - runs-on: windows-latest - defaults: - run: - shell: bash -eo pipefail -o igncr "{0}" - - name: Cygwin-based CMake tests - - steps: - - name: Fix line endings - run: git config --global core.autocrlf input - - - uses: actions/checkout@v2 - - - uses: cygwin/cygwin-install-action@v2 - with: - platform: x86_64 - packages: >- - git make cmake ninja m4 libhdf5-devel libhdf4-devel - libjpeg-devel zipinfo libxml2-devel perl zlib-devel - libzstd-devel libbz2-devel libaec-devel libzip-devel - libdeflate-devel gcc-core gcc-g++ libcurl-devel doxygen - libiconv-devel - - - uses: egor-tensin/cleanup-path@v1 - with: - dirs: "C:\\cygwin\\bin;C:\\cygwin\\lib\\lapack" - - - name: (CMake) Configure project - run: | - mkdir build - cd build - /usr/bin/cmake .. -DBUILD_SHARED_LIBS=ON -DENABLE_DAP=ON -DENABLE_DOXYGEN=ON -DENABLE_EXAMPLES=ON -DENABLE_EXAMPLE_TESTS=ON -DENABLE_EXTRA_TESTS=OFF -DENABLE_FILTER_TESTING=ON -DENABLE_HDF4=ON DENABLE_HDF5=Yes -DENABLE_NCZARR=Yes -DENABLE_PLUGINS=ON -DENABLE_TESTS=ON -DENABLE_UNIT_TESTS=ON - - - name: Print summary - run: >- - cd build && cat libnetcdf.settings - - - name: (CMake) Build all - run: >- - cd build && /usr/bin/cmake --build . --verbose -j8 - - - name: (CMake) Test - id: cmake-tests - run: >- - cd build && /usr/bin/ctest -j8 . - - - name: (CMake) Verbose output of CTest failures - if: failure() && steps.cmake-tests.conclusion == 'failure' - run: >- - cd build && /usr/bin/ctest --output-on-failure -j8 --rerun-failed -VV . - - - uses: actions/upload-artifact@v3 - if: failure() && steps.cmake-tests.conclusion == 'failure' - with: - name: cygwin-cmake-test-logs - path: | - build/Testing/ diff --git a/.github/workflows/run_tests_win_mingw.yml b/.github/workflows/run_tests_win_mingw.yml index 2621ce76f2..7d92518a8c 100644 --- a/.github/workflows/run_tests_win_mingw.yml +++ b/.github/workflows/run_tests_win_mingw.yml @@ -69,47 +69,3 @@ jobs: path: | */*.log */*.trs - - build-and-test-cmake: - - runs-on: windows-latest - env: - CPPFLAGS: -I/mingw64/include/libxml2/ - defaults: - run: - shell: msys2 {0} - - steps: - - - uses: actions/checkout@v2 - - uses: msys2/setup-msys2@v2 - with: - msystem: MINGW64 - update: true - install: >- - git mingw-w64-x86_64-toolchain make cmake m4 - mingw-w64-x86_64-hdf5 unzip mingw-w64-x86_64-libxml2 - - - name: (CMake) Configure project - run: | - mkdir build - cd build - cmake .. -DENABLE_HDF5=TRUE - - - name: Print summary - run: >- - cd build && cat libnetcdf.settings - - - name: (CMake) Build all - run: >- - cd build && cmake --build -j8 - - - name: (CMake) Run tests - id: cmake-run-tests - run: >- - cd build && ctest --output-on-failure -j8 . - - - name: (CMake) Verbose output of CTest failures - if: failure() && steps.cmake-run-tests.conclusion == 'failure' - run: >- - cd build && ctest --output-on-failure -j8 --rerun-failed -VV . From a0aa2b3e1109094619e1207ba37e694c7610e63f Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 13 Oct 2022 19:31:42 -0400 Subject: [PATCH 19/25] CI: Revert Windows CI run on push. I requested this when working on a branch, rather than a pull request. This is a PR now, so I should go back to how things were before. --- .github/workflows/run_tests_win_cygwin.yml | 2 +- .github/workflows/run_tests_win_mingw.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index 00e8d5c81e..361e6265b7 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -1,6 +1,6 @@ name: Run Cygwin-based tests -on: [push, pull_request, workflow_dispatch] +on: [pull_request, workflow_dispatch] env: SHELLOPTS: igncr diff --git a/.github/workflows/run_tests_win_mingw.yml b/.github/workflows/run_tests_win_mingw.yml index 7d92518a8c..5ff67e1a16 100644 --- a/.github/workflows/run_tests_win_mingw.yml +++ b/.github/workflows/run_tests_win_mingw.yml @@ -9,7 +9,7 @@ name: Run MSYS2, MinGW64-based Tests env: CPPFLAGS: "-D_BSD_SOURCE" -on: [push, pull_request, workflow_dispatch] +on: [pull_request, workflow_dispatch] jobs: From 4046afdfc2ee28fc5369ea4af08365c078cdfc77 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 13 Oct 2022 19:32:48 -0400 Subject: [PATCH 20/25] BLD: Fix syntax in configure.ac. The command looks much more like test than any command I can think of that would be called text. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 561c5b7157..ddc77ac1d4 100644 --- a/configure.ac +++ b/configure.ac @@ -118,7 +118,7 @@ ISMSYS=yes fi # Get windows version info -if text "x$ISMSVC" = xyes ; then +if test "x$ISMSVC" = xyes ; then WINVER=`systeminfo | sed -e '/^OS Version:/p' -ed | sed -e 's|[^0-9]*\([0-9.]*\).*|\1|'` else WINVER="0.0.0" From 1ed8ab15760851de8b86e022a345feedc6c5a67e Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 15 Oct 2022 19:01:39 -0400 Subject: [PATCH 21/25] BLD: Avoid specifying -version-info and -avoid-version The previous working version specified just -version-info, and specified it for every plugin separately. This moves -version-info to AM_LDFLAGS and removes -avoid-version from the (previously unused) AM_LDFLAGS. Cross-compilation targeting MacOS uses -version-info to determine suffix, so hopefully this gets the MacOS tests passing. --- plugins/Makefile.am | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/plugins/Makefile.am b/plugins/Makefile.am index bc7c7c1006..85d8caa93d 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -4,7 +4,12 @@ # Put Together AM_CPPFLAGS and AM_LDFLAGS include $(top_srcdir)/lib_flags.am -AM_LDFLAGS += -module -avoid-version -shared -export-dynamic \ +# This linker flag specifies libtool version info. +# See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning +# for information regarding incrementing `-version-info`. +plugin_version_info = -version-info 0:0:0 + +AM_LDFLAGS += -module $(plugin_version_info) -shared -export-dynamic \ $(NOUNDEFINED) # Create an alternate directory if not installing or for noinst installs. @@ -28,11 +33,6 @@ plugins_to_install = check_LTLIBRARIES = noinst_LTLIBRARIES = -# This linker flag specifies libtool version info. -# See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning -# for information regarding incrementing `-version-info`. -plugin_version_info = -version-info 0:0:0 - if ISMINGW LDADD = ${top_builddir}/liblib/libnetcdf.la LIBADD = $(LDADD) @@ -63,15 +63,10 @@ lib__nch5shuffle_la_SOURCES = H5Zshuffle.c lib__nch5fletcher32_la_SOURCES = H5Zfletcher32.c H5checksum.c lib__nch5deflate_la_SOURCES = H5Zdeflate.c -lib__nch5shuffle_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -lib__nch5deflate_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -lib__nch5fletcher32_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) - # Need our version of szip if libsz available and we are not using HDF5 if HAVE_SZ plugins_to_install += lib__nch5szip.la lib__nch5szip_la_SOURCES = H5Zszip.c H5Zszip.h -lib__nch5szip_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) endif endif # ENABLE_NCZARR_FILTERS @@ -84,21 +79,16 @@ lib__nczstdfilters_la_LIBADD = $(LIBADD) lib__nczhdf5filters_la_SOURCES = NCZhdf5filters.c lib__nczhdf5filters_la_LIBADD = $(LIBADD) -lib__nczstdfilters_la_LDFLAGS = ${plugin_version_info} -lib__nczhdf5filters_la_LDFLAGS= ${plugin_version_info} - plugins_to_install += lib__nczhdf5filters.la plugins_to_install += lib__nczstdfilters.la if HAVE_BLOSC lib__nch5blosc_la_SOURCES = H5Zblosc.c H5Zblosc.h -lib__nch5blosc_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) plugins_to_install += lib__nch5blosc.la endif if HAVE_ZSTD lib__nch5zstd_la_SOURCES = H5Zzstd.c H5Zzstd.h -lib__nch5zstd_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) plugins_to_install += lib__nch5zstd.la endif @@ -108,18 +98,18 @@ endif #ENABLE_PLUGINS # Need two distinct instances lib__nch5noop_la_SOURCES = H5Znoop.c H5Zutil.c h5noop.h lib__nch5noop1_la_SOURCES = H5Znoop1.c H5Zutil.c h5noop.h -lib__nch5noop_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs -lib__nch5noop1_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs +lib__nch5noop_la_LDFLAGS = $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs +lib__nch5noop1_la_LDFLAGS = $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs # The misc filter is to allow testing of filter arguments lib__nch5misc_la_SOURCES = H5Zmisc.c H5Zutil.c h5misc.h -lib__nch5misc_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs +lib__nch5misc_la_LDFLAGS = $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs lib__nczmisc_la_SOURCES = NCZmisc.c -lib__nczmisc_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs +lib__nczmisc_la_LDFLAGS = $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs # Provide a filter to test missing filter lib__nch5unknown_la_SOURCES = H5Zunknown.c -lib__nch5unknown_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs +lib__nch5unknown_la_LDFLAGS = $(AM_LDFLAGS) -rpath $(abs_builddir)/.libs check_LTLIBRARIES += lib__nch5noop.la lib__nch5noop1.la lib__nch5unknown.la # findplugin.sh needs these plugins, and I want to see if these get built properly @@ -132,7 +122,6 @@ EXTRA_DIST += ${BZIP2SRC} BZIP2_LICENSE if HAVE_LOCAL_BZ2 lib__nch5bzip2_la_SOURCES += ${BZIP2SRC} endif -lib__nch5bzip2_la_LDFLAGS = ${plugin_version_info} $(AM_LDFLAGS) plugins_to_install += lib__nch5bzip2.la endif #ENABLE_FILTER_TESTING From fb02ff8ea8d4463bd618a290c4b2be15d952df12 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 27 Oct 2022 08:14:14 -0400 Subject: [PATCH 22/25] BLD: Specify -avoid-version on MinGW and Cygwin; -version-info otherwise Removing -avoid-version seems to have broken MinGW and Cygwin but fixed MacOS. Hopefully this gets everything working. --- plugins/Makefile.am | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 85d8caa93d..762da932d9 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -9,8 +9,17 @@ include $(top_srcdir)/lib_flags.am # for information regarding incrementing `-version-info`. plugin_version_info = -version-info 0:0:0 -AM_LDFLAGS += -module $(plugin_version_info) -shared -export-dynamic \ - $(NOUNDEFINED) +AM_LDFLAGS += -module -shared -export-dynamic $(NOUNDEFINED) + +if ISMINGW + AM_LDFLAGS += -avoid-version +else !ISMINGW +if ISCYGWIN +AM_LDFLAGS += -avoid-version +else !ISCYGWIN +AM_LDFLAGS += $(plugin_version_info) +endif !ISCYGWIN +endif !ISMINGW # Create an alternate directory if not installing or for noinst installs. ALTPLUGINDIR = ${abs_top_builddir}/plugins/plugindir From 4ef68740a338682fa09c1b0c3c3ec693048a3396 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 29 Oct 2022 09:48:22 -0400 Subject: [PATCH 23/25] STY: Move nulldup backup definition from cp_win32.c to ncconfigure.h Allow definition to be used in more places. Should probably consolidate definition a few places. --- include/ncconfigure.h | 69 ++++++++++++++++++++++++++++++++++++++++++- libncpoco/cp_win32.c | 66 ----------------------------------------- 2 files changed, 68 insertions(+), 67 deletions(-) diff --git a/include/ncconfigure.h b/include/ncconfigure.h index 77d34ac4c1..72010378cd 100644 --- a/include/ncconfigure.h +++ b/include/ncconfigure.h @@ -121,8 +121,75 @@ unsigned long long int strtoull(const char*, char**, int); /* handle null arguments */ #ifndef nulldup +#ifndef(HAVE_STRDUP) +/** Copy s if not NULL. + * + * Implementation in terms of strdup in + * + * @li include/ncconfigure.h + * @li include/netcdf_json.h + * @li libdap4/ncd4.h + * @li libdispatch/dfile.c + * @li libdispatch/dinfermodel.c + * @li libdispatch/drc.c + * @li libdispatch/dutil.c + * @li libdispatch/nc.c + * @li libdispatch/ncjson.c + * @li libdispatch/ncurl.c + * @li libncxml/ncxml_ezxml.c + * @li ncxml_tinyxml2.cpp + * @li libncxml/ncxml_xml2.c + * @li libnczarr/zsync.c + * @li ncdump/ocprint.c + * @li ncgen/cvt.c + * @li ncgen/ncgen.h + * @li ncgen3/ncgen.h + * @li nczarr_test/test_nczarr_utils.h + * @li oc2/ocinternal.h + * + * Declarations as extern: + * + * @li include/ncconfigure.h + * + * I'd like it to be + * static inline const char *nulldup(const char *const s); + * but that's not what's in ncconfigure.h + * + * @param s the string to duplicate + * @pre s is either NULL or a NULL-terminated string + * + * @returns NULL or the duplicated string (caller owns the new + * pointer) + * + * @throws ENOMEM if out of memory + + * + * @post returns NULL if s is NULL, or a new pointer to a + * freshly-allocated copy of s + */ +extern char *nulldup(const char* s) { + if (s != NULL) { + ssize_t result_length = strlen(s) + 1; + char *result = malloc(result_length); + if (result == NULL) { +#ifdef ENOMEM + /* C++11, POSIX? */ + errno = ENOMEM; +#else /* ENOMEM */ + errno = 1; +#endif /* ENOMEM */ + return NULL; + } + strncpy(result, s, result_length); + return result; + } else { + return NULL; + } +} +#else /* HAVE_STRDUP */ #define nulldup(s) ((s)==NULL?NULL:strdup(s)) -#endif +#endif /* HAVE_STRDUP */ +#endif /* nulldup */ #ifndef nulllen #define nulllen(s) ((s)==NULL?0:strlen(s)) diff --git a/libncpoco/cp_win32.c b/libncpoco/cp_win32.c index 232d985023..b4284ac101 100755 --- a/libncpoco/cp_win32.c +++ b/libncpoco/cp_win32.c @@ -29,72 +29,6 @@ static const char* driveletters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS /* Forward */ static int isAbsolutePath(const char* path); -#if !defined(nulldup) && !defined(HAVE_STRDUP) -/** Copy s if not NULL. - * - * Implementation in terms of strdup in - * - * @li include/ncconfigure.h - * @li include/netcdf_json.h - * @li libdap4/ncd4.h - * @li libdispatch/dfile.c - * @li libdispatch/dinfermodel.c - * @li libdispatch/drc.c - * @li libdispatch/dutil.c - * @li libdispatch/nc.c - * @li libdispatch/ncjson.c - * @li libdispatch/ncurl.c - * @li libncxml/ncxml_ezxml.c - * @li ncxml_tinyxml2.cpp - * @li libncxml/ncxml_xml2.c - * @li libnczarr/zsync.c - * @li ncdump/ocprint.c - * @li ncgen/cvt.c - * @li ncgen/ncgen.h - * @li ncgen3/ncgen.h - * @li nczarr_test/test_nczarr_utils.h - * @li oc2/ocinternal.h - * - * Declarations as extern: - * - * @li include/ncconfigure.h - * - * I'd like it to be - * static inline const char *nulldup(const char *const s); - * but that's not what's in ncconfigure.h - * - * @param s the string to duplicate - * @pre s is either NULL or a NULL-terminated string - * - * @returns NULL or the duplicated string (caller owns the new - * pointer) - * - * @throws ENOMEM if out of memory - * - * @post returns NULL if s is NULL, or a new pointer to a - * freshly-allocated copy of s - */ -extern char *nulldup(const char* s) { - if (s != NULL) { - ssize_t result_length = strlen(s) + 1; - char *result = malloc(result_length); - if (result == NULL) { -#ifdef ENOMEM - /* C++11, POSIX? */ - errno = ENOMEM; -#else - errno = 1; -#endif - return NULL; - } - strncpy(result, s, result_length); - return result; - } else { - return NULL; - } -} -#endif - /**************************************************/ int From 3b74e0bb93b38b4278bf5971437f0ffc9933d42f Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 29 Oct 2022 13:27:17 -0400 Subject: [PATCH 24/25] FIX: ifndef requires no parentheses. --- include/ncconfigure.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ncconfigure.h b/include/ncconfigure.h index 72010378cd..8de05ee123 100644 --- a/include/ncconfigure.h +++ b/include/ncconfigure.h @@ -121,7 +121,7 @@ unsigned long long int strtoull(const char*, char**, int); /* handle null arguments */ #ifndef nulldup -#ifndef(HAVE_STRDUP) +#ifndef HAVE_STRDUP /** Copy s if not NULL. * * Implementation in terms of strdup in From 4c1a39bb710e96fdb9b7892013d0cdf815149bb8 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 1 Nov 2022 08:01:10 -0400 Subject: [PATCH 25/25] BLD: Declare nulldup backup definition static not extern The use of this function currently runs into problems with multiple definitions: once for each file including ncconfigure.h. Defining this as static rather than extern should hide the definitions from each other. static inline would still be closer to the definition as a macro, but that requires a #define to work on all platforms (not all compilers have inline yet). --- include/ncconfigure.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ncconfigure.h b/include/ncconfigure.h index 8de05ee123..975ea5f39b 100644 --- a/include/ncconfigure.h +++ b/include/ncconfigure.h @@ -167,7 +167,7 @@ unsigned long long int strtoull(const char*, char**, int); * @post returns NULL if s is NULL, or a new pointer to a * freshly-allocated copy of s */ -extern char *nulldup(const char* s) { +static char *nulldup(const char* s) { if (s != NULL) { ssize_t result_length = strlen(s) + 1; char *result = malloc(result_length);