Skip to content

Build OpenSSL from source #589

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 4 commits into from
Closed

Build OpenSSL from source #589

wants to merge 4 commits into from

Conversation

sfackler
Copy link
Owner

Closes #580

.arg(os)
.arg("-fPIC");
if target.contains("i686") {
configure.arg("-m32");
Copy link
Collaborator

Choose a reason for hiding this comment

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

You may want to read the cflags from gcc-rs to pass here (instead of manually passing -fPIC/-m32)

Stderr:
{}
",
desc,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you be sure to include output.status in this output as well?

@alexcrichton
Copy link
Collaborator

👍

Perhaps openssl could dogfood this support itself? IIRC we build OpenSSL for ARM on CI

@metajack
Copy link

What is this waiting on?

@sfackler
Copy link
Owner Author

It doesn't work yet in cross compilation contexts and Windows, and I haven't had a chance to finish it.

@alexcrichton
Copy link
Collaborator

We discussed this a bit at the recent all-hands and some thoughts on this were:

  • Downloading OpenSSL is still a bit of a pain, and maybe we can relieve the pressure on @sfackler by having others (e.g. the infra team for Rust) manage releases for an openssl-src crate? That way no one person (notably @sfackler) is on the hook for making releases when CVEs are released, and it should still be beneficial for making depending on this crate "pretty easy" in the sense that it still builds from source, the source is just automatically acquired.
  • This feature could be off-by-default to only allow it in some situations (if necessary).

@alexcrichton
Copy link
Collaborator

I've started a repository for this at https://github.com/alexcrichton/openssl-src-rs. Right now I believe it's got the right logic for building for all "relevant" platforms for now, and there should be CI verifying that the build works and everything at least links correctly. Right now it's intended to be used as a build dependency, so during openssl-sys's fallback after failing to find a global installation it'd build one from source (in theory).

@sfackler and I talked at RustConf about the Windows situation as well. Unfortunately building OpenSSL requires perl to be installed, which while common enough on Unix is pretty rare on Windows. Note though that MinGW is probably ok here where it's easy enough to install perl as a build dependency, but on MSVC it's not quite as trivial.

We discussed in person the possibility of shipping binaries. In this way the MSVC platform would have prebuilt binaries ready-to-go which would be used by default instead of building from source. Upon further reflection, though, I'm not sure this is a great idea:

  • We'd have to have at least crt-static/non-crt-static binaries, doubling the size of the CI and downloads here
  • Being static libraries, I don't believe they're specific to a particular VS compiler. That is, I don't think MSVC guarantees a stable C ABI with the C runtime across revisions of Visual Studio, so the binaries are actually only valid for the visual studio version that produced them.

And that's a little unfortunate! I think I'd be tempted to, for now, advocate for perl as a dependency on Windows to build from source (probably with instructions of how to get it in the README) and go from there. If we can nail down the binary story we could always relax the dependency in the future!

@sfackler how's that sound?

@sfackler
Copy link
Owner Author

I'm a bit suspicious about the cross VS library compatibility issues - plenty of projects provide precompiled Windows libraries without too much trouble AFAIKT. Having to provide crt-static/non-crt-static i686/x86_64 does seem like a bit much though.

I do feel bad about requiring a Perl install but it seems like there isn't a great way to avoid that other than maybe vendoring Perl itself which seems a bit iffy.

@sfackler sfackler closed this Aug 22, 2017
@sfackler sfackler deleted the auto-build branch February 27, 2018 03:59
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants