2014-10-28 6 views
11

Sto creando un'app per rotaie e sono appena stato aggiornato a Yosemite, e penso che durante l'aggiornamento tutto si sia rotto. Tutto funzionava la scorsa notte quando ho controllato tutto il mio codice su github. Ho aggiornato il mio computer ieri sera a Yosemite. Oggi ho corso gem install bcrypt-ruby e tutto si è rotto. Io ho;Gem :: Ext :: BuildError: ERRORE: impossibile creare l'estensione nativa gemma Bcrypt-Ruby

  1. corse xcodebuild -license
  2. bundler aggiornato
  3. corse brew install rbenv ruby-build rbenv-gem-rehash per ottenere le ultime rubino
  4. corse brew install coreutils

che non ha funzionato però.

ambiente:OSX Yosemite 10.10, rbenv 0.4.0, rubino 2.1.3p242 (2014/09/19 revisione 47630) [x86_64-darwin14.0], birra 0.9.5 `

l'origine dell'errore è dalla mia applicazione rails:

Gemfile

gem 'rails', '4.1.5' 
gem 'pg' 
gem 'uglifier', '>= 1.3.0' 
gem 'jquery-rails' 
gem 'turbolinks' 
gem 'jbuilder', '~> 2.0' 
gem 'sdoc', '~> 0.4.0',   group: :doc 
gem 'spring',  group: :development 
gem 'bcrypt-ruby' 

group :test, :development do 
    gem 'rspec-rails', "~> 2.14" 
end 
group :test do 
    gem 'capybara', "2.1.0" 
    gem 'factory_girl_rails', '~> 4.2.1' 
end 

Ho ricevuto l'errore quando corro bundle install. Ecco la traccia dello stack completo (tutti i /users// è di prendere il nome ;)

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    /Users//.rbenv/versions/2.0.0-p247/bin/ruby -r ./siteconf20141027-60319-1lss4fm.rb extconf.rb 
creating Makefile 

make "DESTDIR=" clean 

make "DESTDIR=" 
compiling bcrypt_ext.c 
couldn't understand kern.osversion `14.0.0' 
In file included from /Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby.h:33, 
       from bcrypt_ext.c:1: 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/ruby.h:51:21: error: string.h: No such file or directory 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/ruby.h:61:21: error: stdint.h: No such file or directory 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/ruby.h:64:23: error: inttypes.h: No such file or directory 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/ruby.h:68:19: error: stdio.h: No such file or directory 
In file included from /Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/ruby.h:70, 
       from /Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby.h:33, 
       from bcrypt_ext.c:1: 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/defines.h:29:21: error: stdlib.h: No such file or directory 
In file included from /Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/ruby.h:194, 
       from /Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby.h:33, 
       from bcrypt_ext.c:1: 
/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/../lib/gcc/i686-apple-darwin11/4.2.1/include/limits.h:10:25: error: limits.h: No such file or directory 
In file included from /Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/ruby.h:1567, 
       from /Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby.h:33, 
       from bcrypt_ext.c:1: 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/missing.h:23:45: error: math.h: No such file or directory 
In file included from /Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/ruby.h:1568, 
       from /Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby.h:33, 
       from bcrypt_ext.c:1: 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:36:23: error: sys/types.h: No such file or directory 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:40:22: error: sys/time.h: No such file or directory 
In file included from /Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:43, 
       from /Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/ruby.h:1568, 
       from /Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby.h:33, 
       from bcrypt_ext.c:1: 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/st.h:140: error: expected declaration specifiers or ‘...’ before ‘uint32_t’ 
In file included from /Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/ruby.h:1568, 
       from /Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby.h:33, 
       from bcrypt_ext.c:1: 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:326: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_fdset_t’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:416: error: expected declaration specifiers or ‘...’ before ‘fd_set’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:416: error: expected declaration specifiers or ‘...’ before ‘fd_set’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:416: error: expected declaration specifiers or ‘...’ before ‘fd_set’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:416: warning: ‘struct timeval’ declared inside parameter list 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:416: warning: its scope is only this definition or declaration, which is probably not what you want 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:417: error: expected declaration specifiers or ‘...’ before ‘rb_fdset_t’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:417: error: expected declaration specifiers or ‘...’ before ‘rb_fdset_t’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:417: error: expected declaration specifiers or ‘...’ before ‘rb_fdset_t’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:417: warning: ‘struct timeval’ declared inside parameter list 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:418: warning: ‘struct timeval’ declared inside parameter list 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:514: error: expected declaration specifiers or ‘...’ before ‘mode_t’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:593: error: expected declaration specifiers or ‘...’ before ‘pid_t’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:607: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_fork’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:608: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_fork_err’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:610: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_waitpid’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:611: error: expected ‘)’ before ‘pid’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:612: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_spawn’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:613: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_spawn_err’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:615: error: expected ‘)’ before ‘pid’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:728: error: expected declaration specifiers or ‘...’ before ‘uint32_t’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:851: error: expected ‘)’ before ‘long’ 
/Users//.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby/intern.h:852: error: expected ‘)’ before ‘long’ 
bcrypt_ext.c: In function ‘bc_salt’: 
bcrypt_ext.c:21: warning: incompatible implicit declaration of built-in function ‘strlen’ 
make: *** [bcrypt_ext.o] Error 1 

make failed, exit code 2 

Gem files will remain installed in /Users//ticket_tracker/vendor/bundle/gems/bcrypt-3.1.9 for inspection. 
Results logged to /Users//ticket_tracker/vendor/bundle/extensions/x86_64-darwin-12/2.0.0-static/bcrypt-3.1.9/gem_make.out 
An error occurred while installing bcrypt (3.1.9), and Bundler cannot continue. 
Make sure that `gem install bcrypt -v '3.1.9'` succeeds before bundling. 

Se qualcuno ha avuto qualche esperienza aggiornato OSX, Rbenv, Ruby ecc e mi può dare alcune indicazioni, che sarebbe molto apprezzato. Posso anche pubblicare più impostazioni di codice/ambiente, se necessario.

risposta

19

Ho avuto lo stesso problema che ho risolto reinstallando gli strumenti di sviluppo XCode riga di comando:

xcode-select --install 
bundle install 
+0

Per qualche ragione questo è quello che ho pensato che ho risolto con 'Xcode -license'. Grazie per averlo chiarito. – user3749994

+1

Sembra che ogni nuova installazione o aggiornamento di xcode richieda la reinstallazione degli strumenti da riga di comando. –

+0

Take leggermente diverso, ho avuto lo stesso errore, ho provato xcodebuild -license e ho ricevuto un errore che diceva di aver bisogno di usare sudo, quindi 'sudo xcodebuild -license' e ha funzionato. Sono ancora su Mavericks ma ho scaricato Yosemite per l'installazione, quindi non sono sicuro che questo abbia un impatto sulle cose. – gorlaz

-1

Se c'è qualcuno là fuori ancora lottando e non è ovvio, io vi consiglio di installa XCode. Ho eseguito due aggiornamenti OSX 10.10 ed entrambi hanno richiesto a XCode di risolvere questo problema.

0

Dopo aver eseguito l'aggiornamento a OS X Yosemite e aver provato a eseguire alcune app su rotaie, ho riscontrato altri problemi;

A causa di una pazzia di mela dopo l'installazione di Xcode gcc non compila programmi come qualsiasi altro compilatore gcc - invece ti chiede di leggere e accettare il contratto di licenza - che è una maledetta sfacciata considerando che è gcc. Prova

gcc --version 

quindi sfogliare la merda di licenza e tipo di accordo alla fine allora dovrebbe agire come un normale compilatore gcc.

Tuttavia, potrebbe non funzionare poiché la versione in bundle di gcc (4.2.1) è troppo vecchia per libv8 (era necessario 4.4), quindi è necessario installare una versione successiva di gcc utilizzando macports. Visita lo http://www.macports.org/install.php.Una volta macports è installato tipo

sudo port install gcc48 +universal 
sudo port select --set gcc mp-gcc48 
hash gcc 
gcc --version 

e si dovrebbe vedere

gcc (MacPorts gcc48 4.8.4_0+universal) 4.8.4 

come del 2015/03/02 gcc4.8 ha avuto 4 release bug fix e gcc4.9 ha avuto 2 in modo da fare la vostra scelta .

Ora che si dispone di un compilatore gcc più aggiornato, il prossimo ostacolo è la creazione di terubyracer. Gcc4.8 su darwin non riconosce l'opzione -rdinamica in modo che il terubyracer non costruisca.

Ho biforcuto therubyracer e ho modificato extconf.rb per modificare le opzioni del compilatore: è possibile utilizzarlo da github. Per farlo cambia il tuo Gemfile in questo modo

# See https://github.com/sstephenson/execjs#readme for more supported runtimes 
platforms :ruby do 
    if RUBY_PLATFORM=~ /darwin/ 
    gem 'therubyracer', :git => 'https://github.com/damianham/therubyracer.git' 
    else 
    gem 'therubyracer', '0.12.1' 
    end 
end 
1

Solo una combinazione di azioni mi ha aiutato a risolvere il problema. Ecco la mia sequenza

1)

xcode-select --install 
bundle install 

2)

brew update 
brew upgrade rbenv ruby-build 

3) passato da ruby ​​2.1.4 a 2.1.5

rbenv install 2.1.5 
rbenv global 2.1.5 
rbenv shell 2.1.5 
rbenv rehash 
gem install bundler 
bundle 

4) (optional) in caso di problemi con l'installazione di nokogiri

brew install libxml2 
bundle config build.nokogiri "--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2" 
bundle 
0

Io corro Rubino v 2.2.2, questo mi ha aiutato quando ho ricevuto questo errore:

Gem :: :: Ext BuildError: ERRORE: impossibile costruire gioiello estensione nativa Bcrypt-Rubino

xcode-select --install 
brew update 
gem install bundler 
bundle install 

Se --install Xcode-select fallisce assicurarsi di aver accettato la licenza

sudo xcodebuild -license accept