简体   繁体   中英

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.

I am following this official guide: 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?

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. It may be installed as part of a Ruby application and used inside it. In a certain sense you may say it is a library as a JAR file, although differently organized and used. Gems allow Ruby developers to share and reuse code easily.

  • Bundler is an application that keeps your gems organized. It downloads and installs all all gems you need in your app, updates them when needed and much more. 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.

  • 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. The native extensions are written in C and they depend on C header to be built.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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