2012-09-23 29 views
70

He estado instalando Ruby on Rails según las instrucciones de la clase en línea de edX.Error al construir la extensión nativa de gema - Instalación de Rails

Aquí es una lista de comandos de terminal, y, en su caso, de salida correspondiente:

$ sudo apt-get install ruby1.9.1 

instalación exitosa

$ wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz 
$ tar zxvf ruby-1.8.24.tgz 
$ cd ruby-1..8.24 
$ sudo ruby setup.rb 
RubyGems 1.8.24 installed 

== 1.8.24/2012-04-27 

* 1 bug fix: 

    * Install the .pem files properly. Fixes #320 
    * Remove OpenSSL dependency from the http code path 


------------------------------------------------------------------------------ 

RubyGems installed the following executables: 
    /usr/bin/gem1.9.1 

Hasta aquí, todo se veía bien, pero la he intentado instalar carriles y fallaron:

$ sudo gem install rails 
Fetching: i18n-0.6.1.gem (100%) 
Fetching: multi_json-1.3.6.gem (100%) 
Fetching: activesupport-3.2.8.gem (100%) 
Fetching: builder-3.0.3.gem (100%) 
Fetching: activemodel-3.2.8.gem (100%) 
Fetching: rack-1.4.1.gem (100%) 
Fetching: rack-cache-1.2.gem (100%) 
Fetching: rack-test-0.6.1.gem (100%) 
Fetching: journey-1.0.4.gem (100%) 
Fetching: hike-1.2.1.gem (100%) 
Fetching: tilt-1.3.3.gem (100%) 
Fetching: sprockets-2.1.3.gem (100%) 
Fetching: erubis-2.7.0.gem (100%) 
Fetching: actionpack-3.2.8.gem (100%) 
Fetching: arel-3.0.2.gem (100%) 
Fetching: tzinfo-0.3.33.gem (100%) 
Fetching: activerecord-3.2.8.gem (100%) 
Fetching: activeresource-3.2.8.gem (100%) 
Fetching: mime-types-1.19.gem (100%) 
Fetching: polyglot-0.3.3.gem (100%) 
Fetching: treetop-1.4.10.gem (100%) 
Fetching: mail-2.4.4.gem (100%) 
Fetching: actionmailer-3.2.8.gem (100%) 
Fetching: rake-0.9.2.2.gem (100%) 
Fetching: rack-ssl-1.3.2.gem (100%) 
Fetching: thor-0.16.0.gem (100%) 
Fetching: json-1.7.5.gem (100%) 
Building native extensions. This could take a while... 
ERROR: Error installing rails: 
    ERROR: Failed to build gem native extension. 

     /usr/bin/ruby1.9.1 extconf.rb 
/usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError) 
    from /usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from extconf.rb:1:in `<main>' 


Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/json-1.7.5 for inspection. 
Results logged to /usr/lib/ruby/gems/1.9.1/gems/json-1.7.5/ext/json/ext/generator/gem_make.out 
+0

posible duplicado de [No se puede instalar la gema - No se pudo construir extensión nativa joya - no puede cargar dicho archivo - MKMF (LoadError)] (http://stackoverflow.com/questions/13767725/unable-to-install-gem-failed-to-build-gem-native-extension-can-load-such) –

Respuesta

149

mkmf es parte del ruby1.9.1-dev paquete. Este paquete contiene los archivos de encabezado necesarios para las bibliotecas de extensión de Ruby 1.9.1. Es necesario instalar el paquete ruby1.9.1-dev haciendo:

sudo apt-get install ruby1.9.1-dev 

continuación, puede instalar rieles con normalidad.

lo general, es más fácil simplemente hacer:

sudo apt-get install ruby-dev 
+0

tuvo que escribir 'sudo apt-get install ruby1.9.1-dev' en lugar de' sudo apt -get install ruby1.9-dev'. De lo contrario funcionó bien, gracias. –

+0

¡Muchas gracias amigo! Me estoy volviendo loco con el problema de dependencia de rb-inotify ... (con sass -watch) – jossemarGT

+0

He hecho esto y sigo teniendo el problema de rb-inotify con sass --watch ... –

4

La respuesta sugerida sólo funciona para ciertas versiones de rubí. Algunos comentaristas sugieren usar ruby-dev; eso tampoco funcionó para mí.

sudo apt-get install ruby-all-dev 

funcionó para mí.

1
sudo apt-get install ruby-dev 

trabajó para mí

Cuestiones relacionadas