Windows 安装 Squib 时无法构建 gem 本机扩展
Windows Failed to build gem native extension when installing Squib
我对 Ruby 一无所知,一直在尝试在 Windows 10 上安装 squib gem 但收效甚微。
第一次尝试时,我使用 RubyInstaller.exe 安装了 Ruby 2.6.5-1。我不记得错误代码,但未安装 squib。 (我相信是 "make failed, exit code 1")
然后,我发现我没有安装MSYS2。所以,我卸载了 Ruby 并重新安装,确保安装了 MSYS2。 Squib 再次拒绝正确安装。
因此,我访问了帮助页面并在名为“Windows install issue?”的线程中找到了支持。我确信这是我的救星。
不是。
我也尝试了“trouble downloading”中列出的修复,尽管 OP 的 OS 与我的不匹配。没用。
我也尝试过使用 bundler 安装 squib,但没有成功。我并不意外。
我在某处随机读到一些东西,说可能与 Ruby 的最新版本有冲突。 (当时是 2.6.5-1)所以我使用了一些降级 Ruby 魔法来达到 Ruby 2.5.7-??。然后莫名其妙的事情发生了。 Squib 安装失败。 (post老了,squib早就更新了)
更新:我已经卸载并重新安装 Ruby。这一次,我在 rubyinstaller.exe 中安装 MSYS2 后使用了可选的 MSYS2 更新。仍然没有运气。我相信它与 "glib2" 有关。
我正在寻找关于下一步该怎么做的建议,因为我确信我遗漏了一些东西。
谢谢,
埃德加
(这是我最近一次尝试的反流。)
ruby 2.6.5p114 (2019-10-01 revision 67812) [x64-mingw32]
C:\Users\Edgar>gem install squib
Fetching native-package-installer-1.0.9.gem
Fetching gio2-3.4.1.gem
Fetching highline-2.0.2.gem
Fetching gobject-introspection-3.4.1.gem
Fetching pkg-config-1.4.1.gem
Fetching cairo-1.16.5.gem
Fetching glib2-3.4.1.gem
Fetching classy_hash-0.2.1.gem
Fetching mercenary-0.3.6.gem
Fetching mini_portile2-2.4.0.gem
Fetching nokogiri-1.10.4-x64-mingw32.gem
Fetching cairo-gobject-3.4.1.gem
Fetching pango-3.4.1.gem
Fetching rubyzip-1.3.0.gem
Fetching roo-2.8.2.gem
Fetching gdk_pixbuf2-3.4.1.gem
Fetching rsvg2-3.4.1.gem
Fetching ruby-progressbar-1.10.1.gem
Fetching squib-0.15.3.gem
Installing required msys2 packages: mingw-w64-x86_64-pkg-config
warning: mingw-w64-x86_64-pkg-config-0.29.2-1 is up to date -- skipping
Successfully installed pkg-config-1.4.1
Successfully installed native-package-installer-1.0.9
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-cairo
warning: dependency cycle detected:
warning: mingw-w64-x86_64-harfbuzz will be installed before its mingw-w64-x86_64-freetype dependency
Building native extensions. This could take a while...
Successfully installed cairo-1.16.5
Successfully installed classy_hash-0.2.1
Installing required msys2 packages: mingw-w64-x86_64-glib2
warning: mingw-w64-x86_64-glib2-2.62.4-1 is up to date -- skipping
Building native extensions. This could take a while...
ERROR: Error installing squib:
ERROR: Failed to build gem native extension.
current directory: D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/glib2-3.4.1/ext/glib2
D:/Ruby26-x64/bin/ruby.exe -I D:/Ruby26-x64/lib/ruby/2.6.0 -r ./siteconf20200223-9340-259ydx.rb extconf.rb
checking for --enable-debug-build option... no
checking for -Wall option to compiler... yes
checking for -Waggregate-return option to compiler... yes
checking for -Wcast-align option to compiler... yes
checking for -Wextra option to compiler... no
checking for -Wformat=2 option to compiler... yes
checking for -Winit-self option to compiler... yes
checking for -Wlarger-than-65500 option to compiler... yes
checking for -Wmissing-declarations option to compiler... yes
checking for -Wmissing-format-attribute option to compiler... yes
checking for -Wmissing-include-dirs option to compiler... yes
checking for -Wmissing-noreturn option to compiler... yes
checking for -Wmissing-prototypes option to compiler... yes
checking for -Wnested-externs option to compiler... no
checking for -Wold-style-definition option to compiler... yes
checking for -Wpacked option to compiler... yes
checking for -Wp,-D_FORTIFY_SOURCE=2 option to compiler... yes
checking for -Wpointer-arith option to compiler... yes
checking for -Wundef option to compiler... yes
checking for -Wout-of-line-declaration option to compiler... no
checking for -Wunsafe-loop-optimizations option to compiler... yes
checking for -Wwrite-strings option to compiler... yes
checking for Homebrew... no
checking for gobject-2.0 version (>= 2.12.0)... yes
checking for gthread-2.0... yes
checking for unistd.h... no
checking for io.h... no
checking for g_spawn_close_pid() in glib.h... no
checking for g_thread_init() in glib.h... no
checking for g_main_depth() in glib.h... no
checking for g_listenv() in glib.h... no
checking for rb_check_array_type() in ruby.h... no
checking for rb_check_hash_type() in ruby.h... no
checking for rb_exec_recursive() in ruby.h... no
checking for rb_errinfo() in ruby.h... no
checking for rb_thread_call_without_gvl() in ruby.h... no
checking for ruby_native_thread_p() in ruby.h... no
checking for rb_thread_call_with_gvl() in ruby.h... no
checking for rb_gc_register_mark_object() in ruby.h... no
checking for rb_exc_new_str() in ruby.h... no
checking for rb_enc_str_new_static() in ruby.h... no
checking for curr_thread in ruby.h,node.h... no
checking for rb_curr_thread in ruby.h,node.h... no
creating ruby-glib2.pc
creating glib-enum-types.c
creating glib-enum-types.h
creating Makefile
current directory: D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/glib2-3.4.1/ext/glib2
make "DESTDIR=" clean
current directory: D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/glib2-3.4.1/ext/glib2
make "DESTDIR="
compiling glib-enum-types.c
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `x86_64-w64-mingw32-gcc -I. -ID:/Ruby26-x64/include/ruby-2.6.0/x64-mingw32 -I/D/Ruby26-x64/include/ruby-2.6.0/ruby/backward -I/D/Ruby26-x64/include/ruby-2.6.0 -I. -IC:/Program Files (x86)/GtkSharp/2.12//INCLUDE -I./.gem.20200223-9340-l8g9x -I/D/Ruby26-x64/lib/ruby/vendor_ruby/2.6.0/x64-msvcrt -ID:/Ruby26-x64/msys64/mingw64/include -ID:/Ruby26-x64/msys64/mingw64/lib/libffi-3.2.1/include -ID:/Ruby26-x64/msys64/mingw64/include/glib-2.0 -ID:/Ruby26-x64/msys64/mingw64/lib/glib-2.0/include -ID:/Ruby26-x64/msys64/mingw64/include -ID:/Ruby26-x64/msys64/mingw64/include/glib-2.0 -ID:/Ruby26-x64/msys64/mingw64/lib/glib-2.0/include -DRUBY_GLIB2_COMPILATION -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -Wall -Waggregate-return -Wcast-align -Wformat=2 -Winit-self -Wlarger-than-65500 -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-prototypes -Wold-style-definition -Wpacked -Wp,-D_FORTIFY_SOURCE=2 -Wpointer-arith -Wundef -Wunsafe-loop-optimizations -Wwrite-strings -mms-bitfields -pthread -mms-bitfields -o glib-enum-types.o -c glib-enum-types.c'
make: *** [Makefile:244: glib-enum-types.o] Error 1
make failed, exit code 2
Gem files will remain installed in D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/glib2-3.4.1 for inspection.
Results logged to D:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/glib2-3.4.1/gem_make.out
C:\Users\Edgar>
看来 squib 要求的 glib2 版本没有在我的 Windows 10 系统上正确安装。经过多次尝试,我发现了一个可以安装 squib 的解决方法。它需要你有一个 "subsystem for Linux" 不像听起来那么糟糕,跟我来:
1. 前往此 site
2. 向下滚动到 "Using the Windows Subsystem for Linux" 部分。
3. 按照 "Using the Windows Subsystem for Linux" 之后和 "Bonus points!".
之前的所有说明进行操作
4. 一旦安装了 ruby。 在您的终端中输入以下代码:
sudo apt-get install -y build-essential
5. 一旦完成。 在您的终端中输入以下代码:
sudo gem install squib
6. 您将完成大部分安装,然后您将获得 "ERROR: Failed to build gem native extension." 这是对 gdk_pixbuf2 的参考。 在您的终端中输入以下代码:
sudo gem update rake
7. 最后,在终端中输入下面的代码:
sudo gem install squib
8. 你已经完成了,可以使用爆管了!
必须更新这个 rake 文件让我觉得我应该在 windows 安装的 ruby 中更新 make 文件。
我对 Ruby 一无所知,一直在尝试在 Windows 10 上安装 squib gem 但收效甚微。
第一次尝试时,我使用 RubyInstaller.exe 安装了 Ruby 2.6.5-1。我不记得错误代码,但未安装 squib。 (我相信是 "make failed, exit code 1")
然后,我发现我没有安装MSYS2。所以,我卸载了 Ruby 并重新安装,确保安装了 MSYS2。 Squib 再次拒绝正确安装。
因此,我访问了帮助页面并在名为“Windows install issue?”的线程中找到了支持。我确信这是我的救星。
不是。
我也尝试了“trouble downloading”中列出的修复,尽管 OP 的 OS 与我的不匹配。没用。
我也尝试过使用 bundler 安装 squib,但没有成功。我并不意外。
我在某处随机读到一些东西,说可能与 Ruby 的最新版本有冲突。 (当时是 2.6.5-1)所以我使用了一些降级 Ruby 魔法来达到 Ruby 2.5.7-??。然后莫名其妙的事情发生了。 Squib 安装失败。 (post老了,squib早就更新了)
更新:我已经卸载并重新安装 Ruby。这一次,我在 rubyinstaller.exe 中安装 MSYS2 后使用了可选的 MSYS2 更新。仍然没有运气。我相信它与 "glib2" 有关。
我正在寻找关于下一步该怎么做的建议,因为我确信我遗漏了一些东西。
谢谢, 埃德加
(这是我最近一次尝试的反流。)
ruby 2.6.5p114 (2019-10-01 revision 67812) [x64-mingw32]
C:\Users\Edgar>gem install squib
Fetching native-package-installer-1.0.9.gem
Fetching gio2-3.4.1.gem
Fetching highline-2.0.2.gem
Fetching gobject-introspection-3.4.1.gem
Fetching pkg-config-1.4.1.gem
Fetching cairo-1.16.5.gem
Fetching glib2-3.4.1.gem
Fetching classy_hash-0.2.1.gem
Fetching mercenary-0.3.6.gem
Fetching mini_portile2-2.4.0.gem
Fetching nokogiri-1.10.4-x64-mingw32.gem
Fetching cairo-gobject-3.4.1.gem
Fetching pango-3.4.1.gem
Fetching rubyzip-1.3.0.gem
Fetching roo-2.8.2.gem
Fetching gdk_pixbuf2-3.4.1.gem
Fetching rsvg2-3.4.1.gem
Fetching ruby-progressbar-1.10.1.gem
Fetching squib-0.15.3.gem
Installing required msys2 packages: mingw-w64-x86_64-pkg-config
warning: mingw-w64-x86_64-pkg-config-0.29.2-1 is up to date -- skipping
Successfully installed pkg-config-1.4.1
Successfully installed native-package-installer-1.0.9
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-cairo
warning: dependency cycle detected:
warning: mingw-w64-x86_64-harfbuzz will be installed before its mingw-w64-x86_64-freetype dependency
Building native extensions. This could take a while...
Successfully installed cairo-1.16.5
Successfully installed classy_hash-0.2.1
Installing required msys2 packages: mingw-w64-x86_64-glib2
warning: mingw-w64-x86_64-glib2-2.62.4-1 is up to date -- skipping
Building native extensions. This could take a while...
ERROR: Error installing squib:
ERROR: Failed to build gem native extension.
current directory: D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/glib2-3.4.1/ext/glib2
D:/Ruby26-x64/bin/ruby.exe -I D:/Ruby26-x64/lib/ruby/2.6.0 -r ./siteconf20200223-9340-259ydx.rb extconf.rb
checking for --enable-debug-build option... no
checking for -Wall option to compiler... yes
checking for -Waggregate-return option to compiler... yes
checking for -Wcast-align option to compiler... yes
checking for -Wextra option to compiler... no
checking for -Wformat=2 option to compiler... yes
checking for -Winit-self option to compiler... yes
checking for -Wlarger-than-65500 option to compiler... yes
checking for -Wmissing-declarations option to compiler... yes
checking for -Wmissing-format-attribute option to compiler... yes
checking for -Wmissing-include-dirs option to compiler... yes
checking for -Wmissing-noreturn option to compiler... yes
checking for -Wmissing-prototypes option to compiler... yes
checking for -Wnested-externs option to compiler... no
checking for -Wold-style-definition option to compiler... yes
checking for -Wpacked option to compiler... yes
checking for -Wp,-D_FORTIFY_SOURCE=2 option to compiler... yes
checking for -Wpointer-arith option to compiler... yes
checking for -Wundef option to compiler... yes
checking for -Wout-of-line-declaration option to compiler... no
checking for -Wunsafe-loop-optimizations option to compiler... yes
checking for -Wwrite-strings option to compiler... yes
checking for Homebrew... no
checking for gobject-2.0 version (>= 2.12.0)... yes
checking for gthread-2.0... yes
checking for unistd.h... no
checking for io.h... no
checking for g_spawn_close_pid() in glib.h... no
checking for g_thread_init() in glib.h... no
checking for g_main_depth() in glib.h... no
checking for g_listenv() in glib.h... no
checking for rb_check_array_type() in ruby.h... no
checking for rb_check_hash_type() in ruby.h... no
checking for rb_exec_recursive() in ruby.h... no
checking for rb_errinfo() in ruby.h... no
checking for rb_thread_call_without_gvl() in ruby.h... no
checking for ruby_native_thread_p() in ruby.h... no
checking for rb_thread_call_with_gvl() in ruby.h... no
checking for rb_gc_register_mark_object() in ruby.h... no
checking for rb_exc_new_str() in ruby.h... no
checking for rb_enc_str_new_static() in ruby.h... no
checking for curr_thread in ruby.h,node.h... no
checking for rb_curr_thread in ruby.h,node.h... no
creating ruby-glib2.pc
creating glib-enum-types.c
creating glib-enum-types.h
creating Makefile
current directory: D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/glib2-3.4.1/ext/glib2
make "DESTDIR=" clean
current directory: D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/glib2-3.4.1/ext/glib2
make "DESTDIR="
compiling glib-enum-types.c
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `x86_64-w64-mingw32-gcc -I. -ID:/Ruby26-x64/include/ruby-2.6.0/x64-mingw32 -I/D/Ruby26-x64/include/ruby-2.6.0/ruby/backward -I/D/Ruby26-x64/include/ruby-2.6.0 -I. -IC:/Program Files (x86)/GtkSharp/2.12//INCLUDE -I./.gem.20200223-9340-l8g9x -I/D/Ruby26-x64/lib/ruby/vendor_ruby/2.6.0/x64-msvcrt -ID:/Ruby26-x64/msys64/mingw64/include -ID:/Ruby26-x64/msys64/mingw64/lib/libffi-3.2.1/include -ID:/Ruby26-x64/msys64/mingw64/include/glib-2.0 -ID:/Ruby26-x64/msys64/mingw64/lib/glib-2.0/include -ID:/Ruby26-x64/msys64/mingw64/include -ID:/Ruby26-x64/msys64/mingw64/include/glib-2.0 -ID:/Ruby26-x64/msys64/mingw64/lib/glib-2.0/include -DRUBY_GLIB2_COMPILATION -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -Wall -Waggregate-return -Wcast-align -Wformat=2 -Winit-self -Wlarger-than-65500 -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-prototypes -Wold-style-definition -Wpacked -Wp,-D_FORTIFY_SOURCE=2 -Wpointer-arith -Wundef -Wunsafe-loop-optimizations -Wwrite-strings -mms-bitfields -pthread -mms-bitfields -o glib-enum-types.o -c glib-enum-types.c'
make: *** [Makefile:244: glib-enum-types.o] Error 1
make failed, exit code 2
Gem files will remain installed in D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/glib2-3.4.1 for inspection.
Results logged to D:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/glib2-3.4.1/gem_make.out
C:\Users\Edgar>
看来 squib 要求的 glib2 版本没有在我的 Windows 10 系统上正确安装。经过多次尝试,我发现了一个可以安装 squib 的解决方法。它需要你有一个 "subsystem for Linux" 不像听起来那么糟糕,跟我来:
1. 前往此 site
2. 向下滚动到 "Using the Windows Subsystem for Linux" 部分。
3. 按照 "Using the Windows Subsystem for Linux" 之后和 "Bonus points!".
之前的所有说明进行操作4. 一旦安装了 ruby。 在您的终端中输入以下代码:
sudo apt-get install -y build-essential
5. 一旦完成。 在您的终端中输入以下代码:
sudo gem install squib
6. 您将完成大部分安装,然后您将获得 "ERROR: Failed to build gem native extension." 这是对 gdk_pixbuf2 的参考。 在您的终端中输入以下代码:
sudo gem update rake
7. 最后,在终端中输入下面的代码:
sudo gem install squib
8. 你已经完成了,可以使用爆管了!
必须更新这个 rake 文件让我觉得我应该在 windows 安装的 ruby 中更新 make 文件。