2012-10-17 9 views
11

Widziałem wiele postów na ten temat wcześniej i postępowałem zgodnie z ich instrukcjami, ale nic nie działa. Poniżej opiszę, co zrobiłem, a instrukcje, które mam - będą wdzięczne za radę!Problemy z instalacją Ruby on Mountain Lion - ruby ​​1.9.3 Wont 'compile

Śledzę poniższe instrukcje instalacji: http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac

Pobrałem X-kod dla OSX Mountain Lion, a zainstalowany kompilator 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. 

mam wtedy zrobić zgodnie z instrukcją i zainstalowane najnowszą wersję git

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

i podobnie zrobiono to samo z rvm za pomocą wiersza poleceń:

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

Kiedy następnie spróbuj zainstalować Ruby przy użyciu RVM, mam następujące:

$ 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. 

Korzystanie alternatywny wiersz polecenia otrzymuję podobny wynik choć z pewnymi dodatkowymi bitami:

$ 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 

Patrząc na configure.logs, mam następujące:

$ 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 

Jestem teraz całkowicie zdezorientowany co do tego, co zrobiłem źle - czy ktoś jest w stanie pomóc? Wygląda na to, że jest problem z kompilatorem c (gcc?), Czy interpretuję go poprawnie? Jeśli tak, to jak to naprawić? A także jak dostać się do tego "config.log" wspomnianego w powyższym pliku configure.log?

Dzięki!

+0

Proszę sformatować swój post za pomocą czteroprzestrzennego wcięcia dla wyjścia terminala. –

+1

Co mówi dziennik konfiguracji? – halfelf

+0

proszę przeczytać /Users/mondemoo/.rvm/log/ruby-1.9.3-p286/configure.log, jest uprzejmy o tym. –

Odpowiedz

22

Jest to błąd w RailsInstaller OSX 1.0.3 - https://github.com/railsinstaller/railsinstaller-nix/issues/10

trzeba zmienić /etc/rvmrc zawierać to:

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') 

będę przygotować nową wersję instalatora, gdy Ruby binarny jest dostępny dla 2.0.0.

UPDATE: dla nowej wersji RVM 1.19+/etc/rvmrc powinno być zmienione na:

umask g+w 
export rvm_autolibs_flag=smf 

I uruchomić rvm get stabel #OR: head

+0

Zignoruj ​​mój ostatni wpis, po prostu zobaczyłem, że linia się kontynuuje - spróbuje teraz. – MrBernz

+0

Idealne, dzięki !! – MrBernz

+0

Dziękuję bardzo! To działało dla mnie ... i zainstalowałem także wersję Ruby 2.0.0. – markstewie

1

Nie wiesz, zrobiłem go 'poprawny' sposób, ale ja po prostu usunięte RVM (RVM implode), a następnie ponownie go zainstalować (\ curl -L https://get.rvm.io | bash -s stable --ruby) i jest zainstalowany i działa teraz z najnowszą wersją ruby ​​1.9.3-p327 bez problemu.

+0

Naprawdę mam to znowu działać, jednak wciąż mam inne problemy z budowaniem innych rzeczy, które wymagają natywnych rozszerzeń. :( – Adron