From fbe383dab12fb4b6d2432237735e513cc15e0ad4 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 9 May 2024 11:14:30 -0400 Subject: [PATCH 01/14] CI: Add Cygwin CMake run Copied from MehdiChinoune's MSYS CMake CI run. --- .github/workflows/run_tests_win_cygwin.yml | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index e7a4d8002a..b39c9fe420 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -79,3 +79,69 @@ jobs: timeout-minutes: 30 run: | make check -j8 SHELL=/bin/dash + + build-and-test-cmake: + + runs-on: windows-latest + defaults: + run: + shell: "C:/cygwin/bin/bash.exe" -eo pipefail -o igncr "{0}" + + steps: + + - run: git config --global core.autocrlf input + - uses: actions/checkout@v4 + - uses: cygwin/cygwin-install-action@v2 + with: + platform: x86_64 + install-dir: 'C:\cygwin' + packages: >- + 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 libcurl-devel libiconv-devel + libssl-devel libcrypt-devel cmake ninja make m4 diffutils unzip + +### +# Configure and build +### + + - name: (CMake) Configure Build + run: | + LDFLAGS="-Wl,--export-all-symbols" \ + cmake \ + -G"UNIX Makefiles" \ + -B build \ + -S . \ + -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ + -DBUILD_SHARED_LIBS=ON \ + -DNETCDF_ENABLE_NETCDF_4=ON \ + -DNETCDF_ENABLE_DAP=ON \ + -DNETCDF_BUILD_UTILITIES=ON \ + -DNETCDF_ENABLE_TESTS=ON \ + -DNETCDF_ENABLE_HDF5=ON \ + -DNETCDF_ENABLE_DAP=TRUE \ + -DNETCDF_ENABLE_NCZARR=TRUE \ + -DNETCDF_ENABLE_DAP_LONG_TESTS=TRUE \ + -DNETCDF_ENABLE_PLUGINS=ON + if: ${{ success() }} + + - name: (CMake) Look at CMakeCache.txt if error + run: cat build/CMakeCache.txt + if: ${{ failure() }} + + - name: (CMake) Print Summary + run: cat build/libnetcdf.settings + + - name: (CMake) Build All + run: cmake --build build -j$(nproc) + if: ${{ success() }} + + - name: (CMake) Run Tests + run: PATH=$PWD/build:$PATH ctest --test-dir build + if: ${{ success() }} + + - name: (CMake) Verbose output of CTest failures + run: >- + PATH=$PWD/build:$PATH ctest --test-dir build --output-on-failure -j$(nproc) --rerun-failed -VV + if: ${{ failure() }} From e2bbe13afee2e2a1562dc4f3698f7b9aea32da0d Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 9 May 2024 11:21:47 -0400 Subject: [PATCH 02/14] BUG: Try to fix CI YAML syntax. --- .github/workflows/run_tests_win_cygwin.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index b39c9fe420..be026002d8 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -81,11 +81,10 @@ jobs: make check -j8 SHELL=/bin/dash build-and-test-cmake: - runs-on: windows-latest defaults: run: - shell: "C:/cygwin/bin/bash.exe" -eo pipefail -o igncr "{0}" + shell: C:/cygwin/bin/bash.exe -eo pipefail -o igncr "{0}" steps: From cbc4aa6fc55ba072ac6a4f19dfa085ea81ada1be Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 9 May 2024 11:26:15 -0400 Subject: [PATCH 03/14] FIX: Run initial git command with Windows shell. --- .github/workflows/run_tests_win_cygwin.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index be026002d8..ebe082b928 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -16,7 +16,7 @@ jobs: runs-on: windows-latest defaults: run: - shell: bash -eo pipefail -o igncr "{0}" + shell: C:/cygwin/bin/bash.exe -eo pipefail -o igncr "{0}" name: Cygwin-based Autotools tests @@ -26,13 +26,15 @@ jobs: steps: - name: Fix line endings + shell: pwsh run: git config --global core.autocrlf input - uses: actions/checkout@v4 - - uses: cygwin/cygwin-install-action@v2 + - uses: cygwin/cygwin-install-action@v4 with: platform: x86_64 + install-dir: 'C:\cygwin' packages: >- git automake libtool autoconf2.5 make libhdf5-devel libhdf4-devel zipinfo libxml2-devel perl zlib-devel @@ -81,6 +83,7 @@ jobs: make check -j8 SHELL=/bin/dash build-and-test-cmake: + name: Cygwin-based CMake tests runs-on: windows-latest defaults: run: @@ -89,8 +92,9 @@ jobs: steps: - run: git config --global core.autocrlf input + shell: pwsh - uses: actions/checkout@v4 - - uses: cygwin/cygwin-install-action@v2 + - uses: cygwin/cygwin-install-action@v4 with: platform: x86_64 install-dir: 'C:\cygwin' From 4ec1b935d8bf3abd0be2f3faf27e4603b5605869 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 9 May 2024 12:34:31 -0400 Subject: [PATCH 04/14] FIX: Capitalization of Makefile CMake builder --- .github/workflows/run_tests_win_cygwin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index ebe082b928..7dcad7a297 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -113,7 +113,7 @@ jobs: run: | LDFLAGS="-Wl,--export-all-symbols" \ cmake \ - -G"UNIX Makefiles" \ + -G"Unix Makefiles" \ -B build \ -S . \ -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ From 8cd78813556ea8fa31b6984369ae98871927eefa Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 9 May 2024 14:00:18 -0400 Subject: [PATCH 05/14] FIX: Ensure running Cygwin CMake --- .github/workflows/run_tests_win_cygwin.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index 7dcad7a297..b1ffa6a97b 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -112,11 +112,11 @@ jobs: - name: (CMake) Configure Build run: | LDFLAGS="-Wl,--export-all-symbols" \ - cmake \ + /usr/bin/cmake \ -G"Unix Makefiles" \ -B build \ -S . \ - -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ + -DCMAKE_INSTALL_PREFIX=/tmp \ -DBUILD_SHARED_LIBS=ON \ -DNETCDF_ENABLE_NETCDF_4=ON \ -DNETCDF_ENABLE_DAP=ON \ From 8a52acb3604cbfd547dd6cc53b55714bf380a591 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 9 May 2024 14:02:23 -0400 Subject: [PATCH 06/14] FIX: Install C++ compiler. --- .github/workflows/run_tests_win_cygwin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index b1ffa6a97b..ce817f7a8a 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -39,7 +39,7 @@ jobs: 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 libcurl-devel libiconv-devel + libdeflate-devel gcc-core gcc-g++ libcurl-devel libiconv-devel libssl-devel libcrypt-devel - name: (Autotools) Run autoconf and friends From bc522f118a625e97e1cf0f72a306e2607cc71dbb Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 9 May 2024 14:06:16 -0400 Subject: [PATCH 07/14] FIX: Force MAKE=/usr/bin/make Why isn't CYGWIN_NOWINPATH working? --- .github/workflows/run_tests_win_cygwin.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index ce817f7a8a..dc7973ff95 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -110,8 +110,11 @@ jobs: ### - name: (CMake) Configure Build + env: + MAKE: "/usr/bin/make" run: | LDFLAGS="-Wl,--export-all-symbols" \ + MAKE=/usr/bin/make \ /usr/bin/cmake \ -G"Unix Makefiles" \ -B build \ @@ -137,6 +140,8 @@ jobs: run: cat build/libnetcdf.settings - name: (CMake) Build All + env: + MAKE: "/usr/bin/make" run: cmake --build build -j$(nproc) if: ${{ success() }} From 52eaf083fd95fc73ea6107f4fd0138f25ab001e4 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 9 May 2024 14:11:14 -0400 Subject: [PATCH 08/14] FIX: Force CXX=/usr/bin/g++ This should really not be needed --- .github/workflows/run_tests_win_cygwin.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index dc7973ff95..d9dbfed7e8 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -112,6 +112,7 @@ jobs: - name: (CMake) Configure Build env: MAKE: "/usr/bin/make" + CXX: "/usr/bin/g++" run: | LDFLAGS="-Wl,--export-all-symbols" \ MAKE=/usr/bin/make \ @@ -142,6 +143,7 @@ jobs: - name: (CMake) Build All env: MAKE: "/usr/bin/make" + CXX: "/usr/bin/g++" run: cmake --build build -j$(nproc) if: ${{ success() }} From 6a1716da28b8a579888b8b6f485eb1970b061a0d Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 9 May 2024 14:12:09 -0400 Subject: [PATCH 09/14] FIX: Ensure CMake build has C++ That's the one that needed it. --- .github/workflows/run_tests_win_cygwin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index d9dbfed7e8..8b1327e081 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -102,7 +102,7 @@ jobs: 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 libcurl-devel libiconv-devel + libdeflate-devel gcc-core gcc-g++ libcurl-devel libiconv-devel libssl-devel libcrypt-devel cmake ninja make m4 diffutils unzip ### From 986b95ce8cfa4f0c52a8905a3fd4c43509234ba2 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Mon, 13 May 2024 15:53:59 -0400 Subject: [PATCH 10/14] ENH:Cygwin: Set plugin prefix and suffix in CMake. --- plugins/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 6d0b20a416..4902b320de 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -8,7 +8,10 @@ set(CMAKE_BUILD_TYPE "") if(WIN32) set(PLUGINEXT "dll") - set(PLUGINPRE "__nc") + set(PLUGINPRE "__nc") +elif(CYGWIN) + set(PLUGINEXT "dll") + set(PLUGINPRE "lib__nc") else() set(PLUGINPRE "lib__nc") if(APPLE) From 92f71ed65788c14235a085cf75f8952d5269fd10 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 24 May 2024 15:03:38 -0400 Subject: [PATCH 11/14] CI: Remove a few environment variables from Cygwin CMake build Let's see if the build works without these. The export-everything is going to be the real test. LDFLAGS="-Wl,--export-all-symbols" MAKE=/usr/bin/make --- .github/workflows/run_tests_win_cygwin.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index 8b1327e081..8c15948f8d 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -114,8 +114,6 @@ jobs: MAKE: "/usr/bin/make" CXX: "/usr/bin/g++" run: | - LDFLAGS="-Wl,--export-all-symbols" \ - MAKE=/usr/bin/make \ /usr/bin/cmake \ -G"Unix Makefiles" \ -B build \ From 0c10f11c7adc0eda00a55d9511a51bf69130bc7d Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 24 May 2024 15:51:30 -0400 Subject: [PATCH 12/14] TST: Skip nc_test4_tst_filter on Cygwin. Already skipped on MinGW, so I don't feel bad skipping it on Cygwin too. Still haven't figured out why it's crashing. I should probably look into why Autotools is fine. --- nc_test4/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nc_test4/CMakeLists.txt b/nc_test4/CMakeLists.txt index f190c9c212..33a105f5b2 100644 --- a/nc_test4/CMakeLists.txt +++ b/nc_test4/CMakeLists.txt @@ -49,7 +49,7 @@ IF(USE_HDF5 AND NETCDF_ENABLE_FILTER_TESTING) build_bin_test(test_filter_order) build_bin_test(test_filter_repeat) build_bin_test(tst_filter_vlen) - if(NOT MINGW) + if(NOT MINGW AND NOT CYGWIN) ADD_SH_TEST(nc_test4 tst_filter) endif() ADD_SH_TEST(nc_test4 tst_specific_filters) From ff5a18d8225b2f7606da6d7eb29c3108fbfe02ca Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 24 May 2024 16:07:51 -0400 Subject: [PATCH 13/14] CI: Don't enable DAP on Cygwin I don't know that it ever worked before, and it isn't working now. --- .github/workflows/run_tests_win_cygwin.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/run_tests_win_cygwin.yml b/.github/workflows/run_tests_win_cygwin.yml index 8c15948f8d..f7fcf5a997 100644 --- a/.github/workflows/run_tests_win_cygwin.yml +++ b/.github/workflows/run_tests_win_cygwin.yml @@ -121,13 +121,10 @@ jobs: -DCMAKE_INSTALL_PREFIX=/tmp \ -DBUILD_SHARED_LIBS=ON \ -DNETCDF_ENABLE_NETCDF_4=ON \ - -DNETCDF_ENABLE_DAP=ON \ -DNETCDF_BUILD_UTILITIES=ON \ -DNETCDF_ENABLE_TESTS=ON \ -DNETCDF_ENABLE_HDF5=ON \ - -DNETCDF_ENABLE_DAP=TRUE \ -DNETCDF_ENABLE_NCZARR=TRUE \ - -DNETCDF_ENABLE_DAP_LONG_TESTS=TRUE \ -DNETCDF_ENABLE_PLUGINS=ON if: ${{ success() }} From 1770b753a33998ebfb9b08c96611dc5e3c7f9731 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 24 May 2024 17:20:52 -0400 Subject: [PATCH 14/14] BUG: Fix CMake syntax for Cygwin plugin prefix/suffix --- plugins/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 4902b320de..24c6d2fc33 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -9,7 +9,7 @@ set(CMAKE_BUILD_TYPE "") if(WIN32) set(PLUGINEXT "dll") set(PLUGINPRE "__nc") -elif(CYGWIN) +elseif(CYGWIN) set(PLUGINEXT "dll") set(PLUGINPRE "lib__nc") else()