From: Jay Mav via ruby-core Date: 2023-11-17T12:16:45-08:00 Subject: [ruby-core:115409] Re: Ruby 3.2.2 - rbconfig.rb's MAKEFILE_CONFIG --===============5850374498211352620== Content-Type: multipart/alternative; boundary="0000000000009975b1060a5ed111" --0000000000009975b1060a5ed111 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable With the fix in ruby-shadow-ruby32's extconf.rb for using RbConfig::CONFIG['host_os'], I confirmed that the gem is installed successfully now. Thanks for fixing it. However, if there's any other gem which uses MAKEFILE_CONFIG, then it would run into the same error. So it would be better to fix it in mkconfig.rb. Thanks. On Fri, Nov 17, 2023 at 2:49=E2=80=AFAM Benoit Daloze via ruby-core < ruby-core@ml.ruby-lang.org> wrote: > There is already a PR upstream to fix this: > https://github.com/apalmblad/ruby-shadow/pull/31 > > On Fri, Nov 17, 2023 at 11:46=E2=80=AFAM Benoit Daloze wrote: > >> Hello, >> >> Where do you see such code, >> https://github.com/ruby/ruby/blob/master/lib/mkmf.rb doesn't seem to >> have it. >> >> In any case, it's not a good idea to use `CONFIG` in `extconf.rb`, use >> `RbConfig::CONFIG` instead (like everywhere else), that's always expande= d. >> >> Benoit >> >> On Fri, Nov 17, 2023 at 2:48=E2=80=AFAM Jay Mav via ruby-core < >> ruby-core@ml.ruby-lang.org> wrote: >> >>> Hello Ruby Dev Team, >>> With Ruby 3.2.2, gem install fails because in rbconfig.rb, >>> MAKEFILE_CONFIG's $(target_os) is not expanded (whereas CONFIG's is >>> expanded correctly). >>> >>> The inline doc in mkconfig.rb states that the caller can expand >>> MAKEFILE_CONFIG's values by calling RbConfig::expand(). >>> >>> However, ruby-shadow gem's Makefile generator -- extconf.rb -- does not >>> call expand and directly uses mkmf.rb's CONFIG instance (which is >>> RbConfig::MAKEFILE_CONFIG), because of which $(target_os) does not get >>> expanded. >>> This causes ruby-shadow gem install to fail with Ruby 3.2.2. >>> >>> Would the Ruby Dev Team accept the following proposal to fix >>> mkconfig.rb, so that the generated rbconfig.rb instantiates MAKEFILE_CO= NFIG >>> AFTER CONFIG's values have been expanded? >>> >>> # Existing code... >>> CONFIG.each_value do |val| >>> RbConfig::expand(val) >>> end >>> # Move instantiation of MAKEFILE_CONFIG after expanding CONFIG's >>> values. >>> MAKEFILE_CONFIG =3D {} >>> CONFIG.each{|k,v| MAKEFILE_CONFIG[k] =3D v.dup} >>> >>> If we fix it in mkconfig.rb, we can avoid callers having to explicitly >>> call expand for MAKEFILE_CONFIG's values. >>> >>> Thanks. >>> ______________________________________________ >>> ruby-core mailing list -- ruby-core@ml.ruby-lang.org >>> To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org >>> ruby-core info -- >>> https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lan= g.org/ >> >> ______________________________________________ > ruby-core mailing list -- ruby-core@ml.ruby-lang.org > To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org > ruby-core info -- > https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.= org/ --0000000000009975b1060a5ed111 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
With the fix in=20 ruby-shadow-ruby32's extconf.rb for using RbConf= ig::CONFIG['host_os'], I confirmed that the gem is installed succes= sfully now.

Thanks for fixing it.
<= div>
However, if there's any other gem which uses MAKEFIL= E_CONFIG, then it would run into the same error. So it would be better to f= ix it in mkconfig.rb.

Thanks.

<= div class=3D"gmail_quote">
On Fri, Nov= 17, 2023 at 2:49=E2=80=AFAM Benoit Daloze via ruby-core <ruby-core@ml.ruby-lang.org> wrote:
= There is already a PR upstream to fix this: https://github.com/apalmbla= d/ruby-shadow/pull/31

On Fri, Nov 17, 2023 at 11:46=E2=80=AFAM Benoit Da= loze <eregontp@g= mail.com> wrote:
Hello,

Where do you = see such code, https://github.com/ruby/ruby/blob/master/lib/mkmf.rb= doesn't seem to have it.

In any case, it&= #39;s not a good idea to use `CONFIG` in `extconf.rb`, use `RbConfig::CONFI= G` instead (like everywhere else), that's always expanded.

Benoit

On Fri, Nov 17, 2023 at 2:48=E2=80=AFAM Ja= y Mav via ruby-core <ruby-core@ml.ruby-lang.org> wrote:
Hello Ruby Dev Team= ,
With Ruby 3.2.2, gem install fails because in rbconfig.rb, MAKEFILE_CO= NFIG's $(target_os) is not expanded (whereas CONFIG's is expanded c= orrectly).

The inline doc in mkconfig.rb states that the caller can= expand MAKEFILE_CONFIG's values by calling RbConfig::expand().
However, ruby-shadow gem's Makefile generator -- extconf.rb -- does no= t call expand and directly uses mkmf.rb's CONFIG instance (which is RbC= onfig::MAKEFILE_CONFIG), because of which $(target_os) does not get expande= d.
This causes ruby-shadow gem install to fail with Ruby 3.2.2.

W= ould the Ruby Dev Team accept the following proposal to fix mkconfig.rb, so= that the generated rbconfig.rb instantiates MAKEFILE_CONFIG AFTER CONFIG&#= 39;s values have been expanded?

=C2=A0 # Existing code...
=C2=A0 = CONFIG.each_value do |val|
=C2=A0 =C2=A0 RbConfig::expand(val)
=C2=A0= end
=C2=A0 # Move instantiation of MAKEFILE_CONFIG after expanding CONF= IG's values.
=C2=A0 MAKEFILE_CONFIG =3D {}
=C2=A0 CONFIG.each{|k,= v| MAKEFILE_CONFIG[k] =3D v.dup}

If we fix it in mkconfig.rb, we can= avoid callers having to explicitly call expand for MAKEFILE_CONFIG's v= alues.

Thanks.
=C2=A0______________________________________________
=C2=A0ruby-core mailing list -- ruby-core@ml.ruby-lang.org
=C2=A0To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
=C2=A0ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.o= rg/
=C2=A0______________________________________________
=C2=A0ruby-core mailing list -- ruby-core@ml.ruby-lang.org
=C2=A0To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
=C2=A0ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.o= rg/ --0000000000009975b1060a5ed111-- --===============5850374498211352620== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/ --===============5850374498211352620==--