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

Put bindgen behind a seperate feature #191

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

weiznich
Copy link
Contributor

This commit changes proj-sys to not depend on bindgen by default as that introduces a quite heavy build time dependency (libclang) which might not be there on all systems. Instead bundled bindings for the proj version build by the bundled_proj feature are provided.

@urschrei
Copy link
Member

I don't know whether there's a prevailing best practice when it comes to sys crates, but my assumption has always been that the crate defaults to trying to use system libraries and the bundled library is an option / fallback. There's also a technical question around the bundled bindings: do they work correctly cross-platform? on 32-bit vs 64-bit?

@weiznich
Copy link
Contributor Author

At least most of the *-sys crates I've interacted with provide bundled bindings by default as that remove the dependency on libclang.

Examples:

  • libsqlite3-sys
  • pq-sys
  • mysqclient-sys
  • openssl-sys
  • netcdf-sys
  • libz_sys
  • gdal_sys

Some of them provide the possibility to use bindgen at build time to build your own bindings instead.

There's also a technical question around the bundled bindings: do they work correctly cross-platform? on 32-bit vs 64-bit?

That depends on the header as far as I can tell. If it's written in a cross-platform compatible way it does work otherwise there might be issues for 32-bit vs 64bit or for windows vs linux or …

Some of the crates above handle that by just providing different bindings for different platforms and conditionally including the right bindings for the target. Other provide the some feature flag to run bindgen at buildtime for that, and others do both.

@weiznich
Copy link
Contributor Author

Is there any interest in moving this PR forward from the relevant maintainers?

@weiznich
Copy link
Contributor Author

weiznich commented May 3, 2024

@urschrei @michaelkirk @lnicola What is required to move this forward?

@lnicola
Copy link
Member

lnicola commented May 3, 2024

In gdal-sys we bundle pre-built bindings for every minor GDAL version and I don't think we've ran into any compatibility issues (except on Windows where I'm not convinced that people manage to use it).

I don't know the ABI compatibility story of GDAL, but I doubt that they are backwards-compatible.

This commit changes proj-sys to not depend on bindgen by default as that
introduces a quite heavy build time dependency (libclang) which might
not be there on all systems. Instead bundled bindings for the proj
version build by the `bundled_proj` feature are provided.
@weiznich
Copy link
Contributor Author

@urschrei @michaelkirk @lnicola This is another gentle ping if there is any interest in moving this forward

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.

None yet

3 participants