prism icon indicating copy to clipboard operation
prism copied to clipboard

Disable GNU `make` implicit variables and Quiet `ar` with `ARFLAGS` rather than `> null`

Open ParadoxV5 opened this issue 10 months ago • 9 comments

CC, AR and ARFLAGS (and also RM and CXX) are all implicit variables in GNU make.

  • CC and AR already defaults to cc and ar, which means CC ?= cc does nothing since before I started tinkering.
  • ARFLAGS defaults to -rv, where v stands for verbose.
    • https://stackoverflow.com/a/40516532 hints that changing it to r avoids printing to null, and printing to /dev/null was the final obstacle for me to build nightly Prism on my MSYS-less Windows setup!

Rather than adapting the Makefile and extconf.rb around them, I disabled them with --no-builtin-variables. While this flag may be GNU-exclusive, the README implies that we only support GNU make.

  • CURDIR from #2706 is also possibly GNU-exclusive.
  • The popularity of GNU means it’s a-okay to be toolset-specific rather than platform-specific.

  • Previously conflicted with #2716

ParadoxV5 avatar Apr 18 '24 00:04 ParadoxV5

(Mac Ruby 2.7 CI failure)

Intriguing. CC and co. should be set from the rbconfig in practice. Considering this was never an issue in my previous Makefile PRs, does this mean that the Mac Ruby 2.7 was set with libtool for AR, nothing for ARFLAGS, and make had a different default for Mac? I do not know how to investigate a Mac problem.

Easy solution: drop Ruby 2.7 support (we’re still in 0.x aren’t we?)

ParadoxV5 avatar Apr 18 '24 00:04 ParadoxV5

Unfortunately we cannot drop 2.7 support, as that is BASERUBY and we need it to build Ruby itself.

kddnewton avatar Apr 19 '24 18:04 kddnewton

CC and AR already defaults to cc and ar, so setting CC to cc does nothing since before I started tinkering.

I'm not sure this is true. Before, we always set CC to cc, so it couldn't be overridden by env vars. Now it's going to be the same CC that Ruby is compiled with.

kddnewton avatar Apr 19 '24 18:04 kddnewton

Before, we always set CC to cc, so it couldn't be overridden by env vars.

Like with ARFLAGS in the PR, I expect the original CC := cc to be overridable by env vars.

Now it's going to be the same CC that Ruby is compiled with.

This though is intended.

ParadoxV5 avatar Apr 19 '24 20:04 ParadoxV5

Like with ARFLAGS in the PR, I expect the original CC := cc to be overridable by env vars.

Oof, I had it mixed up. It’s only overridable with make KEY=VALUE, not from env vars.

ParadoxV5 avatar Apr 19 '24 23:04 ParadoxV5

Hey @ParadoxV5 are you still working on this or should this be closed?

kddnewton avatar May 24 '24 16:05 kddnewton

Hey @ParadoxV5 are you still working on this or should this be closed?

Hey, @kddnewton, now that https://bugs.ruby-lang.org/issues/20499 has properly fixed #2716 in the Ruby upstream, I plan to get back to this these few of days. By the way, any plans to revert the workaround #2725 (after Ruby releases teenies with the fix)? [c.c. @eregon]

ParadoxV5 avatar May 24 '24 17:05 ParadoxV5

I think I'd prefer to leave it because I'd like to support all of the Ruby versions in the range that we support, which includes patch revisions.

kddnewton avatar May 24 '24 20:05 kddnewton

Yeah agreed let's keep that workaround for existing releases and link to the relevant issues to make it easy to figure out from the code why that is needed

eregon avatar May 25 '24 02:05 eregon