2012-10-17 3 views
11

J'ai vu un certain nombre de messages à ce sujet avant et ont suivi leurs instructions, mais rien ne fonctionne. Je vais décrire ci-dessous ce que j'ai fait, et les instructions que j'ai suivies - serait reconnaissant pour tout conseil!Problèmes d'installation de Ruby sur Mountain Lion - ruby ​​1.9.3 wont 'compiler

J'ai suivi les instructions d'installation suivantes: http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac

J'ai téléchargé le code-X pour Mac OS X Mountain Lion, et installé le compilateur gcc:

$ gcc --version 
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) 
Copyright (C) 2007 Free Software Foundation, Inc. 
This is free software; see the source for copying conditions. There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

Je l'ai ensuite fait conformément aux instructions et installé la dernière version de git

$ git --version 
git version 1.7.10.2 (Apple Git-33) 

et fait de même la même chose avec rvm via la ligne de commande:

$ rvm --version 
rvm 1.16.13 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/] 

Lorsque je tente ensuite d'installer Ruby en utilisant RVM, j'obtiens ce qui suit:

$ rvm install 1.9.3 
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p286. 
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies. 
Installing Ruby from source to: /Users/mondemoo/.rvm/rubies/ruby-1.9.3-p286, this may take a while depending on your cpu(s)... 
ruby-1.9.3-p286 - #downloading ruby-1.9.3-p286, this may take a while depending on your connection... 
ruby-1.9.3-p286 - #extracted to /Users/mondemoo/.rvm/src/ruby-1.9.3-p286 (already extracted) 
ruby-1.9.3-p286 - #configuring 
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include -L/Users/mondemoo/.rvm/usr/lib ./configure --enable-shared --disable-install-doc --prefix=/Users/mondemoo/.rvm/rubies/ruby-1.9.3-p286', please read /Users/mondemoo/.rvm/log/ruby-1.9.3-p286/configure.log 
There has been an error while running configure. Halting the installation. 

En utilisant la ligne de commande autre que je reçois une sortie similaire si la avec quelques bits supplémentaires:

$ rvm install 1.9.3 --with-gcc=clang 
-bash: -dumpversion: command not found 
-bash: --version: command not found 
-bash: --version: command not found 
Installing Ruby from source to: /Users/mondemoo/.rvm/rubies/ruby-1.9.3-p286, this may take a while depending on your cpu(s)... 
ruby-1.9.3-p286 - #downloading ruby-1.9.3-p286, this may take a while depending on your connection... 
ruby-1.9.3-p286 - #extracted to /Users/mondemoo/.rvm/src/ruby-1.9.3-p286 (already extracted) 
ruby-1.9.3-p286 - #configuring 
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include -L/Users/mondemoo/.rvm/usr/lib ./configure --enable-shared --disable-install-doc --prefix=/Users/mondemoo/.rvm/rubies/ruby-1.9.3-p286 --with-gcc=clang', please read /Users/mondemoo/.rvm/log/ruby-1.9.3-p286/configure.log 
There has been an error while running configure. Halting the installation. 
-bash: --version: command not found 

en regardant dans les configure.logs, je reçois le texte suivant:

$ less /Users/mondemoo/.rvm/log/ruby-1.9.3-p286/configure.log 
[2012-10-17 07:39:15] env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include -L/Users/mondemoo/.rvm/usr/lib ./configure --enable-shared --disable-install-doc --prefix=/Users/mondemoo/.rvm/rubies/ruby-1.9.3-p286 --with-gcc=clang 
checking build system type... x86_64-apple-darwin12.2.0 
checking host system type... x86_64-apple-darwin12.2.0 
checking target system type... x86_64-apple-darwin12.2.0 
checking whether the C compiler works... no 
configure: error: in `/Users/mondemoo/.rvm/src/ruby-1.9.3-p286': 
configure: error: C compiler cannot create executables 
See `config.log' for more details 

Je suis maintenant tout à fait confus quant à ce que j'ai fait de mal - est-ce que quelqu'un peut aider? Il semble qu'il y ait un problème avec le compilateur c (gcc?), Est-ce que je l'interprète correctement? Si oui, comment puis-je résoudre ce problème? Comment puis-je obtenir ce "config.log" qui est mentionné dans le configure.log ci-dessus?

Merci!

+0

Veuillez formater votre message en utilisant une indentation à quatre espaces pour la sortie du terminal. –

+1

Alors, que dit le journal de configuration? – halfelf

+0

s'il vous plaît lire /Users/mondemoo/.rvm/log/ruby-1.9.3-p286/configure.log, c'est poli à ce sujet. –

Répondre

22

Ce bogue dans RailsInstaller Mac OS X 1.0.3 - https://github.com/railsinstaller/railsinstaller-nix/issues/10

vous devez changer /etc/rvmrc pour contenir ceci:

umask g+w 
export -a rvm_configure_env 
rvm_configure_env=('LDFLAGS=-L/opt/sm/pkg/active/lib' 'CFLAGS=-I/opt/sm/pkg/active/include' 'CPATH=/opt/sm/pkg/active/include') 

Je préparerai une nouvelle version du programme d'installation lorsque Ruby binaire est disponible pour 2.0.0.

MISE À JOUR: pour une nouvelle version de RVM 1.19+/etc/rvmrc doit être remplacé par:

umask g+w 
export rvm_autolibs_flag=smf 

Et courir rvm get stabel #OR: head

+0

Ignorer mon dernier message, juste vu la ligne continue - va l'essayer maintenant. – MrBernz

+0

Parfait, merci !! – MrBernz

+0

Merci beaucoup! Cela a fonctionné pour moi ... et pour installer Ruby 2.0.0 aussi. – markstewie

1

Je ne sais pas je l'ai fait la façon 'correcte', mais je retire RVM (RVM implode) puis l'a réinstallé (\ curl -L https://get.rvm.io | bash -s stable --ruby) et il est installé et exécute maintenant la dernière version de ruby ​​1.9.3-p327 sans problème.

+0

J'ai effectivement eu ce travail à nouveau aussi, mais j'ai encore d'autres problèmes de construction d'autres choses qui nécessitent des extensions natives. :( – Adron

Questions connexes