Skip to content

Conversation

pulsastrix
Copy link

This PR makes two changes to wolfssl-sys that allow downstream crates to...

A) ...determine the path of the the linked version of wolfSSL. This allows downstream crates that themselves link against C libraries to build and link those against the same version of wolfSSL that is used by this crate (avoiding linking to multiple instances of wolfSSL at once).

To do so, the build script now prints some extra metadata which is then passed to dependent crates by cargo, see https://doc.rust-lang.org/cargo/reference/build-script-examples.html#using-another-sys-crate.

B) ...enable some optional features in wolfSSL. While those are not required for wolfssl-rs, dependent C libraries may need them to be available. For now, I have limited this to features that are required for my own use case (see below), but this could of course also be expanded to all other optional features if necessary.

An example use case for the changes in this PR would be linking the libcoap binding crate libcoap-rs to this crate's version of wolfSSL: namib-project/libcoap-rs#45

@pulsastrix pulsastrix requested a review from a team as a code owner March 3, 2025 18:53
@CLAassistant
Copy link

CLAassistant commented Mar 3, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@kp-mariappan-ramasamy kp-mariappan-ramasamy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good. Thanks for the contribution.

@kp-mariappan-ramasamy
Copy link
Contributor

Our CI is configured to use Earthly satellites, which will not be enabled for forked projects.
Allow me some time, I will make CI work with forked repos.

@kp-mariappan-ramasamy
Copy link
Contributor

I have merged a fix to run CI in github runners instead of earthly satellite. Can you please rebase your branch on top of main ?

Exporting root and include metadata of wolfssl allows other C library binding crates to link/build their C libraries to/for the same version of wolfssl as the wolfssl-sys crate, which helps prevent linking multiple versions of the same libraries at once.
@pulsastrix pulsastrix force-pushed the add_sys_cargo_metadata branch from 4515216 to 77d6f00 Compare March 4, 2025 13:05
@pulsastrix
Copy link
Author

Done. I also ran cargo fmt on build.rs, which I forgot to do yesterday.

Thanks for the quick reply!

@pulsastrix pulsastrix force-pushed the add_sys_cargo_metadata branch from 77d6f00 to 97414f6 Compare March 6, 2025 15:23
@pulsastrix
Copy link
Author

pulsastrix commented Mar 6, 2025

Apparently, the hmac feature was already enabled by default in the wolfssl build, and adding it as a separate feature caused it to be disabled when building wolfssl-sys for the wolfssl crate, my bad.

To fix this (and avoid disabling a previously enabled-by-default feature, which would probably constitute a breaking change), I've removed the optional feature, and it should now always be enabled again.

@pulsastrix pulsastrix force-pushed the add_sys_cargo_metadata branch from 97414f6 to 529b3a5 Compare March 10, 2025 15:12
@pulsastrix pulsastrix force-pushed the add_sys_cargo_metadata branch from 529b3a5 to 8567a55 Compare March 10, 2025 15:17
@kp-mariappan-ramasamy
Copy link
Contributor

kp-mariappan-ramasamy commented Aug 21, 2025

@pulsastrix There is one more fix needed for enabling external contributors.
I have merged those changes in this PR #284 today

Can you please rebase once again ?

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.

3 participants