Skip to content

Static OpenSSL Linking for MacOS and Windows #278

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

Closed
wants to merge 1 commit into from

Conversation

rustysec
Copy link

I made some build.rs updates to support statically linking openssl + curl on MacOS and Windows. Previously, this worked flawlessly against musl on linux, but the other platforms still required extern dependencies once compiled.

I tried to keep the changes as minimal as possible, and if there is a better way to accomplish this please just let me know.

I use curl-rust in production and have to support many platforms. Sometimes we run into old XP systems that don't support TLS natively and thus statically bringing openssl in a fat binary is the only way to achieve communications. Similarly on MacOS, I'm not able to guarantee the presence or version of a dynamically linked openssl version on the host.

I used the example app from the README and this feature set to produce binaries for windows and MacOS to verify the changes work.

Note: originally i had introduced a completely separate feature flag for forcing this as to leave the current behavior in tact. I decided against it eventually but can definitely bring it back if so desired.

@rustysec
Copy link
Author

I'll look into the failures!

@alexcrichton
Copy link
Owner

Thanks for this! I think it might be best to pull this in as a new feature, perhaps static-openssl. That way it wouldn't break existing users of static-ssl who use it primarily only for Linux and leave native SSL support to Windows/OSX

@rustysec
Copy link
Author

That's how I originally did it in my other branch, I was trying to make this one simpler. However, you're totally correct... I didn't quite take into consideration the static curl + dynamic openssl use case.

@rustysec
Copy link
Author

i haven't forgotten about this! will hopefully fix up the branch soon.

@rustysec
Copy link
Author

i'm going to close this and open another pr since my branch has drifted so far from master

@rustysec rustysec closed this Aug 22, 2019
@rustysec rustysec deleted the static-linking branch August 22, 2019 23:41
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.

2 participants