Skip to content

Commit 7554eb0

Browse files
committed
netcdfcxx4: fix build
1 parent c2c1512 commit 7554eb0

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
From b819b3616b96352d23cdf0840df9e6674437948c Mon Sep 17 00:00:00 2001
2+
From: Orion Poplawski <[email protected]>
3+
Date: Mon, 17 Feb 2025 15:17:28 -0700
4+
Subject: [PATCH] Use HAVE_NC_SET_LOG_LEVEL to determine usage of
5+
nc_set_log_level (fixes #161)
6+
7+
---
8+
cxx4/test_filter.cpp | 2 ++
9+
examples/pres_temp_4D_plugin_wr.cpp | 4 ++++
10+
2 files changed, 6 insertions(+)
11+
12+
diff --git a/cxx4/test_filter.cpp b/cxx4/test_filter.cpp
13+
index 879ba71..f442c64 100644
14+
--- a/cxx4/test_filter.cpp
15+
+++ b/cxx4/test_filter.cpp
16+
@@ -30,7 +30,9 @@ int main()
17+
try
18+
{
19+
NcFile test("pres_temp_plugin_4D.nc", NcFile::replace);
20+
+#ifdef HAVE_NC_SET_LOG_LEVEL
21+
nc_set_log_level(5);
22+
+#endif
23+
// Define the dimensions. NetCDF will hand back an ncDim object for
24+
// each.
25+
NcDim latDim = test.addDim(LAT_NAME, NLAT);
26+
diff --git a/examples/pres_temp_4D_plugin_wr.cpp b/examples/pres_temp_4D_plugin_wr.cpp
27+
index 832d2a6..584e8be 100644
28+
--- a/examples/pres_temp_4D_plugin_wr.cpp
29+
+++ b/examples/pres_temp_4D_plugin_wr.cpp
30+
@@ -71,7 +71,9 @@ string LON_UNITS = "degrees_east";
31+
32+
int main()
33+
{
34+
+#ifdef HAVE_NC_SET_LOG_LEVEL
35+
nc_set_log_level(5);
36+
+#endif
37+
// We will write latitude and longitude fields.
38+
float lats[NLAT],lons[NLON];
39+
40+
@@ -103,7 +105,9 @@ int main()
41+
42+
// Create the file.
43+
NcFile test(FILE_NAME, NcFile::replace);
44+
+#ifdef HAVE_NC_SET_LOG_LEVEL
45+
nc_set_log_level(5);
46+
+#endif
47+
// Define the dimensions. NetCDF will hand back an ncDim object for
48+
// each.
49+
NcDim lvlDim = test.addDim(LVL_NAME, NLVL);

pkgs/by-name/ne/netcdfcxx4/package.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ stdenv.mkDerivation rec {
2222
patches = [
2323
# This fix is included upstream, remove with next upgrade
2424
./cmake-h5free.patch
25+
./netcdf.patch
2526
];
2627

2728
preConfigure = ''

0 commit comments

Comments
 (0)