尝试安装jekyll,收到以下错误:无法构建gem原生扩展

时间:2013-07-15 05:38:50

标签: ruby ubuntu gem installation jekyll

我正在尝试安装Jekyll,但我一直遇到这个错误。这是我尝试安装它的输出

clinch@clinch-VirtualBox:~$ gem install jekyllBuilding native extensions.  This could take a while...
ERROR:  Error installing jekyll:
    ERROR: Failed to build gem native extension.

        /home/clinch/.rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
creating Makefile

make
compiling porter.c
cc1: unrecognized option `-Wextra'
cc1: unrecognized option `-Wno-missing-field-initializers'
cc1: unrecognized option `-Wdeclaration-after-statement'
make: *** [porter.o] Error 1


Gem files will remain installed in /home/clinch/.rvm/gems/ruby-1.9.3-p392/gems/fast-stemmer-1.0.2 for inspection.
Results logged to /home/clinch/.rvm/gems/ruby-1.9.3-p392/gems/fast-stemmer-1.0.2/ext/gem_make.out
clinch@clinch-VirtualBox:~$ gcc -v
Using built-in specs.
Configured with: ./configure --target=mips-dec-ultrix42 --program-prefix=mips- --with-gnu-as --with-gnu-ld --enable-obsolete
Thread model: single
gcc version 3.2.2
clinch@clinch-VirtualBox:~$ ruby -v
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]
clinch@clinch-VirtualBox:~$ uname -a
Linux clinch-VirtualBox 3.2.0-37-generic #58-Ubuntu SMP Thu Jan 24 15:28:10 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

我已经安装了ruby1.9.1-dev软件包。我尝试使用gcc 4.6进行编译,而不是在我粘贴的输出中显示3.2.2。我也不知道原生扩展错误是否使gcc死亡。我也从头开始重建红宝石。

也许我应该尝试使用其他Ruby版本?虽然我知道1.9.3是由jekyll支持的。

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

尝试从 Ruby或Ruby和Rails命令提示符而不是任何其他命令提示符安装Jekyll

我根本不是专家,所以我建议的解决方案只是一个猜测'根据我的经验。

我使用的是Windows 7.虽然你使用的是Ubuntu而不是Windows 7,但这个解决方案可能适用于任何有同样问题的人。

首先,我从RailsInstaller安装了Ruby。然后,我想安装Jekyll。我尝试从 Cygwin 安装Jekyll。但是,我收到了以下错误(尽管它与提问者的错误不同,我认为它非常相似):

$ gem install jekyll
Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
        ERROR: Failed to build gem native extension.

        /usr/bin/ruby.exe extconf.rb
creating Makefile

make
gcc -I. -I/usr/include/ruby-1.9.1/x86_64-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I.   -ggdb -O2 -pipe   -fno-strict-aliasing  -Wall   -o posix-spawn.o -c posix-spawn.c
posix-spawn.c:9:19: fatal error: spawn.h: No such file or directory
 #include <spawn.h>
                   ^
compilation terminated.
Makefile:206: recipe for target `posix-spawn.o' failed
make: *** [posix-spawn.o] Error 1


Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.6 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.6/ext/gem_make.out

但是,当我尝试使用Ruby和Rails (即Ruby命令提示符)从命令提示符安装Jekyll时,Jekyll已成功安装。

为了防止这种情况发生,我在尝试从Ruby and Rails命令提示符下安装Jekyll之前(成功)删除了系统变量{Variable:Comspec,Value:C:\ Windows \ system32 \ cmd.exe}。