Skip to content
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

truffleruby-head 24.0.0-dev: Failing to compile dependant stringio gem. #699

Closed
junaruga opened this issue Nov 23, 2023 · 14 comments
Closed

Comments

@junaruga
Copy link
Member

I see the following build errors in the truffleruby-head cases in CI.

https://github.com/ruby/openssl/actions/runs/6974797041/job/18981006346#step:3:20

  /home/runner/.rubies/truffleruby-head/bin/ruby --version
  truffleruby 24.0.0-dev-9a84a125, like ruby 3.2.2, GraalVM CE Native [x86_64-linux]

https://github.com/ruby/openssl/actions/runs/6974797041/job/18981006346#step:4:20

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/home/runner/.rubies/truffleruby-head/lib/gems/gems/stringio-3.0.9/ext/stringio
/home/runner/.rubies/truffleruby-head/bin/ruby extconf.rb
creating Makefile

current directory:
/home/runner/.rubies/truffleruby-head/lib/gems/gems/stringio-3.0.9/ext/stringio
make DESTDIR\= sitearchdir\=./.gem.20231123-1869-nljcsp
sitelibdir\=./.gem.20231123-1869-nljcsp clean

current directory:
/home/runner/.rubies/truffleruby-head/lib/gems/gems/stringio-3.0.9/ext/stringio
make DESTDIR\= sitearchdir\=./.gem.20231123-1869-nljcsp
sitelibdir\=./.gem.20231123-1869-nljcsp
compiling stringio.c
stringio.c: In function ‘readable’:
stringio.c:138:7: error: implicit declaration of function ‘RBASIC’
[-Werror=implicit-function-declaration]
  138 |     ((RBASIC(strio)->flags & STRIO_##mode) && \
      |       ^~~~~~
...

In the past CI result where the truffleruby-head pass, the truffleruby version was 23.1.1. So, I guess the the new version 24.0.0-dev triggered the error.
https://github.com/ruby/openssl/actions/runs/6894870154/job/18757626125#step:3:19

   /home/runner/.rubies/truffleruby-23.1.1/bin/ruby --version
  truffleruby 23.1.1, like ruby 3.2.2, Oracle GraalVM Native [x86_64-linux]

In both passed and failing cases, the stringio gem version 3.0.9 are used. So, I don't think the stringio triggered the issue.

@junaruga
Copy link
Member Author

junaruga commented Nov 23, 2023

@eregon Do you have any idea about how to fix the issue? Could you send a PR to fix it? Thanks.

@eregon
Copy link
Member

eregon commented Nov 24, 2023

Thanks for the ping.
It's due to oracle/truffleruby#3118. It's expected that RBASIC(obj)->flags is no longer supported, because basically it cannot be.
I'll take a look at fixing https://github.com/ruby/stringio.

@eregon
Copy link
Member

eregon commented Nov 24, 2023

BTW it seems a bit weird that ruby/openssl depends on the stringio gem.
Looking at Gemfile.lock it's because the openssl Gemfile depends on rdoc->psych->stringio.
Ideally it'd just use the stdlib stringio and not install the stringio gem.

eregon added a commit to eregon/stringio that referenced this issue Nov 24, 2023
* Before this it was compiled but not used, because TruffleRuby has
  a stringio.rb in stdlib and .rb has precedence over .so.
  In fact that extension never worked on TruffleRuby,
  because rb_io_extract_modeenc() has never been defined on TruffleRuby.
* So this just skip compiling the extension since compilation of it now fails:
  ruby/openssl#699
@eregon
Copy link
Member

eregon commented Nov 24, 2023

ruby/stringio#71

@junaruga
Copy link
Member Author

BTW it seems a bit weird that ruby/openssl depends on the stringio gem. Looking at Gemfile.lock it's because the openssl Gemfile depends on rdoc->psych->stringio. Ideally it'd just use the stdlib stringio and not install the stringio gem.

Thanks for your work!

For the rdoc dependency in the Gemfile, 4312b07 is the reason. In Fedora Linux and the downstream Linux distro Ruby RPM packages, the rdoc is not default gem of the Ruby.

@eregon
Copy link
Member

eregon commented Nov 24, 2023

Do you know why openssl needs rdoc at all? I would think running openssl tests doesn't need it.

@junaruga
Copy link
Member Author

Do you know why openssl needs rdoc at all? I would think running openssl tests doesn't need it.

Yes, because the Rakeflie has a task to create the openssl gem's rdoc document. Perhaps you like to create the new test group in Rakefile, then only install the gem packages in the test group excluding the rdoc in the development group in the CI?

openssl/Rakefile

Lines 37 to 40 in 27237de

RDoc::Task.new do |rdoc|
rdoc.main = "README.md"
rdoc.rdoc_files.include("*.md", "lib/**/*.rb", "ext/**/*.c")
end

@junaruga
Copy link
Member Author

I sent the PR #701 to pass CI avoiding this issue.

eregon added a commit to eregon/stringio that referenced this issue Nov 27, 2023
* Before this it was compiled but not used, because TruffleRuby has
  a stringio.rb in stdlib and .rb has precedence over .so.
  In fact that extension never worked on TruffleRuby,
  because rb_io_extract_modeenc() has never been defined on TruffleRuby.
* So this just skip compiling the extension since compilation of it now fails:
  ruby/openssl#699
nobu pushed a commit to ruby/stringio that referenced this issue Nov 27, 2023
* Before this it was compiled but not used, because TruffleRuby has
  a stringio.rb in stdlib and .rb has precedence over .so.
  In fact that extension never worked on TruffleRuby,
  because rb_io_extract_modeenc() has never been defined on TruffleRuby.
* So this just skip compiling the extension since compilation of it now fails:
  ruby/openssl#699
matzbot pushed a commit to ruby/ruby that referenced this issue Nov 27, 2023
* Before this it was compiled but not used, because TruffleRuby has
  a stringio.rb in stdlib and .rb has precedence over .so.
  In fact that extension never worked on TruffleRuby,
  because rb_io_extract_modeenc() has never been defined on TruffleRuby.
* So this just skip compiling the extension since compilation of it now fails:
  ruby/openssl#699

ruby/stringio@d791b63df6
@junaruga
Copy link
Member Author

junaruga commented Nov 28, 2023

As stringio version 3.1.0 including the ruby/stringio#71 was released, I ran the GitHub Actions on my forked repository for the latest master branch. Right now stringio version 3.0.9 is downloaded in the CI. GitHub has a cache for that? Maybe we need to wait.

https://github.com/junaruga/ruby-openssl/actions/runs/7013145579/job/19078824139#step:4:15

@eregon
Copy link
Member

eregon commented Nov 28, 2023

I can reproduce it locally, also on CRuby.
It sounds like a rubygems.org cache or bug.
If I add gem "stringio", "3.1.0" in openssl Gemfile I get (on CRuby 3.2):

$ bundle lock
Fetching gem metadata from https://rubygems.org/........
Could not find gem 'stringio (= 3.1.0)' in rubygems repository https://rubygems.org/ or installed locally.

The source contains the following gems matching 'stringio':
  * stringio-0.0.1
  * stringio-0.0.2
  * stringio-0.1.0
  * stringio-0.1.3
  * stringio-0.1.4
  * stringio-3.0.0
  * stringio-3.0.1
  * stringio-3.0.2.pre1-java
  * stringio-3.0.2.pre1
  * stringio-3.0.2-java
  * stringio-3.0.2
  * stringio-3.0.3-java
  * stringio-3.0.3
  * stringio-3.0.4-java
  * stringio-3.0.4
  * stringio-3.0.5-java
  * stringio-3.0.5
  * stringio-3.0.6-java
  * stringio-3.0.6
  * stringio-3.0.7-java
  * stringio-3.0.7
  * stringio-3.0.8-java
  * stringio-3.0.8
  * stringio-3.0.9-java
  * stringio-3.0.9

@eregon
Copy link
Member

eregon commented Nov 28, 2023

Also:

$ gem info -r stringio

*** REMOTE GEMS ***

stringio (3.1.0)
    Platform: java, ruby
    Authors: Nobu Nakada, Charles Oliver Nutter
    Homepage: https://github.com/ruby/stringio

    Pseudo IO on String

$ gem install stringio
Building native extensions. This could take a while...
Successfully installed stringio-3.0.9
1 gem installed

@eregon
Copy link
Member

eregon commented Nov 28, 2023

I filed rubygems/rubygems#7202

@eregon
Copy link
Member

eregon commented Nov 28, 2023

The rubygems.org issue is fixed now.
So I think we can close this as well as #701 and #704.

@junaruga
Copy link
Member Author

junaruga commented Dec 3, 2023

I confirmed that the trufeeruby-head cases work with the stringio gem version 3.1.0. I would close this ticket. Thank you for your work!

https://github.com/junaruga/ruby-openssl/actions/runs/7073768368/job/19254089972#step:4:17

@junaruga junaruga closed this as completed Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants