简体   繁体   English

为什么我在安装 Ruby bundler gem 时收到此错误消息“错误:无法构建 gem 本机扩展”?

[英]Why I obtain this error message installing the Ruby bundler gem “ERROR: Failed to build gem native extension”?

I am not so into Linux and Ruby and I am having some problem trying to install Redmine on an Ubuntu 16.04 system.我对 Linux 和 Ruby 不太感兴趣,并且在尝试在Ubuntu 16.04系统上安装Redmine时遇到了一些问题。

I am following this official guide: http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_on_Ubuntu_step_by_step我正在关注这个官方指南: http : //www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_on_Ubuntu_step_by_step

I am finding some problem when I perform this command:我在执行此命令时发现了一些问题:

sudo gem update

because during its execution I am obtaining many error messages like this:因为在执行过程中,我收到了许多这样的错误消息:

Updating ffi
Fetching: ffi-1.9.14.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing ffi:
        ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.14/ext/ffi_c
/usr/bin/ruby2.3 -r ./siteconf20161113-6502-1eskdz9.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

What am I missing?我错过了什么? How can I fix this issue?我该如何解决这个问题?

I am not into Ruby, what exactly is this "bundler gem" of Ruby?我不喜欢 Ruby,Ruby 的这个“bundler gem”到底是什么?

I'd like to suggest you two articles.我想向你推荐两篇文章。 There you will find some more info about your problem.在那里你会找到更多关于你的问题的信息。

But I'll try to give you a previous view of you problem and answer your questions.但我会尽量让你对你的问题有一个以前的看法并回答你的问题。

  • A gem is a specific piece of code designed and developed to a certain task. gem 是为特定任务设计和开发的一段特定代码。 It may be installed as part of a Ruby application and used inside it.它可以作为 Ruby 应用程序的一部分安装并在其中使用。 In a certain sense you may say it is a library as a JAR file, although differently organized and used.在某种意义上,您可能会说它是 JAR 文件形式的库,尽管组织和使用方式不同。 Gems allow Ruby developers to share and reuse code easily. Gems 允许 Ruby 开发人员轻松共享和重用代码。

  • Bundler is an application that keeps your gems organized. Bundler 是一个可以让您的 gem 井井有条的应用程序。 It downloads and installs all all gems you need in your app, updates them when needed and much more.它会下载并安装您在应用中需要的所有 gem,并在需要时更新它们等等。 With bundler you may organize all your gems in a single repository, using them for all your apps, or create a private bundle for each application, and the first article teaches.使用 bundler,您可以将所有 gem 组织在一个存储库中,将它们用于您的所有应用程序,或者为每个应用程序创建一个私有包,第一篇文章讲授。

  • Most of the times you get this kind of error it means you haven't installed all tools needed to build programs in your system.大多数情况下,您会遇到此类错误,这意味着您尚未安装在系统中构建程序所需的所有工具。 This means the programs (gcc, ld and other building tools) and headers.这意味着程序(gcc、ld 和其他构建工具)和头文件。 The native extensions are written in C and they depend on C header to be built.本机扩展是用 C 编写的,它们依赖于要构建的 C 头文件。

I hope this helps you.我希望这对你有帮助。 But if you have any other doubts I'll be pleased in editing this asnwer and try to help.但是,如果您有任何其他疑问,我会很高兴编辑此答案并尝试提供帮助。

安装ruby-dev

apt-get install ruby-dev

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

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