Skip to content
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

Compile OpenSSL from source on OSX #3332

Merged
merged 1 commit into from
Nov 27, 2016
Merged

Conversation

alexcrichton
Copy link
Member

I'm seeing a bunch of weird illegal instructions on OSX nightlies for
Cargo. My guess is that they're all related to OpenSSL linking. Right
now we're linking from Homebrew but I have a sneaking suspicion that it
compiles with -march=native rather than what we'd like as a portable
binary. To work around this compile OpenSSL ourselves and link it that
way.

Note that I believe this won't bring in the certificate trust store of
OpenSSL on OSX (or at least not the right one from the keychain). We
shouldn't need that, however, as OpenSSL is just used as the
cryptographic primitives in libssh2 and Cargo itself. So in that sense
we shouldn't need it for actually SSL at all.

@rust-highfive
Copy link

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@SimonSapin
Copy link
Contributor

I’ve seen Travis fail with "Illegal instruction: 4" on OS X on the Nigthly channel, but OpenSSL is not involved. In fact, even cargo --version fails:

https://travis-ci.org/servo/string-cache/jobs/179029570

@alexcrichton
Copy link
Member Author

@SimonSapin unfortunately I haven't confirmed that the illegal instruction is specifically related to OpenSSL, but it's the biggest thing that changed that'd cause me to suspect it. OpenSSL is actually always related I believe because we initialize the various libraries (libgit2, libssh2, openssl) I believe on startup no matter the command. So in that sense I think there's at least a vector for OpenSSL to get involved?

Obviously a stack trace would be best but unfortunately I don't know how to get one out of Travis.

@SimonSapin
Copy link
Contributor

Oh, sorry, you mean cargo itself using OpenSSL. I was thinking of cargo building the rust-openssl crate.

@alexcrichton
Copy link
Member Author

Oh right yeah Cargo's linking to OpenSSL, but the way we do that changed very recently, and that's what I think the bug is (pulling in bad binaries).

Another reason I suspect this is at fault is that locally Cargo works just fine for me, but I also likely have a more recent Mac with a newer CPU than what Travis is running (presumably)

I'm seeing a bunch of weird illegal instructions on OSX nightlies for
Cargo. My guess is that they're all related to OpenSSL linking. Right
now we're linking from Homebrew but I have a sneaking suspicion that it
compiles with `-march=native` rather than what we'd like as a portable
binary. To work around this compile OpenSSL ourselves and link it that
way.

Note that I believe this won't bring in the certificate trust store of
OpenSSL on OSX (or at least not the right one from the keychain). We
shouldn't need that, however, as OpenSSL is just used as the
cryptographic primitives in libssh2 and Cargo itself. So in that sense
we shouldn't need it for actually SSL at all.
@alexcrichton
Copy link
Member Author

@bors: r+

@bors
Copy link
Collaborator

bors commented Nov 26, 2016

📌 Commit 8ab8595 has been approved by alexcrichton

@bors
Copy link
Collaborator

bors commented Nov 26, 2016

⌛ Testing commit 8ab8595 with merge 3568be9...

bors added a commit that referenced this pull request Nov 26, 2016
Compile OpenSSL from source on OSX

I'm seeing a bunch of weird illegal instructions on OSX nightlies for
Cargo. My guess is that they're all related to OpenSSL linking. Right
now we're linking from Homebrew but I have a sneaking suspicion that it
compiles with `-march=native` rather than what we'd like as a portable
binary. To work around this compile OpenSSL ourselves and link it that
way.

Note that I believe this won't bring in the certificate trust store of
OpenSSL on OSX (or at least not the right one from the keychain). We
shouldn't need that, however, as OpenSSL is just used as the
cryptographic primitives in libssh2 and Cargo itself. So in that sense
we shouldn't need it for actually SSL at all.
@bors
Copy link
Collaborator

bors commented Nov 27, 2016

☀️ Test successful - cargo-cross-linux, cargo-linux-32, cargo-linux-64, cargo-mac-32, cargo-mac-64, cargo-win-gnu-32, cargo-win-gnu-64, cargo-win-msvc-32, cargo-win-msvc-64
Approved by: alexcrichton
Pushing 3568be9 to master...

@bors bors merged commit 8ab8595 into rust-lang:master Nov 27, 2016
@alexcrichton alexcrichton deleted the build-openssl branch November 27, 2016 02:37
bors added a commit that referenced this pull request Dec 2, 2016
Backporting fixes to 1.14.0

This is a backport of the following PRs to fix the actual issue, rust-lang/rust#37969.

* #3311 - first attempt to fix OpenSSL linkage on OSX
* #3315 - second attempt to fix linkage
* #3325 - fix a flaky test causing lots of CI problems
* #3332 - actual fix for OpenSSL linkage on OSX
* #3345 - first PR for automation changes
* #3350 - second PR for automation changes
* #3326 - update git2 to support netbsd
* #3331 - update git2 to fix segfaults in tests
* #3342 - update git2 to fix cert paths
@ehuss ehuss added this to the 1.15.0 milestone Feb 6, 2022
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.

6 participants