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

yarn run rover fails missing libssl.1.1.dylib, m1 mac #554

Closed
danilobuerger opened this issue May 20, 2021 · 9 comments · Fixed by #558
Closed

yarn run rover fails missing libssl.1.1.dylib, m1 mac #554

danilobuerger opened this issue May 20, 2021 · 9 comments · Fixed by #558
Labels

Comments

@danilobuerger
Copy link

Description

When trying to use rover, it fails with

❯ yarn run rover
yarn run v1.22.10
$ node_modules/.bin/rover
dyld: Library not loaded: /usr/local/opt/[email protected]/lib/libssl.1.1.dylib
  Referenced from: node_modules/binary-install/bin/rover
  Reason: image not found
✨  Done in 2.07s.

Steps to reproduce

yarn init
yarn add --dev @apollo/rover
yarn run rover

Expected result

Rover should work

Actual result

Rover crashes

Environment

  • Operating system and version: macOS 11.3.1, M1
  • Shell: zsh
  • Version of Rover: 0.1.1
  • Apollo Studio Plan: team
  • Installation method: yarn
@danilobuerger danilobuerger added bug 🐞 triage issues and PRs that need to be triaged labels May 20, 2021
@EverlastingBugstopper
Copy link
Contributor

Hi @danilobuerger - thanks so much for the report. Openssl issues are super common and we'd love to address this as you won't be the only person to run into this problem!

I've pushed up a branch that I think might help you, but since I don't have an M1 Macbook I can't confirm that it will. If you would be so kind, could you run the following commands?

If you don't have rust installed, you can get it with:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Then, run

cargo install --git https://github.com/apollographql/rover --branch avery/no-openssl

This second command may take a while as it will build Rover from source. After that, you can try running which rover, and make sure it is pointing to the binary you just built (/home/user/.cargo/bin/rover.

Then run rover and see if it has any issues! If it still doesn't work, could you give me the output of openssl --version?

@danilobuerger
Copy link
Author

Hi @EverlastingBugstopper thanks for the quick reply! The suggested steps work. I am able to use rover with it:

❯ /Users/danilo/.cargo/bin/rover --version
Rover 0.1.2

@danilobuerger
Copy link
Author

@EverlastingBugstopper I just tried with 0.1.3. Sadly, the error persists as before.

@danilobuerger
Copy link
Author

@EverlastingBugstopper
Copy link
Contributor

Ugh! That's frustrating @danilobuerger - I'm sorry you're still running into this issue. That line you linked was actually supposed to be the solution - the idea being that we would "vendor" or embed the necessary OpenSSL code right into the binary itself, removing the runtime dependency.

Unfortunately, it does not look like that actually fixed the problem! I don't actually have an M1 machine that I can test things on at the moment, this is something I'll tackle as soon as I can actually reproduce and reliably test on a machine.


In the meantime, I am super interested if you're able to build from source, nothing should have changed between the cargo command I gave you earlier...

Can you run cargo install --git https://github.com/apollographql/rover --rev v0.1.3 and see if it works? If it works (which.. would be confusing to me) you can run mv ~/.cargo/bin/rover /path/to/your/project/node_modules/binary-install-bin/rover and your npm scripts should work as expected.

Clearly this is not ideal and we'll work on a longer term fix but it might be a workaround you can use for now.

@danilobuerger
Copy link
Author

@EverlastingBugstopper I might have figured it out, maybe we can still get it fix easily:

cargo install --git https://github.com/apollographql/rover --rev v0.1.3 works, and this is why I think it does:

It seems like openssl is not vendored and instead uses the automatic finding mechanism with homebrew as described in https://docs.rs/openssl/0.10.34/openssl/#automatic .

When using the binary created with cargo install, I get a arm64 binary:

❯ file ~/.cargo/bin/rover
/Users/danilo/.cargo/bin/rover: Mach-O 64-bit executable arm64

This will look for openssl in the correct spot. I verified it by removing openssl, and then this arm64 binary fails with:

❯ ~/.cargo/bin/rover                             
dyld: Library not loaded: /opt/homebrew/opt/[email protected]/lib/libssl.1.1.dylib
  Referenced from: /Users/danilo/.cargo/bin/rover
  Reason: image not found
[1]    5634 abort      ~/.cargo/bin/rover

So when installing via yarn, I don't get a arm64 binary, instead I get x86:

❯ file node_modules/binary-install/bin/rover 
node_modules/binary-install/bin/rover: Mach-O 64-bit executable x86_64

And for that reason, the automatic finding mechanism looks in the x86 homebrew location, not the arm64 location.

So my proposed fix would be to also provide a arm64 binary and then everything should work.

@EverlastingBugstopper
Copy link
Contributor

Ok @danilobuerger - I've got an explanation written up in #579, and a fix in #580 that I've tested on a real M1 machine myself. New release incoming! Thanks a bunch for your patience here.

@danilobuerger
Copy link
Author

@EverlastingBugstopper thanks a lot! I can confirm that its working now. The binary is still x86 (as you explained) but now has a vendored openssl on board.

@EverlastingBugstopper
Copy link
Contributor

Thanks for confirming and please let us know if you run into any other issues.

We'll aim to get native ARM builds in place after we can run MacOS 11 on GitHub Actions 😊

@abernix abernix removed the triage issues and PRs that need to be triaged label Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants