-
Notifications
You must be signed in to change notification settings - Fork 96
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
Build script version detection assumes you're not cross compiling #376
Comments
Indeed, this was done to get it working on docs.rs which does a cross-compilation, and we wanted to be able to not rely on the host (docs.rs) having gdal installed. Ref. PR that introduced it for discussion. I believe the standard Do you have a MWIP repo to test? I'm not an expert on cross comp. |
The issue isn't related to the docs.rs stuff, just to the fact that this dependency exists at all. |
Well, if there is a better way, let us use that. |
@sfackler how can EDIT: looks like https://doc.rust-lang.org/cargo/reference/build-script-examples.html#conditional-compilation is exactly about this. |
It currently depends on gdal-sys twice. This is the dependency that should stay: https://github.com/georust/gdal/blob/master/Cargo.toml#L23 |
So if I got this right:
That's quite nifty, I didn't know it was a thing. |
Yep! |
So this means we can also test the docs_rs variable somewhere and output the appropriate env. variables? |
i guess it should work like this: #377 |
Fixed in #377 🎉 |
Thanks for the quick fix! |
The gdal crate declares gdal-sys as both a runtime and build-time dependency, and calls the gdal_version_docs_rs_wrapper function to determine the gdal version.
This logic is broken when cross compiling, since the host system's gdal won't be the same as the target system's gdal. A more robust approach would be to have gdal-sys output the detected version in its build script which can then be picked up by gdal's build script:
https://doc.rust-lang.org/cargo/reference/build-scripts.html#the-links-manifest-key
https://doc.rust-lang.org/cargo/reference/build-script-examples.html#using-another-sys-crate
The text was updated successfully, but these errors were encountered: