Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MSYS2/Mingw platform #2171

Merged
merged 3 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/mingw.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: NetCDF-Build MinGW
on: [workflow_dispatch]

jobs:
build:
runs-on: windows-latest
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 automake libtool autoconf make mingw-w64-x86_64-hdf5 unzip
- name: CI-Build
shell: msys2 {0}
run: |
echo 'Running in MSYS2!'
set -e
pwd
git clone --single-branch --branch moreosfixes.tmp https://github.com/DennisHeimbigner/netcdf-c.git
cd netcdf-c
autoreconf -i --force
./configure --prefix=/builddir -enable-shared --disable-static --disable-plugins --disable-logging --disable-dap-remote-tests --disable-byterange
make -j LDFLAGS="-no-undefined -Wl,--export-all-symbols"
make check

6 changes: 3 additions & 3 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ jobs:
shell: bash -l {0}
run: |
cd build
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest -j 12 .
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest --verbose -j 12 .
if: ${{ success() }}

- name: Verbose Output if CTest Failure
Expand Down Expand Up @@ -312,7 +312,7 @@ jobs:

- name: Configure
shell: bash -l {0}
run: CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./configure --enable-hdf4 --enable-hdf5 --enable-dap --enable-dap-long-tests
run: CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./configure --enable-hdf4 --enable-hdf5 --enable-dap --disable-dap-remote-tests
if: ${{ success() }}

- name: Look at config.log if error
Expand Down Expand Up @@ -410,7 +410,7 @@ jobs:
shell: bash -l {0}
run: |
cd build
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest -j 12 .
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest --output-on-failure -j 12 .
if: ${{ success() }}

- name: Verbose Output if CTest Failure
Expand Down
31 changes: 24 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,6 @@ ENDIF()

# Option to Enable DAP long tests, remote tests.
OPTION(ENABLE_DAP_REMOTE_TESTS "Enable DAP remote tests." ON)

OPTION(ENABLE_DAP_LONG_TESTS "Enable DAP long tests." OFF)
SET(REMOTETESTSERVERS "remotetest.unidata.ucar.edu" CACHE STRING "test servers to use for remote test")

Expand Down Expand Up @@ -1092,12 +1091,19 @@ ELSE()
ENDIF()

# libdl is always available; built-in in Windows and OSX
SET(ENABLE_PLUGINS TRUE)
IF(NOT WIN32)
IF(HAVE_DLFCN_H)
INCLUDE_DIRECTORIES("dlfcn.h")
OPTION(ENABLE_PLUGINS "Enable dynamically loaded plugins (default on)." ON)
IF(MINGW)
SET(ENABLE_PLUGINS OFF CACHE BOOL "Disable plugins" FORCE)
ELSE()
IF(NOT WIN32)
IF(HAVE_DLFCN_H)
INCLUDE_DIRECTORIES("dlfcn.h")
ENDIF()
ENDIF()
ENDIF()
IF(ENABLE_PLUGINS)
SET(USEPLUGINS yes)
ENDIF()

# Enable some developer-only tests
OPTION(ENABLE_EXTRA_TESTS "Enable Extra tests. Some may not work because of known issues. Developers only." OFF)
Expand Down Expand Up @@ -1488,6 +1494,16 @@ IF(NOT BUILD_SHARED_LIBS)
SET(ENABLE_FILTER_TESTING OFF)
ENDIF()

OPTION(ENABLE_NCZARR_FILTERS "Enable NCZarr filters" yes)
IF (NOT ENABLE_PLUGINS)
SET(ENABLE_NCZARR_FILTERS OFF CACHE BOOL "Enable NCZarr Filters." FORCE)
ENDIF()

OPTION(ENABLE_NCZARR_FILTERS_TESTING "Enable NCZarr filter testing." yes)
IF (NOT ENABLE_NCZARR_FILTERS)
SET(ENABLE_NCZARR_FILTER_TESTING OFF CACHE BOOL "Enable NCZarr Filter Testing" FORCE)
ENDIF()

SET(ENABLE_CLIENTSIDE_FILTERS OFF)

# Determine whether or not to generate documentation.
Expand All @@ -1497,9 +1513,9 @@ IF(ENABLE_DOXYGEN)
# Offer the option to build internal documentation.
OPTION(ENABLE_INTERNAL_DOCS "Build internal documentation. This is of interest to developers only." OFF)
IF(ENABLE_INTERNAL_DOCS)
SET(BUILD_INTERNAL_DOCS YES CACHE STRING "")
SET(BUILD_INTERNAL_DOCS yes CACHE STRING "")
ELSE()
SET(BUILD_INTERNAL_DOCS NO CACHE STRING "")
SET(BUILD_INTERNAL_DOCS no CACHE STRING "")
ENDIF()

###
Expand Down Expand Up @@ -2410,6 +2426,7 @@ configure_file(
SET(ISCMAKE "1")
IF(MSVC)
SET(ISMSVC "1")
SET(REGEDIT 1)
ENDIF()

####
Expand Down
9 changes: 6 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ ZARR = libnczarr
endif

# Optionally build test plugins
if ENABLE_PLUGINS
if ENABLE_FILTER_TESTING
PLUGIN_DIR = plugins
endif
endif

# If benchmarks were turned on, build and run a bunch more tests.
if BUILD_BENCHMARKS
Expand All @@ -105,18 +107,19 @@ endif # BUILD_BENCHMARKS

# Define Test directories
if BUILD_TESTSETS
TESTDIRS = $(UNIT_TEST) $(V2_TEST) nc_test $(NC_TEST4)
TESTDIRS = $(H5_TEST_DIR)
TESTDIRS += $(UNIT_TEST) $(V2_TEST) nc_test $(NC_TEST4)
TESTDIRS += $(BENCHMARKS_DIR) $(HDF4_TEST_DIR) $(NCDAP2TESTDIR) $(NCDAP4TESTDIR)
TESTDIRS += ${ZARR_TEST_DIR}
endif

# This is the list of subdirs for which Makefiles will be constructed
# and run. ncgen must come before ncdump, because their tests
# depend on it.
SUBDIRS = include $(H5_TEST_DIR) ${XML} libdispatch libsrc $(LIBSRC4_DIR) \
SUBDIRS = include ${XML} libdispatch libsrc $(LIBSRC4_DIR) \
$(LIBSRCP) $(LIBHDF4) $(LIBHDF5) $(OCLIB) $(DAP2) ${DAP4} \
${NCPOCO} ${ZARR} liblib \
$(NCGEN3) $(NCGEN) $(NCDUMP) ${PLUGIN_DIR} $(TESTDIRS) docs \
$(NCGEN3) $(NCGEN) $(NCDUMP) ${PLUGIN_DIR} $(TESTDIRS) docs \
$(EXAMPLES)

# Remove these generated files, for a distclean.
Expand Down
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This file contains a high-level description of this package's evolution. Release

## 4.8.2 - TBD

* [Enhancement] Improve support for msys2+mingw platform. See [Github #2171](https://github.com/Unidata/netcdf-c/pull/2171).
* [Bug Fix] Clean up the various inter-test dependencies in ncdump for CMake. See [Github #2168](https://github.com/Unidata/netcdf-c/pull/2168).
* [Enhancement] Added options to suppress the new behavior from [Github #2135](https://github.com/Unidata/netcdf-c/pull/2135). The options for `cmake` and `configure` are, respectively `-DENABLE_LIBXML2` and `--(enable/disable)-libxml2`. Both of these options defaul to 'on/enabled'. When disabled, the bundled `ezxml` XML interpreter is used regardless of whether `libxml2` is present on the system.
* [Enhancement] Support optional use of libxml2, otherwise default to ezxml. See [Github #2135](https://github.com/Unidata/netcdf-c/pull/2135) -- H/T to [Egbert Eich](https://github.com/e4t).
Expand Down
3 changes: 3 additions & 0 deletions config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ are set when opening a binary file on Windows. */
/* if true, Allow dynamically loaded plugins */
#cmakedefine ENABLE_PLUGINS 1

/* Do we have access to the Windows Registry */
#cmakedefine REGEDIT 1

/* define the possible sources for remote test servers */
#cmakedefine REMOTETESTSERVERS "${REMOTETESTSERVERS}"

Expand Down
71 changes: 49 additions & 22 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
AC_PREREQ([2.59])

# Initialize with name, version, and support email address.
AC_INIT([netCDF], [4.8.2-development], [[email protected]], [netcdf-c])
AC_INIT([netCDF],[4.8.2-development],[[email protected]],[netcdf-c])

##
# Prefer an empty CFLAGS variable instead of the default -g -O2.
Expand Down Expand Up @@ -93,6 +93,19 @@ AM_INIT_AUTOMAKE([foreign dist-zip subdir-objects])
# Check for the existence of this file before proceeding.
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;;
esac

if test "x$MSYSTEM" != x ; then
ISMINGW=yes
ISMSYS=yes
fi

AC_MSG_NOTICE([checking supported formats])

# An explicit disable of netcdf-4 | netcdf4 is treated as if it was disable-hdf5
Expand Down Expand Up @@ -521,7 +534,6 @@ CFLAGS="$SAVECFLAGS"

# --enable-dap => enable-dap4
enable_dap4=$enable_dap
# Default is to do the short remote tests.
AC_MSG_CHECKING([whether dap remote testing should be enabled])
AC_ARG_ENABLE([dap-remote-tests],
[AS_HELP_STRING([--enable-dap-remote-tests],
Expand Down Expand Up @@ -1180,14 +1192,23 @@ fi
AC_MSG_CHECKING([whether dynamically loaded plugins is enabled])
AC_ARG_ENABLE([plugins],
[AS_HELP_STRING([--disable-plugins],
[allow dynamically loaded plugins])])
if test "x$have_libdld" = xno ; then enable_plugins=no; fi
[disallow dynamically loaded plugins])])
test "x$enable_plugins" = xno || enable_plugins=yes
AC_MSG_RESULT($enable_plugins)
AC_MSG_RESULT([$enable_plugins])
if test "x$have_libdld" = xno && test "x$ISMSVC" = xno; then
enable_plugins=no
AC_MSG_WARN([libdld required for enable-plugins.])
fi
if test "x$enable_plugins" = xyes && test "x$enable_shared" = xno; then
AC_MSG_WARN([--disable-shared => --disable-plugins])
enable_plugins=no
fi

if test "x$enable_plugins" = xyes; then
AC_DEFINE([ENABLE_PLUGINS], [1], [if true, support dynamically loaded plugins])
fi
AM_CONDITIONAL(ENABLE_PLUGINS, [test "x$enable_plugins" = xyes])
AC_SUBST(USEPLUGINS, [${enable_plugins}])

AC_FUNC_ALLOCA
AC_CHECK_DECLS([isnan, isinf, isfinite],,,[#include <math.h>])
Expand All @@ -1199,22 +1220,26 @@ AC_TYPE_UINTPTR_T
AC_C_CHAR_UNSIGNED
AC_C_BIGENDIAN

# Figure out platforms of special interest
case "`uname`" in
CYGWIN*) ISCYGWIN=yes;;
Darwin*) ISOSX=yes;;
WIN*) ISMSVC=yes;;
MINGW*) ISMINGW=yes;;
esac
AM_CONDITIONAL(ISCYGWIN, [test "x$ISCYGWIN" = xyes])
AM_CONDITIONAL(ISMSVC, [test "x$ISMSVC" = xyes])
AM_CONDITIONAL(ISOSX, [test "x$ISOSX" = xyes])
AM_CONDITIONAL(ISMINGW, [test "x$ISMINGW" = xyes])
AM_CONDITIONAL(ISMSYS, [test "x$ISMSYS" = xyes])

AC_SUBST([ISMSVC], [${ISMSVC}])
AC_SUBST([ISCYGWIN], [${ISCYGWIN}])
AC_SUBST([ISOSX], [${ISOSX}])
AC_SUBST([ISMINGW], [${ISMINGW}])
AC_SUBST([ISMSYS], [${ISMSYS}])

if test "x$ISMSVC" != x ; then REGEDIT=yes; fi
if test "x$ISMSYS" != x ; then REGEDIT=yes; fi
if test "x$ISCYGWIN" != x ; then REGEDIT=yes; fi
if test "x$REGEDIT" = xyes; then
AC_DEFINE([REGEDIT], 1, [dreg.c usable])
fi
AM_CONDITIONAL(REGEDIT, [test "x$REGEDIT" = xyes])
AC_SUBST([ISREGEDIT], [yes])

###
# Crude hack to work around an issue
Expand Down Expand Up @@ -1594,9 +1619,6 @@ AC_ARG_ENABLE([nczarr-filters], [AS_HELP_STRING([--disable-nczarr-filters],
[disable NCZarr filters])])
test "x$enable_nczarr_filters" = xno || enable_nczarr_filters=yes
AC_MSG_RESULT([$enable_nczarr_filters])
if test "x$enable_nczarr_filters" = xyes; then
AC_DEFINE([ENABLE_NCZARR_FILTERS], [1], [if true, enable NCZarr filters])
fi

# Control filter test/example
AC_MSG_CHECKING([whether filter testing should be run])
Expand All @@ -1606,19 +1628,24 @@ AC_ARG_ENABLE([filter-testing],
test "x$enable_filter_testing" = xno || enable_filter_testing=yes
AC_MSG_RESULT($enable_filter_testing)

if test "x$enable_nczarr" = xno ; then
# Apply constraints
if test "x$enable_plugins" = xno ; then
AC_MSG_WARN([--disable-plugins => --disable-nczarr-filters])
enable_nczarr_filters=no
fi

if test "x$enable_hdf5" = xno && test "x$enable_nczarr" = xno ; then
AC_MSG_WARN([HDF5 and NCZarr are disabled => --disable-filter-testing])
if test "x$enable_plugins" = xno ; then
AC_MSG_WARN([--disable-plugins => --disable-filter-testing])
enable_filter_testing=no
fi

if test "x$enable_shared" = xno ; then
AC_MSG_WARN([Shared libraries are disabled => --disable-filter-testing])
enable_filter_testing=no
enable_nczarr_filters=no
if test "x$enable_filter_testing" = xno; then
AC_MSG_WARN([--disable-filter-testing => --disable-nczarr-filter-testing])
enable_nczarr_filter_testing=no
fi

if test "x$enable_nczarr_filters" = xyes; then
AC_DEFINE([ENABLE_NCZARR_FILTERS], [1], [if true, enable NCZarr filters])
fi

# Client side filter registration is permanently disabled
Expand Down
10 changes: 10 additions & 0 deletions include/nclog.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <stdarg.h>
#include "ncexternl.h"

#undef NCCATCH

#define NCENVLOGGING "NCLOGGING"
#define NCENVTRACING "NCTRACING"

Expand Down Expand Up @@ -39,8 +41,16 @@ EXTERNL void nctrace(int level, const char* fcn, const char* fmt, ...);
EXTERNL void nctracemore(int level, const char* fmt, ...);
EXTERNL void ncvtrace(int level, const char* fcn, const char* fmt, va_list ap);
EXTERNL int ncuntrace(const char* fcn, int err,const char* fmt,...);
EXTERNL int ncthrow(int err,const char* file,int line);
EXTERNL int ncbreakpoint(int err);

/* Debug support */
#if defined(NCCATCH)
#define NCTHROW(e) ((e) == NC_NOERR ? (e) : ncthrow(e,__FILE__,__LINE__))
#else
#define NCTHROW(e) (e)
#endif

#ifdef HAVE_EXECINFO_H
EXTERNL void ncbacktrace(void);
#else
Expand Down
Loading