LoginSignup
0
0

config.google_cloud.use_logging/debugger/trace等の設定を入れていたらbundle installやminitest実行に失敗した話

Posted at

3行で書くと

  • config.google_cloud.use_logging = false 等の設定を入れていると $ bundle install$ rails test(minitest)が通らなくなることがあった1
  • その設定をそのまま外したら通った
  • その設定を入れた理由の事象も解消されていたので恒久的に外したままで大丈夫そう

環境

Windows 10 Pro、Ruby3.2.2、Rails7.1.2

経緯

Gemfileの、主にGoogle Cloud絡みのものをガチャガチャ弄っていたらある時 $ bundle install$ rails test(minitest)が通らなくなってしまいました。

実際に出たエラーはこんな感じ。
bundle installのエラー
Installing grpc 1.60.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/grpc-1.60.0/src/ruby/ext/grpc
C:/Ruby32-x64/bin/ruby.exe extconf.rb
"extconf.rb setting ENV[AR] = gcc-ar"
"extconf.rb setting ENV[CC] = gcc"
"extconf.rb setting ENV[CXX] = g++"
"extconf.rb setting ENV[RANLIB] = gcc-ranlib"
"extconf.rb setting ENV[STRIP] = strip -S -x"
"extconf.rb setting ENV[CPPFLAGS] = -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048
-D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 "
"extconf.rb setting ENV[LDFLAGS] = -L. -pipe -s -fstack-protector-strong
-Wl,--no-as-needed"
extconf.rb $LDFLAGS: -L. -pipe -s -fstack-protector-strong -Wl,--no-as-needed
-static
extconf.rb $DLDFLAGS: -pipe -s -fstack-protector-strong
-Wl,--enable-auto-image-base,--enable-auto-import
extconf.rb $CFLAGS: -O3 -fno-fast-math -fstack-protector-strong
-DGRPC_RUBY_WINDOWS_UCRT
-IC:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/grpc-1.60.0/include -g -std=c11  -Wall
-Wextra  -pedantic
Generating Makefile for grpc/grpc_c
creating Makefile

current directory:
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/grpc-1.60.0/src/ruby/ext/grpc
make DESTDIR\= sitearchdir\=./.gem.20240203-45932-ebvdcf
sitelibdir\=./.gem.20240203-45932-ebvdcf clean

current directory:
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/grpc-1.60.0/src/ruby/ext/grpc
make DESTDIR\= sitearchdir\=./.gem.20240203-45932-ebvdcf
sitelibdir\=./.gem.20240203-45932-ebvdcf
generating grpc_c-x64-mingw-ucrt.def
compiling rb_byte_buffer.c
In file included from C:/Ruby32-x64/include/ruby-3.2.0/ruby/ruby.h:15,
                 from rb_byte_buffer.c:19:
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/config.h:139:50: warning:
__VA_OPT__ is not available until C++20
  139 | # define RBIMPL_TEST2(...)          RBIMPL_TEST3(__VA_OPT__(,),1,0,0)
      |                                                  ^
In file included from
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/xmalloc.h:34,
                 from C:/Ruby32-x64/include/ruby-3.2.0/ruby/defines.h:71,
                 from C:/Ruby32-x64/include/ruby-3.2.0/ruby/ruby.h:25:
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/nodiscard.h:35:34: warning:
ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   35 | # define RBIMPL_ATTR_NODISCARD() [[nodiscard]]
      |                                  ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/xmalloc.h:62:1: note: in
expansion of macro 'RBIMPL_ATTR_NODISCARD'
   62 | RBIMPL_ATTR_NODISCARD()
      | ^~~~~~~~~~~~~~~~~~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/nodiscard.h:35:34: warning:
ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   35 | # define RBIMPL_ATTR_NODISCARD() [[nodiscard]]
      |                                  ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/xmalloc.h:90:1: note: in
expansion of macro 'RBIMPL_ATTR_NODISCARD'
   90 | RBIMPL_ATTR_NODISCARD()
      | ^~~~~~~~~~~~~~~~~~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/nodiscard.h:35:34: warning:
ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   35 | # define RBIMPL_ATTR_NODISCARD() [[nodiscard]]
      |                                  ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/xmalloc.h:121:1: note: in
expansion of macro 'RBIMPL_ATTR_NODISCARD'
  121 | RBIMPL_ATTR_NODISCARD()
      | ^~~~~~~~~~~~~~~~~~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/nodiscard.h:35:34: warning:
ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   35 | # define RBIMPL_ATTR_NODISCARD() [[nodiscard]]
      |                                  ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/xmalloc.h:151:1: note: in
expansion of macro 'RBIMPL_ATTR_NODISCARD'
  151 | RBIMPL_ATTR_NODISCARD()
      | ^~~~~~~~~~~~~~~~~~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/nodiscard.h:35:34: warning:
ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   35 | # define RBIMPL_ATTR_NODISCARD() [[nodiscard]]
      |                                  ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/xmalloc.h:197:1: note: in
expansion of macro 'RBIMPL_ATTR_NODISCARD'
  197 | RBIMPL_ATTR_NODISCARD()
      | ^~~~~~~~~~~~~~~~~~~~~
In file included from
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/core/rstring.h:30,
from
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/arithmetic/char.h:29,
from
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/arithmetic.h:24,
                 from C:/Ruby32-x64/include/ruby-3.2.0/ruby/ruby.h:28:
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h: In function
'RB_OBJ_TAINTABLE':
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h:788:24: warning: unused
parameter 'obj' [-Wunused-parameter]
  788 | RB_OBJ_TAINTABLE(VALUE obj)
      |                  ~~~~~~^~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h: In function
'RB_OBJ_TAINTED_RAW':
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h:805:26: warning: unused
parameter 'obj' [-Wunused-parameter]
  805 | RB_OBJ_TAINTED_RAW(VALUE obj)
      |                    ~~~~~~^~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h: In function
'RB_OBJ_TAINTED':
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h:822:22: warning: unused
parameter 'obj' [-Wunused-parameter]
  822 | RB_OBJ_TAINTED(VALUE obj)
      |                ~~~~~~^~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h: In function
'RB_OBJ_TAINT_RAW':
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h:837:24: warning: unused
parameter 'obj' [-Wunused-parameter]
  837 | RB_OBJ_TAINT_RAW(VALUE obj)
      |                  ~~~~~~^~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h: In function
'RB_OBJ_TAINT':
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h:852:20: warning: unused
parameter 'obj' [-Wunused-parameter]
  852 | RB_OBJ_TAINT(VALUE obj)
      |              ~~~~~~^~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h: In function
'RB_OBJ_INFECT_RAW':
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h:868:25: warning: unused
parameter 'dst' [-Wunused-parameter]
  868 | RB_OBJ_INFECT_RAW(VALUE dst, VALUE src)
      |                   ~~~~~~^~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h:868:36: warning: unused
parameter 'src' [-Wunused-parameter]
  868 | RB_OBJ_INFECT_RAW(VALUE dst, VALUE src)
      |                              ~~~~~~^~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h: In function
'RB_OBJ_INFECT':
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h:884:21: warning: unused
parameter 'dst' [-Wunused-parameter]
  884 | RB_OBJ_INFECT(VALUE dst, VALUE src)
      |               ~~~~~~^~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/fl_type.h:884:32: warning: unused
parameter 'src' [-Wunused-parameter]
  884 | RB_OBJ_INFECT(VALUE dst, VALUE src)
      |                          ~~~~~~^~~
In file included from
C:/Ruby32-x64/include/ruby-3.2.0/ruby/backward/2/attributes.h:38,
                 from C:/Ruby32-x64/include/ruby-3.2.0/ruby/defines.h:73:
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/rgengc.h: At top level:
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/maybe_unused.h:31:37:
warning: ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   31 | # define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]]
      |                                     ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/rgengc.h:365:5: note: in
expansion of macro 'RBIMPL_ATTR_MAYBE_UNUSED'
  365 |     RBIMPL_ATTR_MAYBE_UNUSED()
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/maybe_unused.h:31:37:
warning: ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   31 | # define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]]
      |                                     ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/rgengc.h:367:5: note: in
expansion of macro 'RBIMPL_ATTR_MAYBE_UNUSED'
  367 |     RBIMPL_ATTR_MAYBE_UNUSED()
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/maybe_unused.h:31:37:
warning: ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   31 | # define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]]
      |                                     ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/rgengc.h:393:5: note: in
expansion of macro 'RBIMPL_ATTR_MAYBE_UNUSED'
  393 |     RBIMPL_ATTR_MAYBE_UNUSED()
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/maybe_unused.h:31:37:
warning: ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   31 | # define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]]
      |                                     ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/rgengc.h:396:5: note: in
expansion of macro 'RBIMPL_ATTR_MAYBE_UNUSED'
  396 |     RBIMPL_ATTR_MAYBE_UNUSED()
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/maybe_unused.h:31:37:
warning: ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   31 | # define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]]
      |                                     ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/rgengc.h:398:5: note: in
expansion of macro 'RBIMPL_ATTR_MAYBE_UNUSED'
  398 |     RBIMPL_ATTR_MAYBE_UNUSED()
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/maybe_unused.h:31:37:
warning: ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   31 | # define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]]
      |                                     ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/rgengc.h:428:5: note: in
expansion of macro 'RBIMPL_ATTR_MAYBE_UNUSED'
  428 |     RBIMPL_ATTR_MAYBE_UNUSED()
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/maybe_unused.h:31:37:
warning: ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   31 | # define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]]
      |                                     ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/rgengc.h:430:5: note: in
expansion of macro 'RBIMPL_ATTR_MAYBE_UNUSED'
  430 |     RBIMPL_ATTR_MAYBE_UNUSED()
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/maybe_unused.h:31:37:
warning: ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   31 | # define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]]
      |                                     ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/core/rarray.h:437:24: note: in
expansion of macro 'RBIMPL_ATTR_MAYBE_UNUSED'
  437 |                        RBIMPL_ATTR_MAYBE_UNUSED()
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/maybe_unused.h:31:37:
warning: ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   31 | # define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]]
      |                                     ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/core/rarray.h:464:22: note: in
expansion of macro 'RBIMPL_ATTR_MAYBE_UNUSED'
  464 |                      RBIMPL_ATTR_MAYBE_UNUSED()
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/Ruby32-x64/include/ruby-3.2.0/ruby/ruby.h:45:
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/newobj.h: In function
'rb_clone_setup':
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/newobj.h:173:22: warning: unused
parameter 'clone' [-Wunused-parameter]
  173 | rb_clone_setup(VALUE clone, VALUE obj)
      |                ~~~~~~^~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/newobj.h:173:35: warning: unused
parameter 'obj' [-Wunused-parameter]
  173 | rb_clone_setup(VALUE clone, VALUE obj)
      |                             ~~~~~~^~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/newobj.h: In function
'rb_dup_setup':
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/newobj.h:190:20: warning: unused
parameter 'dup' [-Wunused-parameter]
  190 | rb_dup_setup(VALUE dup, VALUE obj)
      |              ~~~~~~^~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/newobj.h:190:31: warning: unused
parameter 'obj' [-Wunused-parameter]
  190 | rb_dup_setup(VALUE dup, VALUE obj)
      |                         ~~~~~~^~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/scan_args.h: At top level:
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/maybe_unused.h:31:37:
warning: ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   31 | # define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]]
      |                                     ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/backward/2/attributes.h:163:28: note: in
expansion of macro 'RBIMPL_ATTR_MAYBE_UNUSED'
  163 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/scan_args.h:391:33: note: in
expansion of macro 'RB_UNUSED_VAR'
391 |                  VALUE *vars[], RB_UNUSED_VAR(const char *fmt),
RB_UNUSED_VAR(int varc))
      |                                 ^~~~~~~~~~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/attr/maybe_unused.h:31:37:
warning: ISO C does not support '[[]]' attributes before C2X [-Wpedantic]
   31 | # define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]]
      |                                     ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/backward/2/attributes.h:163:28: note: in
expansion of macro 'RBIMPL_ATTR_MAYBE_UNUSED'
  163 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/scan_args.h:391:65: note: in
expansion of macro 'RB_UNUSED_VAR'
391 |                  VALUE *vars[], RB_UNUSED_VAR(const char *fmt),
RB_UNUSED_VAR(int varc))
|
^~~~~~~~~~~~~
In file included from C:/Ruby32-x64/include/ruby-3.2.0/ruby/ruby.h:47:
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/scan_args.h:502:41: warning:
__VA_OPT__ is not available until C++20
  502 |         (rb_scan_args)(argc, argvp, fmt __VA_OPT__(, __VA_ARGS__)))
      |                                         ^
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/scan_args.h:510:53: warning:
__VA_OPT__ is not available until C++20
510 |         (rb_scan_args_kw)(kw_flag, argc, argvp, fmt __VA_OPT__(,
__VA_ARGS__)))
      |                                                     ^
In file included from rb_grpc.h:24,
                 from rb_byte_buffer.c:23:
C:/Ruby32-x64/msys64/ucrt64/include/sys/time.h:42:13: error: conflicting types
for 'gettimeofday'; have 'int(struct timeval * restrict,  void * restrict)'
   42 | int __cdecl gettimeofday(struct timeval *__restrict__,
      |             ^~~~~~~~~~~~
In file included from
C:/Ruby32-x64/include/ruby-3.2.0/ruby/internal/dosish.h:38,
                 from C:/Ruby32-x64/include/ruby-3.2.0/ruby/defines.h:78:
C:/Ruby32-x64/include/ruby-3.2.0/ruby/win32.h:301:12: note: previous declaration
of 'gettimeofday' with type 'int(struct timeval *, struct timezone *)'
  301 | extern int gettimeofday(struct timeval *, struct timezone *);
      |            ^~~~~~~~~~~~
make: *** [Makefile:252: rb_byte_buffer.o] エラー 1

make failed, exit code 2

(上記以外のエラーが出た時もあった気がしますが記録がなく不明)

rails testのエラー
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/railties-7.1.2/lib/rails/railtie/configuration.rb:109:in `method_missing': undefined method `google_cloud' for #<Rails::Application::Configuration:0x00000000002e90> (NoMethodError)

rails s とかでも出るかもしれません

調べてみたらあまり情報はなかったんですが、古い情報ながら下記に行き当たりまして

話の本筋はだいぶ違うような気はするものの、どうも config.google_cloud.use_logging 辺りが怪しそう。
確かにgcloud CLI のインストール・セットアップ後、あらゆる rails コマンドで警告が出ていたため(下記記事と同事象)

これに倣って config/enviroments/ 以下の development.rb test.rb に下記の設定を入れていました。

config.google_cloud.use_logging = false
config.google_cloud.use_debugger = false
config.google_cloud.use_error_reporting = false
config.google_cloud.use_trace = false

ならば一旦こいつらを消してみようと、設定前の状態に戻してみたら

  • エラーは解消し、$ bundle install$ rails test も通った
  • そして当初の警告も何故か表示されなくなっていた

ので、再現条件や発生理由等掘り下げていないですしその予定もないのですが
もし同じ事象で困っている方がいれば一助になれば幸い🙏ということで一応記事にしておきました。

  1. 詳細な再現条件は不明

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0