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

Different behavior when installing io-console between jvm and native configurations #3743

Closed
enriclluelles opened this issue Dec 13, 2024 · 3 comments

Comments

@enriclluelles
Copy link

enriclluelles commented Dec 13, 2024

I've been hesitant to report this because I'm a complete ignorant about the way TruffleRuby handles C extensions but here goes

Installing both configurations via asdf and the ruby plugin:

asdf install truffleruby-dev
asdf install truffleruby+graalvm-dev

In the native version:

❯ asdf local ruby truffleruby-dev
dummy on main [?] via 💎 v25.0.0-dev-373a3c92
❯ gem install io-console
Fetching io-console-0.8.0.gem
Building native extensions. This could take a while...
Successfully installed io-console-0.8.0
1 gem installed

In the jvm version:

❯ asdf local ruby truffleruby+graalvm-dev

dummy on main [?] via 💎 v24.2.0-dev-78dd4259
❯ gem install io-console
Building native extensions. This could take a while...
ERROR:  Error installing io-console:
        ERROR: Failed to build gem native extension.

    current directory: /Users/enric/.asdf/installs/ruby/truffleruby+graalvm-dev/lib/gems/gems/io-console-0.8.0/ext/io/console
/Users/enric/.asdf/installs/ruby/truffleruby+graalvm-dev/bin/truffleruby extconf.rb
checking for rb_syserr_fail_str(0, Qnil)... no
checking for rb_syserr_new_str(0, Qnil)... yes
checking for rb_interned_str_cstr()... no
checking for rb_io_path()... yes
checking for rb_io_descriptor()... yes
checking for rb_io_get_write_io()... yes
checking for rb_io_closed_p()... no
checking for rb_io_open_descriptor()... no
checking for rb_ractor_local_storage_value_newkey()... no
checking for termios.h... yes
checking for cfmakeraw() in termios.h... yes
checking for sys/ioctl.h... yes
checking for HAVE_RUBY_FIBER_SCHEDULER_H... yes
checking for ttyname_r()... yes
creating Makefile

current directory: /Users/enric/.asdf/installs/ruby/truffleruby+graalvm-dev/lib/gems/gems/io-console-0.8.0/ext/io/console
make DESTDIR\= sitearchdir\=./.gem.20241213-31128-496i5m sitelibdir\=./.gem.20241213-31128-496i5m clean

current directory: /Users/enric/.asdf/installs/ruby/truffleruby+graalvm-dev/lib/gems/gems/io-console-0.8.0/ext/io/console
make DESTDIR\= sitearchdir\=./.gem.20241213-31128-496i5m sitelibdir\=./.gem.20241213-31128-496i5m
compiling console.c
console.c:1562:11: warning: 'pathv' is deprecated: rb_io_path [-Wdeprecated-declarations]
 1562 |     fptr->pathv = path;
      |           ^
/Users/enric/.asdf/installs/ruby/truffleruby+graalvm-dev/lib/cext/include/ruby/io.h:173:5: note: 'pathv' has been explicitly marked deprecated here
  173 |     RBIMPL_ATTR_DEPRECATED(("rb_io_path"))
      |     ^
/Users/enric/.asdf/installs/ruby/truffleruby+graalvm-dev/lib/cext/include/ruby/internal/attr/deprecated.h:36:53: note: expanded from macro 'RBIMPL_ATTR_DEPRECATED'
   36 | # define RBIMPL_ATTR_DEPRECATED(msg) __attribute__((__deprecated__ msg))
      |                                                     ^
console.c:1563:11: warning: 'mode' is deprecated: rb_io_mode [-Wdeprecated-declarations]
 1563 |     fptr->mode |= mode;
      |           ^
/Users/enric/.asdf/installs/ruby/truffleruby+graalvm-dev/lib/cext/include/ruby/io.h:159:5: note: 'mode' has been explicitly marked deprecated here
  159 |     RBIMPL_ATTR_DEPRECATED(("rb_io_mode"))
      |     ^
/Users/enric/.asdf/installs/ruby/truffleruby+graalvm-dev/lib/cext/include/ruby/internal/attr/deprecated.h:36:53: note: expanded from macro 'RBIMPL_ATTR_DEPRECATED'
   36 | # define RBIMPL_ATTR_DEPRECATED(msg) __attribute__((__deprecated__ msg))
      |                                                     ^
console.c:1572:1: error: static declaration of 'rb_io_closed_p' follows non-static declaration
 1572 | rb_io_closed_p(VALUE io)
      | ^
/Users/enric/.asdf/installs/ruby/truffleruby+graalvm-dev/lib/cext/include/ruby/io.h:393:7: note: previous declaration is here
  393 | VALUE rb_io_closed_p(VALUE io);
      |       ^
console.c:1575:18: warning: 'fd' is deprecated: rb_io_descriptor [-Wdeprecated-declarations]
 1575 |     return fptr->fd == -1 ? Qtrue : Qfalse;
      |                  ^
/Users/enric/.asdf/installs/ruby/truffleruby+graalvm-dev/lib/cext/include/ruby/io.h:155:5: note: 'fd' has been explicitly marked deprecated here
  155 |     RBIMPL_ATTR_DEPRECATED(("rb_io_descriptor"))
      |     ^
/Users/enric/.asdf/installs/ruby/truffleruby+graalvm-dev/lib/cext/include/ruby/internal/attr/deprecated.h:36:53: note: expanded from macro 'RBIMPL_ATTR_DEPRECATED'
   36 | # define RBIMPL_ATTR_DEPRECATED(msg) __attribute__((__deprecated__ msg))
      |                                                     ^
3 warnings and 1 error generated.
make: *** [console.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/enric/.asdf/installs/ruby/truffleruby+graalvm-dev/lib/gems/gems/io-console-0.8.0 for inspection.
Results logged to /Users/enric/.asdf/installs/ruby/truffleruby+graalvm-dev/lib/gems/extensions/arm64-darwin/3.3.5.1/io-console-0.8.0/gem_make.out

It is my understanding that both should behave the same, no?

This is on a mac with apple silicon M1:

24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:15 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6000 arm64

Build tools installed via sudo xcode-select --install

Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin24.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Please let me know if there's additional details needed

@enriclluelles
Copy link
Author

I see now that the versions installed differ, that was also happening when both were at 24.2, will try to get a report with both at the same version

@enriclluelles
Copy link
Author

I see here ruby/irb#1032 that this has to do with new functions introduced in CRuby: ruby/irb#1032 (comment)

And that probably I got a native version with the fix and a jvm version without it

Closing the issue, cheers

@andrykonchin
Copy link
Member

andrykonchin commented Dec 13, 2024

Yeah, exactly. The TruffleRuby build truffleruby+graalvm-dev that failed was v24.2.0-dev-78dd4259 and it's a bit old so it doesn't contain the fix #3723. The truffleruby-dev build (v25.0.0-dev-373a3c92) is a fresh one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants