Created attachment 874491 [details] Build log >>> Install dev-ruby/erubi-1.12.0 into /var/tmp/portage/dev-ruby/erubi-1.12.0/image * Running install phase for ruby31 * Running install phase for ruby32 /var/tmp/portage/dev-ruby/erubi-1.12.0/work/ruby32/erubi-1.12.0/lib/erubi.rb:23:in `<module:Erubi>': uninitialized constant Erubi::ERB (NameError) define_singleton_method(:h, ERB::Escape.instance_method(:html_escape)) ^^^^^^^^ from /var/tmp/portage/dev-ruby/erubi-1.12.0/work/ruby32/erubi-1.12.0/lib/erubi.rb:3:in `<top (required)>' from <internal:/usr/lib64/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require' from <internal:/usr/lib64/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require' from (eval):2:in `<main>' from -e:1:in `eval' from -e:1:in `<main>' * ERROR: dev-ruby/erubi-1.12.0::gentoo failed (install phase): * Unable to generate gemspec file.
I can't reproduce this. ERB should be part of ruby itself, and it also available as a gem (dev-ruby/erb). When both are installed the gem takes precedence. Do you have dev-ruby/erb installed? Does it help to toggle that? Looking at this further it seems that ruby 3.1 might not correctly install erb, but it seems that you are getting this error with ruby 3.2 (I assume this is your eselected version).
Hi Hans, I do not have dev-ruby/erb installed and cannot find a package named like that also. Is it a typo for dev-ruby/irb with "i"? That I have installed with both 3.1 and 3.1 enabled via USE. My eselected ruby is ruby31, not ruby32.
(In reply to Sebastian Pipping from comment #2) > Hi Hans, I do not have dev-ruby/erb installed and cannot find a package > named like that also. Ah, my mistake. That package is (still) in my graaff overlay. And I can reproduce this without that package installed, but only for ruby31.
(In reply to Hans de Graaff from comment #3) > Ah, my mistake. That package is (still) in my graaff overlay. And I can > reproduce this without that package installed, but only for ruby31. The error I get is different. Your error seems to indicate that erb/escape can be required but doesn't define the module. What is the output of ruby31 -e "require 'erb/escape'; puts ERB::Escape.class.inspect" Bonus points to using strace to determine which escape.so actually gets read.
> What is the output of > > ruby31 -e "require 'erb/escape'; puts ERB::Escape.class.inspect" # ruby31 -e "require 'erb/escape'; puts ERB::Escape.class.inspect" <internal:/usr/lib64/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:86:in `require': cannot load such file -- erb/escape (LoadError) Did you mean? erb/version from <internal:/usr/lib64/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:86:in `require' from -e:1:in `<main>' > Bonus points to using strace to determine which escape.so actually gets read. Did someone say strace? :) I love strace! :) # strace -F -efile ruby31 -e "require 'erb/escape'; puts ERB::Escape.class.inspect" |& grep -F escape.so | grep -v ENOENT <no output, i.e. no escape.so found and loaded?>
(In reply to Sebastian Pipping from comment #5) > # ruby31 -e "require 'erb/escape'; puts ERB::Escape.class.inspect" > <internal:/usr/lib64/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require. > rb>:86:in `require': cannot load such file -- erb/escape (LoadError) That is unexpected because the error in the build log happens inside a block where this require has succeeded... so I would expect it to succeed here as well. > Did someone say strace? :) I love strace! :) Perhaps it will be helpful to use the same strace on the emerge attempt that fails. You could also try looking for "escape.rb" to cover all the ways require may find and load code.
> Perhaps it will be helpful to use the same strace on the emerge attempt that > fails. You could also try looking for "escape.rb" to cover all the ways > require may find and load code. It does not find escape.so or escape.rb anywhere: # strace -F -efile ebuild erubi-1.12.0.ebuild manifest clean install |& grep -F escape. | grep -vF ENOENT <no output> And I don't seem to have either file anywhere: # find /usr/lib*/ruby/ -name escape.\* <no output> Based on https://www.portagefilelist.de/?fs=escape.so#panchor output it seems that escape.so would be provided by dev-lang/ruby? I re-installed dev-lang/ruby-3.2.2-r5 from source (with USE="gdbm ipv6 ssl static-libs") and I still do not have a file escape.so or escape.rb. This is the 3.2.0 erb I do have: # qlist dev-lang/ruby | grep -Fw erb | grep -F 3.2 /usr/lib64/ruby/gems/3.2.0/gems/erb-4.0.2/libexec/erb /usr/lib64/ruby/gems/3.2.0/specifications/default/erb-4.0.2.gemspec /usr/lib64/ruby/3.2.0/erb.rb /usr/lib64/ruby/3.2.0/erb/version.rb /usr/lib64/ruby/3.2.0/erb/util.rb /usr/lib64/ruby/3.2.0/erb/def_method.rb /usr/lib64/ruby/3.2.0/erb/compiler.rb I found this block of interest in /usr/lib64/ruby/3.2.0/erb/util.rb : #-- # ERB::Escape # # A subset of ERB::Util. Unlike ERB::Util#html_escape, we expect/hope # Rails will not monkey-patch ERB::Escape#html_escape. begin # We don't build the C extension for JRuby, TruffleRuby, and WASM if $LOAD_PATH.resolve_feature_path('erb/escape') require 'erb/escape' end rescue LoadError # resolve_feature_path raises LoadError on TruffleRuby 22.3.0 end unless defined?(ERB::Escape) module ERB::Escape def html_escape(s) CGI.escapeHTML(s.to_s) end module_function :html_escape end end So that file is trying to define ERB::Escape. What's interesting is that that once I change "require 'erb/escape'" to plain "require 'erb'" things start to work: # ruby32 -e "puts require 'erb/escape'; puts ERB::Escape.class.inspect" # bad true # okay?! -e:1:in `<main>': uninitialized constant ERB (NameError) puts require 'erb/escape'; puts ERB::Escape.class.inspect ^^^^^^^^ But: # ruby32 -e "puts require 'erb'; puts ERB::Escape.class.inspect" # good true Module So as a non-Rubyist I would think either (a) erubi needs a different import or (b) Ruby 3.2 needs a fix to to provide escape.so or (c) erubi needs ask for more use flags from Ruby to be sure that escape.so is provided. I'm only guessing around here. What do you think?
PS: All of dev-lang/ruby-3.2.2-r3 to -r5 seem to compile code ext/erb/escape/escape.c into a static .a file and link that right into libruby32.so.3.2.2 for me.
PPS: Turns out things start to work once I USE=-static-libs on dev-lang/ruby-3.2.2-r5. So USE=static-libs breaks "require 'erb/escape'" with Ruby 3.2. Extending the ticket title accordingly.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=460c97b79bf0962e9da7e11c6bbda13bd8c91ddb commit 460c97b79bf0962e9da7e11c6bbda13bd8c91ddb Author: Sam James <sam@gentoo.org> AuthorDate: 2024-06-24 05:35:59 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-06-24 19:40:35 +0000 profiles/base: mask dev-lang/ruby[static-libs] It breaks gem installation in mysterious ways and people keep tripping over it. graaff indicates on the PR that we'd like to remove it entirely for ruby:3.4 given it'll bitrot if it's masked, but that this is a good option for now. Closes: https://bugs.gentoo.org/887223 Closes: https://bugs.gentoo.org/891367 Closes: https://bugs.gentoo.org/903891 Closes: https://bugs.gentoo.org/917139 Signed-off-by: Sam James <sam@gentoo.org> Closes: https://github.com/gentoo/gentoo/pull/37267 Signed-off-by: Sam James <sam@gentoo.org> profiles/base/package.use.mask | 5 +++++ 1 file changed, 5 insertions(+)