-
Notifications
You must be signed in to change notification settings - Fork 787
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
Fix gem installations that rely on OpenSSL when build_package_mac_openssl() is used #1440
Conversation
Thank you! I suspected I wasn't doing things in a way that was correct or consistent with the rest of the repo but I wasn't sure what the right way was. I'll be very happy when this is fixed, I'll remove a diff+patch step from my company's tool chain. |
Bump! I would find it handy if this were merged. |
|
@hsbt Do you want such gems to install transparently and successfully using the version of openssl that is downloaded and used for the built-in Ruby libraries, or do you want to have to look up the bundle install command you refer to either on Stackoverflow or here, and run that in order to successfully configure and install such gems? |
Is there any update regarding this approach? Because with the recent updates from Command Line Tools etc, it's becoming harder to installer old Ruby versions on a Macbook. Downgrading the Command Line Tools allows us to build Ruby regarding older openSSL by linking it through Homebrew (or relying on the Ruby build one), but then gems like mysql stop compiling, and the linked solution does not solve it. |
Yes, I think the reason openssl is downloaded by ruby-build in the first place is because of problems with using a brew'd version on a newer Mac or other OS. |
Yes and it still does on the Catalina with the final version. But on the latest command line tools (clang 12) it seems that whatever ruby build does it’s ignored and the compilation keeps failing since none of the required libs such as OpenSSL, readline etc are compiled |
We shouldn't care mysql2 issues in ruby-build. Unfortunately, you can resolve this issue with brianmario/mysql2#1005 (comment) |
|
@hsbt 失礼しますが、このPRはいいと思います。Excuse us, but we think this PR is still good. Please reopen this PR. 🙏 🥺 The code already has: 🙏 🥺 どうもありがとうございます。Thankyou very much. |
This is still a problem, this PR still fixes the problem. Without this PR:
With this PR:
|
If a Ruby gem with native extensions needs to link to OpenSSL and if OpenSSL is in a non-standard location (such as the one provided by Homebrew), then the correct solution is to explicitly provide that location when installing the gem in question. # correct solution
gem install mysql2 -- --with-opt-dir="$(brew --prefix openssl)" This is not a bug. |
I want to clarify, since I think a reader of this PR would get the wrong idea from this statement. The statement is true, gems that rely on a specific version of OpenSSL such as that provided by Homebrew should use the solution you suggest (and a different solution if they're using Bundler). -> brianmario/mysql2#1005 (comment) But that is not the problem we are trying to solve with this PR, and that is why I need to clarify. Every gem we have that uses openssl, across all of our organisation's repositories and gems, works fine with the openssl that is downloaded and used by ruby-build. So, this PR avoids anybody's need to We've been using this PR for years now. Before this PR, we had new developers and para-development staff such as QA stumbling whenever they ran |
I figured I'd chime in with my viewpoint since I ran across this issue at least once, and it bugged me enough to open a PR for it. I view tools like ruby-build as "easy buttons." They're supposed to take something that we have to do daily that was a complete pain in the ass and make it trivial. So if I had to come up with ruby-build's mission statement, it would be to install Ruby versions that "just work" on the platforms the project chooses to support. Since ruby-build is installing Ruby, it's also installing the To me, that's a bit like taking delivery of a new car with one of the doors missing. Is it a car? Yes. Does it run and get me places? Sure. Is it the year, model, and color I ordered? Yup. But it's missing a damn door! And that's inconvenient and certainly not what I expected. Predictable, consistent expectations are everything in software, and people expect gem installs to succeed, particularly when they use standard libraries already required for Ruby's compilation. That said, I wonder if the middle ground here is less about ensuring OpenSSL itself works. Perhaps we should focus more on ensuring that any gem we ask to install that uses a standard library that Ruby already compiles against can find that same library as ruby-build provides it. For example, readline is another library that ruby-build will automatically manage as required. I'm pretty sure that if I had a version of Ruby installed that required ruby-build to supply readline, and I tried to install a gem that relied on readline, I would get a similar error to what we get now with gems that depend on OpenSSL. So if we moved (Granted, I haven't tested that, and I'm not 100% sure it would work, but my question remains.) |
It's a good point about |
Thanks for explaining. Now that I read this further, I see that the original motivation for this PR wasn't to necessarily make the
I would certainly be more open to that. @hsbt How would you feel about this compromise? |
In my investigation, @puyo and @pstengel are miss-understanding.
I used over the 400+ gems for my work. But this problem only happened mysql2 gem because this issue libmysqlclient depends on homebrew package, not gem. In the other hand, this issue already fixed by upstream at brianmario/mysql2@e2503dc. I still believe this issue should be fixed mysql2 gem side. |
I could be misunderstanding—it's been a while since I dealt with this issue. However, if I have time later today, I'll see if I can put together a proof for discussion here. |
Please do investigate and report back. If this issue only affects the mysql2 gem, and the fix is already in mysql2 upstream, then I'm on @hsbt side and I would rather not make any change to how Ruby is built. |
Today I removed my downstream patch and reinstalled all my asdf ruby installations from the ground up. I'll let you know if I encounter any |
mysql2-0.5.4 fixed this issue. https://github.com/brianmario/mysql2/releases/tag/0.5.4 |
Test for executables but not functions
This PR is an alternate approach to #1439. Credit goes to @puyo for identifying the issue.
Looking through the code, I believe using
package_option
is the preferred way to add configuration options. I took @puyo's fix and converted it to usepackage_option
instead.I can confirm this fix works—I was having the same issue compiling
mysql2
on macOS Catalina. It's no longer a problem with this change in place.