Skip to content

wolfssl-sys: provide library paths to downstream crates, allow enabling some optional features#225

Merged
kp-mariappan-ramasamy merged 2 commits into
expressvpn:mainfrom
namib-project:add_sys_cargo_metadata
Feb 23, 2026
Merged

wolfssl-sys: provide library paths to downstream crates, allow enabling some optional features#225
kp-mariappan-ramasamy merged 2 commits into
expressvpn:mainfrom
namib-project:add_sys_cargo_metadata

Conversation

@pulsastrix

Copy link
Copy Markdown
Contributor

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

CLAassistant commented Mar 3, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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 ?

@pulsastrix pulsastrix force-pushed the add_sys_cargo_metadata branch from 4515216 to 77d6f00 Compare March 4, 2025 13:05
@pulsastrix

Copy link
Copy Markdown
Contributor 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

pulsastrix commented Mar 6, 2025

Copy link
Copy Markdown
Contributor Author

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 2 times, most recently from 529b3a5 to 8567a55 Compare March 10, 2025 15:17
@kp-mariappan-ramasamy

kp-mariappan-ramasamy commented Aug 21, 2025

Copy link
Copy Markdown
Contributor

@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 ?

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 8567a55 to 6b58661 Compare February 1, 2026 13:29

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@kp-mariappan-ramasamy kp-mariappan-ramasamy merged commit c8b07c4 into expressvpn:main Feb 23, 2026
22 checks passed
kp-mariappan-ramasamy added a commit that referenced this pull request Feb 24, 2026
I missed updating the version when I merged this PR
#225
kp-mariappan-ramasamy added a commit that referenced this pull request Mar 5, 2026
I missed updating the version when I merged this PR
#225
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