You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "paleolimbot (via GitHub)" <gi...@apache.org> on 2026/10/14 22:27:20 UTC
[PR] fix(r): configure GDAL and PROJ at runtime [sedona-db]
paleolimbot opened a new pull request, #1449:
URL: https://github.com/apache/sedona-db/pull/1449
Add sd_configure_gdal() and auto-configure GDAL/PROJ for R. Share Conda, Homebrew, system, and versioned-library discovery with Python through Rust. Windows R builds now link Rtools GDAL/PROJ and bundle their data directories without vcpkg, including ARM64 bindgen support. Improve missing-GDAL diagnostics and add static gdal-sys initialization plus a public MEM-driver fallback.
Tests: cargo test -p sedona-gdal --features gdal-sys; cargo test -p sedonadb --lib; cargo test -p sedonadbr --lib.
closes #1395
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(r/sedonadb): configure GDAL and PROJ at runtime [sedona-db]
Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot merged PR #1449:
URL: https://github.com/apache/sedona-db/pull/1449
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(r): configure GDAL and PROJ at runtime [sedona-db]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on code in PR #1449:
URL: https://github.com/apache/sedona-db/pull/1449#discussion_r4301902391
##########
c/sedona-gdal/src/gdal_api.rs:
##########
@@ -69,11 +110,131 @@ impl GdalApi {
let (lib, inner) = dyn_load::load_gdal_from_current_process()?;
Ok(Self {
inner,
- _lib: lib,
+ _lib: Some(lib),
name: "current_process".to_string(),
})
}
+ /// Build the API table directly from functions linked by `gdal-sys`.
+ ///
+ /// Linked GDAL functions are not guaranteed to be exported from the final
+ /// executable or DLL for runtime symbol lookup, so retain their addresses
+ /// directly when the platform has a supported MEM creator ABI.
+ #[cfg(all(feature = "gdal-sys", any(unix, all(windows, target_env = "gnu"))))]
+ pub fn from_gdal_sys() -> Self {
+ let mut inner = SedonaGdalApi::default();
+
+ macro_rules! set_fn {
+ ($name:ident) => {
+ // The generated gdal-sys bindings model C enums as integers,
+ // while Sedona's dynamic table uses repr(C) enums. Their ABIs
+ // are identical, but their Rust function-pointer types differ.
+ #[allow(clippy::missing_transmute_annotations)]
+ {
+ inner.$name =
+ Some(unsafe { std::mem::transmute(gdal_sys::$name as *const ()) });
+ }
+ };
+ }
+
+ set_fn!(GDALOpenEx);
+ set_fn!(GDALClose);
+ set_fn!(GDALGetRasterXSize);
+ set_fn!(GDALGetRasterYSize);
+ set_fn!(GDALGetRasterCount);
+ set_fn!(GDALGetRasterBand);
+ set_fn!(GDALGetGeoTransform);
+ set_fn!(GDALSetGeoTransform);
+ set_fn!(GDALGetProjectionRef);
+ set_fn!(GDALSetProjection);
+ set_fn!(GDALGetSpatialRef);
+ set_fn!(GDALSetSpatialRef);
+ set_fn!(GDALCreateCopy);
+ set_fn!(GDALDatasetCreateLayer);
+ set_fn!(GDALAllRegister);
+ set_fn!(GDALGetDriverByName);
+ set_fn!(GDALCreate);
+ set_fn!(GDALAddBand);
+ set_fn!(GDALRasterIO);
+ set_fn!(GDALRasterIOEx);
+ set_fn!(GDALGetRasterDataType);
+ set_fn!(GDALGetRasterBandXSize);
+ set_fn!(GDALGetRasterBandYSize);
+ set_fn!(GDALGetBlockSize);
+ set_fn!(GDALGetRasterNoDataValue);
+ set_fn!(GDALGetRasterNoDataValueAsUInt64);
+ set_fn!(GDALGetRasterNoDataValueAsInt64);
+ set_fn!(GDALSetRasterNoDataValue);
+ set_fn!(GDALDeleteRasterNoDataValue);
+ set_fn!(GDALSetRasterNoDataValueAsUInt64);
+ set_fn!(GDALSetRasterNoDataValueAsInt64);
+ set_fn!(OSRNewSpatialReference);
+ set_fn!(OSRSetFromUserInput);
+ set_fn!(OSREPSGTreatsAsLatLong);
+ set_fn!(OSRGetDataAxisToSRSAxisMapping);
+ set_fn!(OSRGetAxisMappingStrategy);
+ set_fn!(OSRSetAxisMappingStrategy);
+ set_fn!(OSRDestroySpatialReference);
+ set_fn!(OSRExportToPROJJSON);
+ set_fn!(OSRExportToWkt);
+ set_fn!(OSRClone);
+ set_fn!(OSRRelease);
+ set_fn!(OGR_G_CreateFromWkb);
+ set_fn!(OGR_G_CreateFromWkt);
+ set_fn!(OGR_G_ExportToIsoWkb);
+ set_fn!(OGR_G_WkbSize);
+ set_fn!(OGR_G_GetEnvelope);
+ set_fn!(OGR_G_DestroyGeometry);
+ set_fn!(OGR_L_ResetReading);
+ set_fn!(OGR_L_GetNextFeature);
+ set_fn!(OGR_L_CreateField);
+ set_fn!(OGR_L_GetFeatureCount);
+ set_fn!(OGR_F_GetGeometryRef);
+ set_fn!(OGR_F_GetFieldIndex);
+ set_fn!(OGR_F_GetFieldAsDouble);
+ set_fn!(OGR_F_GetFieldAsInteger);
+ set_fn!(OGR_F_IsFieldSetAndNotNull);
+ set_fn!(OGR_F_Destroy);
+ set_fn!(OGR_Fld_Create);
+ set_fn!(OGR_Fld_Destroy);
+ set_fn!(VSIFileFromMemBuffer);
+ set_fn!(VSIFCloseL);
+ set_fn!(VSIUnlink);
+ set_fn!(VSIGetMemFileBuffer);
+ set_fn!(VSIFree);
+ set_fn!(VSIMalloc);
+ inner.VRTCreate = Some(gdal_sys_vrt_create);
+ inner.VRTAddSimpleSource = Some(gdal_sys_vrt_add_simple_source);
+ set_fn!(GDALReprojectImage);
+ set_fn!(GDALCreateGenImgProjTransformer);
+ set_fn!(GDALDestroyGenImgProjTransformer);
+ set_fn!(GDALSuggestedWarpOutput);
+ set_fn!(GDALGenImgProjTransform);
+ set_fn!(GDALRasterizeGeometries);
+ set_fn!(GDALFPolygonize);
+ set_fn!(GDALPolygonize);
+ set_fn!(GDALVersionInfo);
+ set_fn!(CPLSetThreadLocalConfigOption);
+ set_fn!(CPLGetLastErrorNo);
+ set_fn!(CPLGetLastErrorMsg);
+ set_fn!(CPLErrorReset);
+ set_fn!(GDALGetDataTypeSizeBytes);
+
+ #[cfg(gdal_has_mem_create)]
+ set_fn!(MEMCreate);
Review Comment:
This fails to compile for me with Homebrew GDAL 3.13.1:
```sh
cargo test --offline -p sedona-gdal --features bindgen --lib
```
```text
error[E0425]: cannot find value `MEMCreate` in crate `gdal_sys`
```
The pinned `gdal-sys 0.12` doesn't generate this binding, even with bindgen: its wrapper omits `gdal_mem.h` and its function allowlist excludes `MEM.*`. The base compiles with the same setup. Could we declare `MEMCreate` locally, like `VRTCreate` above?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(r): configure GDAL and PROJ at runtime [sedona-db]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on code in PR #1449:
URL: https://github.com/apache/sedona-db/pull/1449#discussion_r4301903756
##########
r/sedonadb/configure.win:
##########
@@ -127,70 +127,152 @@ case "$($CC -dumpmachine)" in
esac
echo "using Rust target: '${TARGET}'"
-# sedona-s2geography needs OpenSSL, Abseil, and s2geometry built with the same
-# MinGW/gnullvm compiler and flags as R. The usual vcpkg Windows triplets use
-# MSVC, whose C++ ABI is not compatible with Rtools.
+# gdal-sys ships pre-generated Windows bindings for x86_64 but not arm64.
+# Generate them from the vcpkg headers for the gnullvm target.
+case "${TARGET}" in
+ aarch64-*)
+ case " ${SAVVY_FEATURES} " in
Review Comment:
Nonblocking, but could we normalize commas before this check too? `SAVVY_FEATURES='gdal,proj'` is accepted by Cargo and the dependency checks below, but here it skips `bindgen`. On Windows ARM64, gdal-sys then fails with `No pre-built bindings available for target: aarch64`.
This reproduces the missed check on any platform, from the repo root:
```sh
TARGET=aarch64-pc-windows-gnullvm
SAVVY_FEATURES=gdal,proj
eval "$(sed -n '132,141p' r/sedonadb/configure.win)"
printf '%s\n' "$SAVVY_FEATURES"
```
This prints `gdal,proj`; using `SAVVY_FEATURES='gdal proj'` instead prints `gdal proj bindgen`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org