簡體   English   中英

安裝 Squib 時,Windows 無法構建 gem 本機擴展

[英]Windows Failed to build gem native extension when installing Squib

我對 Ruby 一無所知,並且一直試圖在 Windows 10 上安裝 Squib gem,但收效甚微。

在我第一次嘗試時,我使用 RubyInstaller.exe 安裝了 Ruby 2.6.5-1。 我不記得錯誤代碼,但是squib 沒有安裝。 (我相信這是“制作失敗,退出代碼 1”)

然后,我發現我沒有安裝 MSYS2。 所以,我卸載了 Ruby 並重新安裝,確保安裝 MSYS2。 Squib 再次拒絕正確安裝。

因此,我訪問了幫助頁面,並在名為“ Windows 安裝問題? ”的線程中找到了支持。 我確信這是我的救命稻草。

不是。

即使 OP 的操作系統與我的不匹配,我也嘗試了“下載問題”中列出的修復程序。 它沒有用。

我也嘗試使用 bundler 安裝爆管,但它沒有用。 我並不感到驚訝。

我在某處讀到一些隨機的東西,說可能與最新版本的 Ruby 存在沖突。 (當時 2.6.5-1)所以我使用了一些降級 Ruby 魔法來獲得 Ruby 2.5.7-??。 然后莫名其妙的事情發生了。 Squib 安裝失敗。 (帖子很舊,爆竹很久以前就更新了)

更新:我再次卸載並重新安裝了 Ruby。 這一次我在 ruby​​installer.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 系統上正確安裝。 經過多次嘗試,我發現了一種可以安裝爆管的解決方法。 它要求你有一個“Linux 子系統”,不像聽起來那么糟糕,跟我來:

1.前往這個網站

2.向下滾動到“使用適用於 Linux 的 Windows 子系統”部分。

3.按照“使用適用於 Linux 的 Windows 子系統”之后和“獎勵積分!”之前的所有說明進行操作。

4.安裝 ruby​​ 后。 在終端中輸入以下代碼:

sudo apt-get install -y build-essential

5.一旦完成。 在終端中輸入以下代碼:

sudo gem install squib

6.您將完成大部分安裝,然后您將收到“錯誤:無法構建 gem 本機擴展”。 這是參考 gdk_pixbuf2。 在終端中輸入以下代碼:

sudo gem update rake

7.最后,在終端中輸入以下代碼

sudo gem install squib

8.大功告成,可以使用爆管了!

不得不更新這個 rake 文件讓我覺得我應該在我的 windows 安裝 ruby​​ 中更新 make 文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM