Skip to content

Fix build failure with GDAL 3.12.0.#4531

Merged
artemp merged 1 commit intomapnik:masterfrom
sebastic:gdal-3.12
Oct 24, 2025
Merged

Fix build failure with GDAL 3.12.0.#4531
artemp merged 1 commit intomapnik:masterfrom
sebastic:gdal-3.12

Conversation

@sebastic
Copy link
Contributor

Fixes:

/build/mapnik-4.1.3+ds/plugins/input/ogr/ogr_datasource.cpp: In member function 'void ogr_datasource::init(const mapnik::parameters&)':
/build/mapnik-4.1.3+ds/plugins/input/ogr/ogr_datasource.cpp:381:56: error: invalid conversion from 'const OGRSpatialReference*' to 'OGRSpatialReference*' [-fpermissive]
  381 |     OGRSpatialReference* srs_ref = layer->GetSpatialRef();
      |                                    ~~~~~~~~~~~~~~~~~~~~^~
      |                                                        |
      |                                                        const OGRSpatialReference*

From MIGRATION_GUIDE.TXT:

  • OGRLayer::GetSpatialRef() is now a const method that returns a const OGRSpatialReference*

@sebastic
Copy link
Contributor Author

@artemp approved these changes Oct 24, 2025

Be aware that GDAL upstream is considering reverting the change in question:

OSGeo/gdal#13277

@artemp artemp merged commit ca60dda into mapnik:master Oct 24, 2025
1 check passed
@artemp artemp self-assigned this Oct 24, 2025
@sebastic sebastic deleted the gdal-3.12 branch October 24, 2025 15:09
@rouault
Copy link
Contributor

rouault commented Oct 24, 2025

I'd note the version check is not needed here. Just storing a const OGRSpatialReference* should be fine for all GDAL versions

@artemp
Copy link
Member

artemp commented Oct 24, 2025

@rouault thanks, fixed in 4188a8d

/cc @sebastic

@artemp artemp added this to the v4.1.4 milestone Oct 30, 2025
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

Successfully merging this pull request may close these issues.

3 participants