Project

General

Profile

Actions

Bug #18046

closed

Missing include leads to build breakage of glib2 on head

Added by andymeneely (Andy Meneely) over 2 years ago. Updated over 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.0dev (2021-07-25T11:58:58Z master 8897098b5c) [x86_64-linux]
[ruby-core:104686]

Description

I was testing out my code on a CI and I noticed that the build broke with some compile errors. I reported it to the ruby-gnome project, and they think it's a missing include. Here's that bug: https://github.com/ruby-gnome/ruby-gnome/issues/1430

Here is the relevant snippet on the failure:

current directory:
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/glib2-3.4.6/ext/glib2
make DESTDIR\=
compiling glib-enum-types.c
glib-enum-types.c: In function ‘g_spawn_error_get_type’:
glib-enum-types.c:632:7: warning: ‘G_SPAWN_ERROR_2BIG’ is deprecated: Use
'G_SPAWN_ERROR_TOO_BIG' instead [-Wdeprecated-declarations]
  632 |       { G_SPAWN_ERROR_2BIG, "G_SPAWN_ERROR_2BIG", "2big" },
      |       ^
In file included from /usr/include/glib-2.0/glib.h:81,
                 from /usr/include/glib-2.0/gobject/gbinding.h:28,
                 from /usr/include/glib-2.0/glib-object.h:22,
                 from rbgobject.h:24,
                 from rbgprivate.h:32,
                 from glib-enum-types.c:4:
/usr/include/glib-2.0/glib/gspawn.h:76:3: note: declared here
76 |   G_SPAWN_ERROR_2BIG
GLIB_DEPRECATED_ENUMERATOR_IN_2_32_FOR(G_SPAWN_ERROR_TOO_BIG) =
G_SPAWN_ERROR_TOO_BIG,
      |   ^~~~~~~~~~~~~~~~~~
glib-enum-types.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
compiling rbglib-bytes.c
compiling rbglib-gc.c
compiling rbglib-variant-type.c
compiling rbglib-variant.c
compiling rbglib.c
compiling rbglib_bookmarkfile.c
compiling rbglib_convert.c
compiling rbglib_datetime.c
compiling rbglib_error.c
compiling rbglib_fileutils.c
compiling rbglib_gettext.c
compiling rbglib_i18n.c
compiling rbglib_int64.c
compiling rbglib_io_constants.c
compiling rbglib_iochannel.c
compiling rbglib_iochannel_win32_socket.c
compiling rbglib_iochannelerror.c
compiling rbglib_keyfile.c
compiling rbglib_maincontext.c
compiling rbglib_mainloop.c
compiling rbglib_matchinfo.c
compiling rbglib_messages.c
rbglib_messages.c: In function ‘rbglib_log_handler’:
rbglib_messages.c:76:13: warning: ‘rb_iterate’ is deprecated: by: rb_block_call
since 1.9 [-Wdeprecated-declarations]
   76 |             rb_iterate(rb_each, backtrace,
      |             ^~~~~~~~~~
In file included from
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby/defines.h:73,
from
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby/ruby.h:23,
from
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby.h:39,
                 from rbgobject.h:25,
                 from rbgprivate.h:32,
                 from rbglib_messages.c:25:
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby/internal/iterator.h:48:46:
note: declared here
48 | DEPRECATED_BY(rb_block_call since 1.9, VALUE
rb_iterate(VALUE(*)(VALUE),VALUE,rb_block_call_func_t,VALUE));
      |                                              ^~~~~~~~~~
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby/backward/2/attributes.h:60:65:
note: in definition of macro ‘DEPRECATED_BY’
   60 | #define DEPRECATED_BY(n,x) RBIMPL_ATTR_DEPRECATED(("by: " # n)) x
      |                                                                 ^
rbglib_messages.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
compiling rbglib_pollfd.c
compiling rbglib_regex.c
compiling rbglib_shell.c
compiling rbglib_shellerror.c
compiling rbglib_source.c
compiling rbglib_spawn.c
compiling rbglib_spawnerror.c
compiling rbglib_threads.c
compiling rbglib_timer.c
compiling rbglib_timezone.c
compiling rbglib_ucs4.c
compiling rbglib_unichar.c
compiling rbglib_unicode.c
compiling rbglib_utf16.c
compiling rbglib_utf8.c
compiling rbglib_utils.c
compiling rbglib_win32.c
compiling rbglibdeprecated.c
compiling rbgobj_binding.c
compiling rbgobj_boxed.c
compiling rbgobj_closure.c
compiling rbgobj_convert.c
compiling rbgobj_enumflags.c
compiling rbgobj_enums.c
compiling rbgobj_flags.c
compiling rbgobj_object.c
rbgobj_object.c: In function ‘gobj_new_body’:
rbgobj_object.c:367:5: warning: ‘rb_iterate’ is deprecated: by: rb_block_call
since 1.9 [-Wdeprecated-declarations]
367 |     rb_iterate(rb_each, (VALUE)arg->params_hash, _params_setup,
(VALUE)arg);
      |     ^~~~~~~~~~
In file included from
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby/defines.h:73,
from
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby/ruby.h:23,
from
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby.h:39,
                 from rbgobject.h:25,
                 from rbgprivate.h:32,
                 from rbgobj_object.c:25:
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby/internal/iterator.h:48:46:
note: declared here
48 | DEPRECATED_BY(rb_block_call since 1.9, VALUE
rb_iterate(VALUE(*)(VALUE),VALUE,rb_block_call_func_t,VALUE));
      |                                              ^~~~~~~~~~
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby/backward/2/attributes.h:60:65:
note: in definition of macro ‘DEPRECATED_BY’
   60 | #define DEPRECATED_BY(n,x) RBIMPL_ATTR_DEPRECATED(("by: " # n)) x
      |                                                                 ^
rbgobj_object.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
compiling rbgobj_param.c
compiling rbgobj_paramspecs.c
compiling rbgobj_signal.c
In file included from rbgobject.h:26,
                 from rbgprivate.h:32,
                 from rbgobj_signal.c:22:
rbgobj_signal.c: In function ‘gobj_s_signal_handler_attach’:
rbglib.h:91:22: warning: initialization of ‘VALUE’ {aka ‘long unsigned int’}
from ‘const gchar *’ {aka ‘const char *’} makes integer from pointer without a
cast [-Wint-conversion]
   91 | #define RVAL2CSTR(v) (rbg_rval2cstr(&(v)))
      |                      ^
rbgobj_signal.c:722:26: note: in expansion of macro ‘RVAL2CSTR’
  722 |     VALUE handler_name = RVAL2CSTR(rb_handler_name);
      |                          ^~~~~~~~~
rbgobj_signal.c:727:34: warning: passing argument 2 of ‘g_rclosure_set_tag’
makes pointer from integer without a cast [-Wint-conversion]
  727 |     g_rclosure_set_tag(rclosure, handler_name);
      |                                  ^~~~~~~~~~~~
      |                                  |
      |                                  VALUE {aka long unsigned int}
In file included from rbgprivate.h:32,
                 from rbgobj_signal.c:22:
rbgobject.h:240:64: note: expected ‘const gchar *’ {aka ‘const char *’} but
argument is of type ‘VALUE’ {aka ‘long unsigned int’}
  240 | extern void g_rclosure_set_tag(GClosure *closure, const gchar *tag);
      |                                                   ~~~~~~~~~~~~~^~~
rbgobj_signal.c:734:32: warning: passing argument 2 of ‘rbg_define_method’ makes
pointer from integer without a cast [-Wint-conversion]
734 |         rbg_define_method(mod, handler_name,
gobj_sig_chain_from_overridden, -1);
      |                                ^~~~~~~~~~~~
      |                                |
      |                                VALUE {aka long unsigned int}
In file included from rbgobject.h:27,
                 from rbgprivate.h:32,
                 from rbgobj_signal.c:22:
rbgutil.h:90:56: note: expected ‘const char *’ but argument is of type ‘VALUE’
{aka ‘long unsigned int’}
90 | extern void rbg_define_method(VALUE klass, const char *name, VALUE
(*func)(ANYARGS), int argc);
      |                                            ~~~~~~~~~~~~^~~~
rbgobj_signal.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
compiling rbgobj_strv.c
compiling rbgobj_type.c
compiling rbgobj_typeinstance.c
compiling rbgobj_typeinterface.c
compiling rbgobj_typemodule.c
compiling rbgobj_typeplugin.c
compiling rbgobj_value.c
compiling rbgobj_valuetypes.c
compiling rbgobject.c
compiling rbgutil.c
compiling rbgutil_callback.c
In file included from
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby/intern.h:59,
from
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby/ruby.h:101,
from
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby.h:39,
                 from rbgobject.h:25,
                 from rbgprivate.h:32,
                 from rbgutil_callback.c:21:
rbgutil_callback.c: In function ‘mainloop’:
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby/internal/intern/thread.h:34:31:
warning: implicit declaration of function ‘rb_wait_for_single_fd’
[-Wimplicit-function-declaration]
34 | #define rb_thread_wait_fd(fd) rb_wait_for_single_fd((fd),
RUBY_IO_READABLE, NULL)
      |                               ^~~~~~~~~~~~~~~~~~~~~
rbgutil_callback.c:102:9: note: in expansion of macro ‘rb_thread_wait_fd’
  102 |         rb_thread_wait_fd(callback_pipe_fds[0]);
      |         ^~~~~~~~~~~~~~~~~
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby/internal/intern/thread.h:34:31:
warning: nested extern declaration of ‘rb_wait_for_single_fd’ [-Wnested-externs]
34 | #define rb_thread_wait_fd(fd) rb_wait_for_single_fd((fd),
RUBY_IO_READABLE, NULL)
      |                               ^~~~~~~~~~~~~~~~~~~~~
rbgutil_callback.c:102:9: note: in expansion of macro ‘rb_thread_wait_fd’
  102 |         rb_thread_wait_fd(callback_pipe_fds[0]);
      |         ^~~~~~~~~~~~~~~~~
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby/internal/intern/thread.h:34:59:
error: ‘RUBY_IO_READABLE’ undeclared (first use in this function)
34 | #define rb_thread_wait_fd(fd) rb_wait_for_single_fd((fd),
RUBY_IO_READABLE, NULL)
|                                                          
^~~~~~~~~~~~~~~~
rbgutil_callback.c:102:9: note: in expansion of macro ‘rb_thread_wait_fd’
  102 |         rb_thread_wait_fd(callback_pipe_fds[0]);
      |         ^~~~~~~~~~~~~~~~~
/home/runner/.rubies/ruby-head/include/ruby-3.1.0/ruby/internal/intern/thread.h:34:59:
note: each undeclared identifier is reported only once for each function it
appears in
34 | #define rb_thread_wait_fd(fd) rb_wait_for_single_fd((fd),
RUBY_IO_READABLE, NULL)
|                                                          
^~~~~~~~~~~~~~~~
rbgutil_callback.c:102:9: note: in expansion of macro ‘rb_thread_wait_fd’
  102 |         rb_thread_wait_fd(callback_pipe_fds[0]);
      |         ^~~~~~~~~~~~~~~~~
rbgutil_callback.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
make: *** [Makefile:246: rbgutil_callback.o] Error 1

make failed, exit code 2

Gem files will remain installed in
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/glib2-3.4.6 for
inspection.
Results logged to
/home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/glib2-3.4.6/gem_make.out

An error occurred while installing glib2 (3.4.6), and Bundler cannot continue.
Make sure that `gem install glib2 -v '3.4.6' --source 'https://rubygems.org/'`
succeeds before bundling.

Updated by jeremyevans0 (Jeremy Evans) over 2 years ago

Making ruby/internal/intern/thread.h depend directly on ruby/io.h doesn't work due to circular dependency issues. I have a commit that adds a separate include file that both ruby/internal/intern/thread.h and ruby/io.h include to work around this issue: https://github.com/jeremyevans/ruby/commit/d9a2e5bd6406011de5b2bd92dec9cca06eb7ff1c. I couldn't get tool/update-deps to fix the dependency information, though. Hopefully @nobu (Nobuyoshi Nakada) can handle that or provide a better fix.

Actions #2

Updated by kou (Kouhei Sutou) over 2 years ago

  • Description updated (diff)

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

The problem seems RUBY_IO_READABLE,
how about moving the enums to include/ruby/internalintern/io.h?
Or turning the macros into functions again?

Updated by ioquatix (Samuel Williams) over 2 years ago

I think either option is okay.

The macro could be considered slight incompatibility since it breaks have_function type checks in extconf.rb - but consider that we should advise people to avoid these functions if possible, use the new ones (that take IO instances) where possible. So the right solution here, at least considering the original code, is to actually use rb_io_wait.

Actions #5

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Open to Closed

Applied in changeset git|3b52230452980f3afc6a7380276ea62f7c65e517.


Define functions using rb_wait_for_single_fd [Bug #18046]

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0