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

building GDAL fails with netcdf 4.9.3-rc1 #3028

Closed
tbussmann opened this issue Sep 19, 2024 · 6 comments
Closed

building GDAL fails with netcdf 4.9.3-rc1 #3028

tbussmann opened this issue Sep 19, 2024 · 6 comments

Comments

@tbussmann
Copy link
Contributor

OS: macOS 14 with XCode CLT 15.3

Building netcdf-c 4.9.3-rc1 (with -DNETCDF_ENABLE_HDF5=OFF -DNETCDF_BUILD_UTILITIES=OFF) works successfully, one failed test, see #3027.

Building GDAL 3.8.5 against that fials with error: use of undeclared identifier '_FillValue'. Doing the same against netcdf 4.9.2 builds successfully.

Build log
[ 49%] Building CXX object frmts/netcdf/CMakeFiles/gdal_netCDF.dir/netcdfdataset.cpp.o
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:466:42: error: use of undeclared identifier '_FillValue'
    int status = nc_inq_att(cdfid, nZId, _FillValue, &atttype, &attlen);
                                         ^
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:469:26: error: use of undeclared identifier '_FillValue'
        pszNoValueName = _FillValue;
                         ^
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:1220:13: error: use of undeclared identifier '_FillValue'
            _FillValue,    "coordinates",   nullptr};
            ^
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:1538:56: error: use of undeclared identifier '_FillValue'
                status = nc_put_att_schar(cdfid, nZId, _FillValue, nc_datatype,
                                                       ^
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:1545:56: error: use of undeclared identifier '_FillValue'
                status = nc_put_att_uchar(cdfid, nZId, _FillValue, nc_datatype,
                                                       ^
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:1552:52: error: use of undeclared identifier '_FillValue'
            status = nc_put_att_short(cdfid, nZId, _FillValue, nc_datatype, 1,
                                                   ^
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:1558:50: error: use of undeclared identifier '_FillValue'
            status = nc_put_att_int(cdfid, nZId, _FillValue, nc_datatype, 1,
                                                 ^
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:1564:52: error: use of undeclared identifier '_FillValue'
            status = nc_put_att_float(cdfid, nZId, _FillValue, nc_datatype, 1,
                                                   ^
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:1574:53: error: use of undeclared identifier '_FillValue'
            status = nc_put_att_ushort(cdfid, nZId, _FillValue, nc_datatype, 1,
                                                    ^
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:1582:51: error: use of undeclared identifier '_FillValue'
            status = nc_put_att_uint(cdfid, nZId, _FillValue, nc_datatype, 1,
                                                  ^
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:1588:53: error: use of undeclared identifier '_FillValue'
            status = nc_put_att_double(cdfid, nZId, _FillValue, nc_datatype, 1,
                                                    ^
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:1667:55: error: use of undeclared identifier '_FillValue'
            status = nc_put_att_longlong(cdfid, nZId, _FillValue, nc_datatype,
                                                      ^
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:1674:53: error: use of undeclared identifier '_FillValue'
            status = nc_put_att_double(cdfid, nZId, _FillValue, nc_datatype, 1,
                                                    ^
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:1753:56: error: use of undeclared identifier '_FillValue'
            status = nc_put_att_ulonglong(cdfid, nZId, _FillValue, nc_datatype,
                                                       ^
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:1760:53: error: use of undeclared identifier '_FillValue'
            status = nc_put_att_double(cdfid, nZId, _FillValue, nc_datatype, 1,
                                                    ^
/Users/admin/Documents/PostgresApp/src-17/gdal-3.8.5/frmts/netcdf/netcdfdataset.cpp:10084:9: error: use of undeclared identifier '_FillValue'
        _FillValue,    "coordinates",   nullptr};
        ^
@tbussmann
Copy link
Contributor Author

this seems to be the same issue as in #3017

@WardF
Copy link
Member

WardF commented Sep 19, 2024

I suspect this is the result of refactoring_FillValue to NC_FillValue, as discussed in #2858 and changed in #2911. I will highlight this in the release notes, and I'll submit a PR to GDAL if I can confirm this is the case.

@WardF
Copy link
Member

WardF commented Sep 19, 2024

Looking at GDAL, it appears (at least in main) that this change has been accounted for, looking at netcdfdataset.h. Comparing against netcdfdataset.h in GDAL v3.8.5, it doesn't appear to accommodate this change. It feels like the path forward here is to upgrade to a newer version of GDAL, or revert to an holder version of netCDF. I'm open to a discussion about other alternatives, if these are non-starters.

@tbussmann
Copy link
Contributor Author

Thanks for explaining the context! The fix from GDAL master was already backported to the 3.9 branch. The 3.8 branch seems not longer maintained according to their maintenance policy. But with the information provided patching 3.8 seems to be trivial if needed. Upgrading to GDAL 3.9 is a problem in certain environments due to its increased requirements.

@edwardhartnett
Copy link
Contributor

refactoring_FillValue to NC_FillValue causes other breakage.

Isn't _FillValue still defined?

@WardF
Copy link
Member

WardF commented Sep 19, 2024

It's not, due to conflicts with libstdc++ 18 headers, see the conversation in #2858.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants