hyperium / hyper

An HTTP library for Rust
https://hyper.rs
MIT License
14.63k stars 1.6k forks source link

cargo-c integration and dynamic linking #3786

Closed kpcyrd closed 1 week ago

kpcyrd commented 1 week ago

Is your feature request related to a problem? Please describe. I'm trying to get the FFI interface of hyper up to speed with rustls-ffi, for integration in an operating system.

Compare the current curl hyper documentation (which wants you to manually build and link cdylib objects) to the current curl rustls documentation (that generates and installs a .so file, headers and and pkg-config integration for you @cpu has pointed out this document is not using cargo-c, the rustls-ffi pull request linked below is a better resource to look into).

Most of the work to get rustls to this point was done in this pull request: https://github.com/rustls/rustls-ffi/pull/274

Describe the solution you'd like I'd like hyper to integrate with the pkg-config ecosystem that Linux distributions build upon, preferably through cargo-c.

Describe alternatives you've considered The curl hyper integration is currently planned for removal in January 2025.

Additional context There may be some additional context in https://github.com/rustls/rustls-ffi/issues/345.

There was development work done on cargo-c itself specifically for rustls-ffi that you may want to consider, in case you have concerns about dynamic linking and ABI stability: https://github.com/lu-zero/cargo-c/issues/345

cpu commented 1 week ago

For what it's worth I've been happy with cargo-c and the upstream maintainers have been very helpful. In rustls-ffi I'm moving towards replacing the old Makefile approach (as linked to from the current curl docs) and instead recommending cargo-c as the blessed path for building the library (static or dynamic).

seanmonstar commented 1 week ago

I've installed cargo-c locally and tried it out, seems like the only thing that is missing is adding a capi feature, and perhaps some options to use the pre-existing header file, and... that's it?

seanmonstar commented 1 week ago

Started #3787.