简体   繁体   English

Windows:安装 jekyll 时出错 + gem 更新失败 - 错误:无法构建 gem 本机扩展

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

[System: Windows 10] (pro, up to date) [系统:Windows 10] (亲,最新)

Hi folks, I'm new here and I know I have a question asked many times, but… I don't understand the answers, frankly, and I'm fairly lost… English is not my native language, sorry if it shows.大家好,我是新来的,我知道我有一个问题被问过很多次,但是……坦率地说,我不明白答案,而且我很迷茫……英语不是我的母语,如果它显示出来,我很抱歉。

What I want to do:我想做的事:

I want to install Jekyll for a personal blog.我想为个人博客安装 Jekyll。 I have an issue at the end of the installation: Error installing jekyll: ERROR: Failed to build gem native extension我在安装结束时遇到问题: Error installing jekyll: ERROR: Failed to build gem native extension

What I already did:我已经做了什么:

  • Following the instructions here , I have installed Ruby+Devkit 3.1.1-1 (x64) , with the ridk install crossed at the end of the install.按照此处的说明,我安装了Ruby+Devkit 3.1.1-1 (x64) ,并在安装结束时划掉了ridk install install。
  • The ridk install open a command window, I have installed the 3 things asked and it seems to have succeeded. ridk install 打开命令 window,我已经安装了要求的 3 个东西,似乎已经成功了。
  • I installed gcc with mingw-get-setup.exe for the dependancies (if I'm not mistaken, maybe it wasn't necessary).我安装了gccmingw-get-setup.exe作为依赖项(如果我没记错的话,也许没有必要)。
  • Run in git bash gem install bundler (with or without admin right, seems to do the same).在 git bash gem install bundler中运行(有或没有管理员权限,似乎都一样)。 Success.成功。
  • Run in git bash gem install jekyll - fail.运行 git bash gem install jekyll jekyll - 失败。 (even after a relaunch of the computer). (即使在重新启动计算机之后)。
  • I have seen an answer in another thread who was telling to do a gem update before installing Jekyll - failed.我在另一个线程中看到了一个答案,该线程告诉我在安装 Jekyll 之前进行gem update - 失败了。

So I guess the problem is more on this end, here are the logs:所以我想问题更多的是这一端,这里是日志:
First part:第一部分:

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.

the mkmf.log file: 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 */

2nd part :第二部分

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


So, I get in the 2nd part that the development tools need to be installed… There is this thread who try to answer this question, but wasn't Ruby+Devkit handling this part?所以,我进入第二部分,需要安装开发工具……有一个线程试图回答这个问题,但不是Ruby+Devkit处理这部分吗? Did I miss something?我错过了什么?

I have seen other answers telling to add the devkit in the path, but I don't have any RubyDevkit folder in my computer… I'm lost.我看到其他答案告诉我在路径中添加 devkit,但我的计算机中没有任何 RubyDevkit 文件夹……我迷路了。

Thanks in advance for any answer, hope I did not forget anything ^^'提前感谢任何回答,希望我没有忘记任何事情^^'

Ok I think I found my answer: the problem was that I was using the command prompt of git bash. I tried commande prompt with ruby and the installation seems to work fine.好的,我想我找到了答案:问题是我使用的是 git bash 的命令提示符。我尝试commande prompt with ruby的命令提示符,安装似乎工作正常。

So, I don't understand where is the issue with git bash, but I'm done for now since it seems to work fine.所以,我不明白 git bash 的问题出在哪里,但我现在已经完成了,因为它似乎工作正常。

Thanks for the help !谢谢您的帮助 !

I didn't succeed to reproduce your issue everything works for me ^^'.我没有成功重现你的问题,一切都对我有用 ^^'。 Can you open a Command Prompt and past the output of the following command:您可以打开命令提示符并输入以下命令的 output 吗:

ridk install

?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM