当前位置: 首页 > 面试题库 >

如何使用gem在Ubuntu上安装Rails

池宸
2023-03-14
问题内容

错误信息:

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

    /usr/bin/ruby2.1 -r ./siteconf20150328-1540-hff2f0.rb extconf.rb
checking if the C compiler accepts ... *** 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=/usr/bin/ruby2.1
  --help
  --clean
/usr/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
  from /usr/lib/ruby/2.1.0/mkmf.rb:571:in `block in try_compile'
  from /usr/lib/ruby/2.1.0/mkmf.rb:522:in `with_werror'
  from /usr/lib/ruby/2.1.0/mkmf.rb:571:in `try_compile'
  from extconf.rb:80:in `nokogiri_try_compile'
  from extconf.rb:87:in `block in add_cflags'
  from /usr/lib/ruby/2.1.0/mkmf.rb:621:in `with_cflags'
  from extconf.rb:86:in `add_cflags'
  from extconf.rb:337:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.1.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/nokogiri-1.6.6.2/gem_make.out

配置:

  1. Ubuntu 14.10(GNU / Linux 3.16.0-23-通用x86_64)
  2. gcc(Ubuntu 4.9.1-16ubuntu6)4.9.1
  3. 红宝石2.1.2p95(2014-05-08)[x86_64-linux-gnu]

问题答案:

使用RVM在Ubuntu 14.04上升级到Rails 4.2.4之后,我需要这样做:

sudo apt-get install libgmp-dev

要么

sudo apt-get install libgmp3-dev

完整的堆栈跟踪:http: //ruby-on-rails-
eq8.blogspot.co.uk/2015/10/solving-ubuntu-1404-ruby-c-
dependancy.html



 类似资料:
  • 我正试图在Ubuntu19.04上安装gem selenium webdriver,但我一直遇到以下错误: 构建本机扩展。这可能需要一段时间。。。错误:安装selenium webdriver时出错:错误:无法生成gem本机扩展。 当前目录:/var/lib/gems/2.5.0/gems/childprocess-1.0.1/ext/usr/bin/ruby2。5-rrubygems/usr/s

  • 本文向大家介绍如何在Ubuntu上安装ImageMagick,包括了如何在Ubuntu上安装ImageMagick的使用技巧和注意事项,需要的朋友参考一下 使用ImageMagick创建,编辑,合成或转换位图pix。它实际上可以用一种编解码器(超过200种)来读取和写入快照,包括PNG,JPEG,JPEG-2000,GIF,TIFF,DPX,EXR,WebP,Postscript,PDF和SVG。

  • 本文向大家介绍如何在Ubuntu 16.04上安装和使用Docker,包括了如何在Ubuntu 16.04上安装和使用Docker的使用技巧和注意事项,需要的朋友参考一下 Docker是一个开源项目,可以自动在软件容器内部署应用程序。该容器允许开发人员打包所有项目资源,例如库,依赖项,资产等。Docker用Go编程语言编写,由Dotcloud开发。它基本上是一个容器引擎,使用诸如命名空间和控制组之

  • 本文向大家介绍如何在Ubuntu上安装Python 3.4.4,包括了如何在Ubuntu上安装Python 3.4.4的使用技巧和注意事项,需要的朋友参考一下 Python是一种通用的解释型,交互式,面向对象的高级编程语言。它是由Guido van Rossum在1985-1990年间创建的。与Perl一样,Python源代码也可以根据GNU通用公共许可证(GPL)获得。本文介绍了“如何在Ubun

  • 问题内容: 一般来说,我是Ubuntu和Linux的新手。我想在计算机上用Java编写代码,但是在Ubuntu上安装IntelliJ IDEA 时遇到问题。我已经下载并解压缩了文件,并且由于某种原因将该文件夹重命名为idea。我尝试将文件夹移至或其他位置,但没有权限。我在终端中使用以获得许可,但没有设法退出根文件夹。谁能一步一步地为我提供帮助,以移动文件夹,在搜索栏中创建快捷方式或所谓的快捷方式并