"错误:无法构建gem原生扩展。"安装Rails时

时间:2015-09-10 21:17:19

标签: ruby-on-rails ruby gem install rvm

我正在尝试安装Rails。我安装了RVM,然后通过它安装了最新的Ruby版本(它可以工作),但安装Rails失败了:

serge1peshcoff@myLaptop:~$ gem install rails
Building native extensions.  This could take a while...
/home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /allext/soft_without_install in PATH, mode 040777
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    /home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150911-21759-1c3q6e9.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
*** 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.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/bin/$(RUBY_BASE_NAME)
    --help
    --clean
    --use-system-libraries
/home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': /home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/x86_64-linux/digest/md5.so: undefined symbol: rb_Digest_MD5_Init - /home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/x86_64-linux/digest/md5.so (LoadError)
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.1/gems/mini_portile-0.6.2/lib/mini_portile.rb:7:in `<top (required)>'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    from extconf.rb:395:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /home/serge1peshcoff/.rvm/gems/ruby-2.2.1/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /home/serge1peshcoff/.rvm/gems/ruby-2.2.1/extensions/x86_64-linux/2.2.0/nokogiri-1.6.6.2/gem_make.out

我搜索了互联网的答案,但我没有发现这样的事情。我试图安装libssl-dev,这是一种情况下的原因,它没有做任何事情。另一个答案说要运行rvm requirements以了解未安装的内容,我也试过了,但它也没有用。所以我完全迷失了。 有谁知道如何解决它?

UPD:我通过nokigiri安装了gem install nokogiri --use-system-libraries,安装时没有错误,但是在运行Rails时我仍然面临同样的错误,如下所示:

serge1peshcoff@myLaptop:/all/Documents/Programming/rails$ rails
/home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/x86_64-linux/digest/md5.so: undefined symbol: rb_Digest_MD5_Init - /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/x86_64-linux/digest/md5.so (LoadError)
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/gems/railties-4.2.4/lib/rails/generators/app_base.rb:1:in `<top (required)>'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/gems/railties-4.2.4/lib/rails/generators/rails/app/app_generator.rb:1:in `<top (required)>'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/gems/railties-4.2.4/lib/rails/commands/application.rb:2:in `<top (required)>'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/gems/railties-4.2.4/lib/rails/cli.rb:14:in `<top (required)>'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/gems/railties-4.2.4/bin/rails:9:in `<top (required)>'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/bin/rails:23:in `load'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/bin/rails:23:in `<main>'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
    from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'

0 个答案:

没有答案