georust/gdal

Does not compile with prebuilt GDAL 2.4 bindings

donkeyteethUX opened this issue · 3 comments

The gdal crate seems not to be compatible with the prebuilt bindings for GDAL 2.4 in gdal_sys, as some things missing from the bindings and not gated behind any feature flag in the gdal crate.

$ gdalinfo --version
GDAL 2.4.0, released 2018/12/14

Error snippet

error[E0425]: cannot find function, tuple struct or tuple variant `GDALGetGCPSpatialRef` in crate `gdal_sys`
   --> extlib/rust/gdal-0.16.0/src/gcp.rs:118:40
    |
118 |         let c_ptr = unsafe { gdal_sys::GDALGetGCPSpatialRef(self.c_dataset()) };
    |                                        ^^^^^^^^^^^^^^^^^^^^ not found in `gdal_sys`

error[E0425]: cannot find function, tuple struct or tuple variant `GDALSetGCPs2` in crate `gdal_sys`
   --> extlib/rust/gdal-0.16.0/src/gcp.rs:206:23
    |
206 |               gdal_sys::GDALSetGCPs2(
    |                         ^^^^^^^^^^^^ help: a function with a similar name exists: `GDALSetGCPs`
    |
    = note: similarly named function `GDALSetGCPs` defined here

error[E0425]: cannot find function, tuple struct or tuple variant `OCTNewCoordinateTransformationEx` in crate `gdal_sys`
  --> extlib/rust/gdal-0.16.0/src/spatial_ref/transform.rs:51:23
   |
51 |               gdal_sys::OCTNewCoordinateTransformationEx(
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `OCTNewCoordinateTransformation`
   |
   = note: similarly named function `OCTNewCoordinateTransformation` defined here

error[E0412]: cannot find type `OGRCoordinateTransformationOptionsH` in crate `gdal_sys`
  --> extlib/rust/gdal-0.16.0/src/spatial_ref/transform_opts.rs:14:22
   |
14 |     inner: gdal_sys::OGRCoordinateTransformationOptionsH,
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a type alias with a similar name exists: `OGRCoordinateTransformationH`
   |
   = note: similarly named type alias `OGRCoordinateTransformationH` defined here

error[E0425]: cannot find function, tuple struct or tuple variant `OCTDestroyCoordinateTransformationOptions` in crate `gdal_sys`
  --> extlib/rust/gdal-0.16.0/src/spatial_ref/transform_opts.rs:19:28
   |
19 |         unsafe { gdal_sys::OCTDestroyCoordinateTransformationOptions(self.inner) };
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `OCTDestroyCoordinateTransformation`
   |
   = note: similarly named function `OCTDestroyCoordinateTransformation` defined here

error[E0425]: cannot find function, tuple struct or tuple variant `OCTNewCoordinateTransformationOptions` in crate `gdal_sys`
  --> extlib/rust/gdal-0.16.0/src/spatial_ref/transform_opts.rs:26:40
   |
26 |           let c_obj = unsafe { gdal_sys::OCTNewCoordinateTransformationOptions() };
   |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: 
   |
   = note: similarly named function `OCTNewCoordinateTransformation` defined here

error[E0412]: cannot find type `OGRCoordinateTransformationOptionsH` in crate `gdal_sys`
  --> extlib/rust/gdal-0.16.0/src/spatial_ref/transform_opts.rs:39:56
   |
39 |     pub(crate) unsafe fn c_options(&self) -> gdal_sys::OGRCoordinateTransformationOptionsH {
   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a type alias with a similar name exists: `OGRCoordinateTransformationH`
   |
   = note: similarly named type alias `OGRCoordinateTransformationH` defined here

error[E0425]: cannot find function, tuple struct or tuple variant `OCTCoordinateTransformationOptionsSetAreaOfInterest` in crate `gdal_sys`
  --> extlib/rust/gdal-0.16.0/src/spatial_ref/transform_opts.rs:65:23
   |
65 |             gdal_sys::OCTCoordinateTransformationOptionsSetAreaOfInterest(
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `gdal_sys`

error[E0425]: cannot find function, tuple struct or tuple variant `OCTCoordinateTransformationOptionsSetOperation` in crate `gdal_sys`
   --> extlib/rust/gdal-0.16.0/src/spatial_ref/transform_opts.rs:145:23
    |
145 |             gdal_sys::OCTCoordinateTransformationOptionsSetOperation(
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `gdal_sys`

error[E0425]: cannot find function, tuple struct or tuple variant `OGR_G_MakeValid` in crate `gdal_sys`
   --> extlib/rust/gdal-0.16.0/src/vector/ops/transformations.rs:200:32
    |
200 |             unsafe { gdal_sys::OGR_G_MakeValid(self.c_geometry()) }
    |                                ^^^^^^^^^^^^^^^ help: a function with a similar name exists: `OGR_G_IsValid`
    |
    = note: similarly named function `OGR_G_IsValid` defined here

Yeah, I've long suspected we don't support versions older than 3.1. They're pretty hard to test on CI, so I'd be inclined to really drop them.

As a workaround, you can try an older version of the crate.

Out of curiosity, which distro are you on?

This was a debian buster container. The packaged GDAL is 2.4 there. I just built a newer version as a workaround.