簡體   English   中英

Windows:安裝 jekyll 時出錯 + gem 更新失敗 - 錯誤:無法構建 gem 本機擴展

[英]Windows : Error installing jekyll + gem update failed - ERROR: Failed to build gem native extension

[系統:Windows 10] (親,最新)

大家好,我是新來的,我知道我有一個問題被問過很多次,但是……坦率地說,我不明白答案,而且我很迷茫……英語不是我的母語,如果它顯示出來,我很抱歉。

我想做的事:

我想為個人博客安裝 Jekyll。 我在安裝結束時遇到問題: Error installing jekyll: ERROR: Failed to build gem native extension

我已經做了什么:

  • 按照此處的說明,我安裝了Ruby+Devkit 3.1.1-1 (x64) ,並在安裝結束時划掉了ridk install install。
  • ridk install 打開命令 window,我已經安裝了要求的 3 個東西,似乎已經成功了。
  • 我安裝了gccmingw-get-setup.exe作為依賴項(如果我沒記錯的話,也許沒有必要)。
  • 在 git bash gem install bundler中運行(有或沒有管理員權限,似乎都一樣)。 成功。
  • 運行 git bash gem install jekyll jekyll - 失敗。 (即使在重新啟動計算機之后)。
  • 我在另一個線程中看到了一個答案,該線程告訴我在安裝 Jekyll 之前進行gem update - 失敗了。

所以我想問題更多的是這一端,這里是日志:
第一部分:

ERROR:  Error installing bigdecimal:
        ERROR: Failed to build gem native extension.

    current directory: C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bigdecimal-3.1.2/ext/bigdecimal
C:/Ruby31-x64/bin/ruby.exe -I C:/Ruby31-x64/lib/ruby/site_ruby/3.1.0 -r ./siteconf20220322-6432-916opp.rb extconf.rb
checking RUBY_BIGDECIMAL_VERSION... 3.1.2
checking for __builtin_clz()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

mkmf.log文件:

PATH=".;C:/Ruby31-x64/lib;C:\Ruby31-x64\bin;C:\Ruby31-x64\msys64\mingw64\bin;C:\Ruby31-x64\msys64\usr\bin;C:\Users\User\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\User\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\dotnet;C:\Program Files\nodejs;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Ruby31-x64\bin;C:\Users\User\AppData\Local\Microsoft\WindowsApps;C:\Users\User\AppData\Local\atom\bin;C:\Users\User\AppData\Local\GitHubDesktop\bin;C:\Users\User\AppData\Roaming\npm;C:\MinGW\bin;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl" "gcc -o conftest.exe -IC:/Ruby31-x64/include/ruby-3.1.0/x64-mingw-ucrt -IC:/Ruby31-x64/include/ruby-3.1.0/ruby/backward -IC:/Ruby31-x64/include/ruby-3.1.0 -I. -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 -fstack-protector-strong conftest.c  -L. -LC:/Ruby31-x64/lib -L. -pipe -s -fstack-protector-strong -Wl,--no-as-needed  -m64   -lx64-ucrt-ruby310  -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi -lbcrypt  "
conftest.c:1:0: sorry, unimplemented: 64-bit mode not compiled in
 #include "ruby.h"
 
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7:   return !!argv[argc];
8: }
/* end */

第二部分

C:/Ruby31-x64/lib/ruby/3.1.0/mkmf.rb:498:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
To see why this extension failed to compile, please check the mkmf.log which can be found here: //(same mkmf.log)

extconf failed, exit code 1


所以,我進入第二部分,需要安裝開發工具……有一個線程試圖回答這個問題,但不是Ruby+Devkit處理這部分嗎? 我錯過了什么?

我看到其他答案告訴我在路徑中添加 devkit,但我的計算機中沒有任何 RubyDevkit 文件夾……我迷路了。

提前感謝任何回答,希望我沒有忘記任何事情^^'

好的,我想我找到了答案:問題是我使用的是 git bash 的命令提示符。我嘗試commande prompt with ruby的命令提示符,安裝似乎工作正常。

所以,我不明白 git bash 的問題出在哪里,但我現在已經完成了,因為它似乎工作正常。

謝謝您的幫助 !

我沒有成功重現你的問題,一切都對我有用 ^^'。 您可以打開命令提示符並輸入以下命令的 output 嗎:

ridk install

暫無
暫無

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

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