-
Notifications
You must be signed in to change notification settings - Fork 785
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
Instruct Ruby to fail the build if openssl or psych are missing #2296
Conversation
0bdcff9
to
b56db97
Compare
I think given this is a flag that basically no end user would use and so probably receives little testing I would suggest to avoid using it in ruby-build, it's not so unlikely to cause issues. For instance what if Verifying if openssl/psych is there after building is trivial and portable, that incurs no risks. |
b56db97
to
4dedb48
Compare
Good point about there being no guarantee that |
Could we check the logs for things like:
It would likely work quite well on all Ruby versions. Or maybe even simpler/safer, to automatically scan for these lines and print them highlighted in the ruby-build output? So users can easily see which extensions have been skipped. |
Well at least that feature seems explicitly supported since https://bugs.ruby-lang.org/issues/13302, so it seems not so risky. |
That was my initial approach to solving this, before I discovered
|
I'm not sure! That is why I cc'ed some Ruby core folks above to ask for advice. 🙇 I'm hoping that it's simply ignored, since that would be preferable for me. If an unrecognized flag causes build failures, that would be a dealbreaker (even for Ruby versions that are so old that they are EOL). |
4dedb48
to
39adcd8
Compare
Normally, Ruby `make` step will print a warning about any missing extensions, but will not abort the build and instead proceed as normal. Since Ruby installations without openssl or psych are essentially broken, ruby-build used to have a `verify_openssl` build step to test if the newly built Ruby can load these extensions, and print helpful information and abort the build on errors: Loading the Ruby openssl extension failed ERROR: Ruby install aborted due to missing extensions The `verify_opensl` implementation was necessary to provide a good experience for ruby-build users, but was hacky and I would prefer to eliminate it. It appears that passing `--with-ext=openssl,psych` to the Ruby configure step marks those extensions as mandatory and fails the `make` process if they failed to build. This is exactly the behavior we want, so this enables the configure option for all Ruby builds.
The functionality to fail the build if openssl or psych are missing is now built into the `./configure && make` phase for Ruby.
A very common type of build failure is that the Ruby "openssl" extension failed to compile. However, when that happens, ruby-build just prints a generic "BUILD FAILED" message. To find out what happened, the user would first have to open the ruby-build log, note the "Following extensions are not compiled" section, then figure out how to find the exact location to the "ext/openssl/mkmf.log" file for more information. Now, when `make` fails, ruby-build will automatically forward the "Following extensions are not compiled" information to stderr.
39adcd8
to
4a3ff7e
Compare
Adding another comment to bust GitHub's frontend cache. I am positive there has been timeline items on this thread newer than 2 days ago, but GitHub isn't showing it even after refreshes. |
@eregon Thank you for the in-depth reflection on this PR. I went back and ascertained that using I am very pleased that we now git rid of the long inline Ruby script that did the job of a single Ruby configuration flag. |
It breaks build for at least Ruby 2.4.10. Switching back to v20231114 allows to build 2.4.10 again. |
Normally, Ruby
make
step will print a warning about any missing extensions, but will not abort the build and instead proceed as normal.Since Ruby installations without openssl or psych are essentially broken, ruby-build used to have a
verify_openssl
build step to test if the newly built Ruby can load these extensions, and print helpful information and abort the build on errors:The
verify_opensl
implementation was necessary to provide a good experience for ruby-build users, but was hacky and I would prefer to eliminate it. Fixes #2241, fixes #1415It appears that passing
--with-ext=openssl,psych
to the Ruby configure step marks those extensions as mandatory and fails themake
process if they failed to build. That is exactly the behavior we want, so this change enables the configure option for all Ruby builds. ruby/ruby@b58a30e/cc @nobu @hsbt: as people who are more familiar with Ruby build process than myself, do you foresee any potential problems with using
./configure --with-ext=openssl,psych
by default when building any Ruby version, even old ones? From what I can see, the--with-ext
flag seems to have existed for a long time, but only started having the behavior that we want from Ruby 2.5.0. Thank you!The new default ruby-build behavior can be avoided by explicitly passing another
--with-ext
value, e.g.: