Fails to build with latest discourse_docker due to upcoming Ruby 3.3

Environment

Discourse Version: 3.2.2

Plugin Commit: cab38405bdd58a17ae67cb2166fab045d5c65019

Steps to Reproduce

Discourse seems to be doing changes to switch to Ruby 3.3 which StringIO 3.0.2 (used by discourse-events) doesn’t support and the Discourse build fails when compiling that gem.

For some reason at the moment this issue only surfaces when building Discourse on a ARM machine, but I believe the Ruby 3.3 compatibility issue applies to x86 too.

I’ve tried building discourse-events with different versions of StringIO and 3.0.7 or newer build successfully which matches when Ruby 3.3 support was introduced.

I can submit a PR with the version change, but I’m not sure if everything is still working properly as I currently don’t have a way to run the tests suite. I did find one issue, but I’m not sure it is related with this change: when looking at a topic list with events, their title displays with [object Object] suffix:

Otherwise, the plugin seems to be working on our staging server – that’s the only issue I found.

Example

Logs

[…]
checking out compatible docker_manager version: 9523f7a88453ce1863071bcc2bc88130b60efee5
HEAD is now at 9523f7a Update translations (#205)

I, [2024-05-28T09:52:18.538215 #1] INFO – : > cd /var/www/discourse && su discourse -c ‘bundle exec rake db:migrate’
ERROR: Error installing stringio:
ERROR: Failed to build gem native extension.

current directory: /var/www/discourse/plugins/discourse-events/gems/3.3.1/gems/stringio-3.0.2/ext/stringio

/usr/local/bin/ruby extconf.rb
checking for rb_io_extract_modeenc() in ruby/io.h… yes
creating Makefile

current directory: /var/www/discourse/plugins/discourse-events/gems/3.3.1/gems/stringio-3.0.2/ext/stringio
make DESTDIR= sitearchdir=./.gem.20240528-1205-7qlio5 sitelibdir=./.gem.20240528-1205-7qlio5 clean

current directory: /var/www/discourse/plugins/discourse-events/gems/3.3.1/gems/stringio-3.0.2/ext/stringio
make DESTDIR= sitearchdir=./.gem.20240528-1205-7qlio5 sitelibdir=./.gem.20240528-1205-7qlio5
compiling stringio.c
stringio.c: In function ‘strio_init’:
stringio.c:343:24: error: storage size of ‘convconfig’ isn’t known
343 | struct rb_io_enc_t convconfig;
| ^~~~~~~~~~
stringio.c:343:24: warning: unused variable ‘convconfig’ [-Wunused-variable]
stringio.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
make: *** [Makefile:248: stringio.o] Error 1

make failed, exit code 2

Gem files will remain installed in /var/www/discourse/plugins/discourse-events/gems/3.3.1/gems/stringio-3.0.2 for inspection.
Results logged to /var/www/discourse/plugins/discourse-events/gems/3.3.1/extensions/aarch64-linux/3.3.0/stringio-3.0.2/gem_make.out
I, [2024-05-28T09:52:39.324741 #1] INFO – : gem install uuidtools -v 2.2.0 -i /var/www/discourse/plugins/discourse-events/gems/3.3.1 --no-document --ignore-dependencies --no-user-install
Successfully installed uuidtools-2.2.0
1 gem installed
gem install iso-639 -v 0.3.5 -i /var/www/discourse/plugins/discourse-events/gems/3.3.1 --no-document --ignore-dependencies --no-user-install
Successfully installed iso-639-0.3.5
1 gem installed
gem install ice_cube -v 0.16.4 -i /var/www/discourse/plugins/discourse-events/gems/3.3.1 --no-document --ignore-dependencies --no-user-install
Successfully installed ice_cube-0.16.4
1 gem installed
gem install icalendar -v 2.8.0 -i /var/www/discourse/plugins/discourse-events/gems/3.3.1 --no-document --ignore-dependencies --no-user-install
ActiveSupport is required for TimeWithZone support, but not required for general use.
Successfully installed icalendar-2.8.0
1 gem installed
gem install icalendar-recurrence -v 1.1.3 -i /var/www/discourse/plugins/discourse-events/gems/3.3.1 --no-document --ignore-dependencies --no-user-install
Successfully installed icalendar-recurrence-1.1.3
1 gem installed
gem install date -v 3.3.4 -i /var/www/discourse/plugins/discourse-events/gems/3.3.1 --no-document --ignore-dependencies --no-user-install
Building native extensions. This could take a while…
Successfully installed date-3.3.4
1 gem installed
gem install time -v 0.2.0 -i /var/www/discourse/plugins/discourse-events/gems/3.3.1 --no-document --ignore-dependencies --no-user-install
Successfully installed time-0.2.0
1 gem installed
gem install stringio -v 3.0.2 -i /var/www/discourse/plugins/discourse-events/gems/3.3.1 --no-document --ignore-dependencies --no-user-install
Building native extensions. This could take a while…
You are specifying the gem stringio in /var/www/discourse/plugins/discourse-events/plugin.rb, however it does not exist!
Looked for:

  • /var/www/discourse/plugins/discourse-events/gems/3.3.1/specifications/stringio-3.0.2.gemspec
  • /var/www/discourse/plugins/discourse-events/gems/3.3.1/specifications/stringio-3.0.2-aarch64-linux.gemspec
  • /var/www/discourse/plugins/discourse-events/gems/3.3.1/specifications/stringio-3.0.2-aarch64-linux.gemspec

FAILED

Pups::ExecError: cd /var/www/discourse && su discourse -c ‘bundle exec rake db:migrate’ failed with return #<Process::Status: pid 1109 exit 255>
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn’
exec failed with the params {“cd”=>“$home”, “tag”=>“migrate”, “hook”=>“db_migrate”, “cmd”=>[“su discourse -c ‘bundle exec rake db:migrate’”]}
bootstrap failed with exit code 255

1 Like

We’re experiencing the same issue as well, saw this PR: Update StringIO to 3.0.8 by bluefroguk1 · Pull Request #135 · paviliondev/discourse-events · GitHub

We’ve updated to StringIO 3.0.7 to get passed any rebuild issues, but later found that events show up as [object Object] in the topic list view.

This is fixed in the latest version of the plugin.

2 Likes