Le résultat final est que j'essaie d'obtenir Ruby on Rails installé sur mon OS 10.7.3, mais ayant divers problèmes).
De plus, j'ai un XCode 4.3 fraîchement installé sur l'App Store.
Lorsque j'allume le terminal et entre:
Sudo gem install Rails
et il écrit:
Building native extensions. This could take a while...
ERROR: Error installing Rails:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/Ruby extconf.rb
mkmf.rb can't find header files for Ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/Ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.6.5 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.6.5/ext/json/ext/parser/gem_make.out
Dans tous les correctifs que je trouve, dit d'installer XCode, que j'ai et fonctionne très bien. Cependant, j'ai désinstallé une version précédente de XCode pour installer la dernière version, donc je me demande s'il y a une relation là-bas.
EDIT 1: J'ai suivi la suggestion de Jasdeep et installé RVM. Mais une fois que je cours:
Sudo rvm install 1.9.3
J'obtiens ce qui suit:
Fetching yaml-0.1.4.tar.gz to /Users/xxx/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/xxx/.rvm/src
Configuring yaml in /Users/xxx/.rvm/src/yaml-0.1.4.
Error running ' ./configure --prefix="/Users/xxx/.rvm/usr" ', please read /Users/xxx/.rvm/log/Ruby-1.9.3-p0/yaml/configure.log
Compiling yaml in /Users/xxx/.rvm/src/yaml-0.1.4.
Error running 'make ', please read /Users/xxx/.rvm/log/Ruby-1.9.3-p0/yaml/make.log
Database file /Users/xxx/.rvm/config/packages does not exist.
gcc-4.2: error trying to exec '/usr/bin/i686-Apple-darwin11-gcc-4.2.1': execvp: No such file or directory
Installing Ruby from source to: /Users/xxx/.rvm/rubies/Ruby-1.9.3-p0, this may take a while depending on your cpu(s)...
Ruby-1.9.3-p0 - #fetching
Ruby-1.9.3-p0 - #downloading Ruby-1.9.3-p0, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9330k 100 9330k 0 0 645k 0 0:00:14 0:00:14 --:--:-- 1260k
Ruby-1.9.3-p0 - #extracting Ruby-1.9.3-p0 to /Users/xxx/.rvm/src/Ruby-1.9.3-p0
Ruby-1.9.3-p0 - #extracted to /Users/xxx/.rvm/src/Ruby-1.9.3-p0
Ruby-1.9.3-p0 - #configuring
Error running ' ./configure --prefix=/Users/xxx/.rvm/rubies/Ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/xxx/.rvm/usr ', please read /Users/xxx/.rvm/log/Ruby-1.9.3-p0/configure.log
There has been an error while running configure. Halting the installation.
Alors j'ai recherché ce qui était dans le fichier journal, ..Ruby-1.9.3-p0/yaml/configure.log:
[2012-03-03 22:49:50] ./configure --prefix="/Users/xxx/.rvm/usr"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/xxx/.rvm/src/yaml-0.1.4':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
Alors maintenant, il semble que l'erreur soit:
no acceptable C compiler found in $PATH
Modifier 2:
J'ai suivi les instructions de matt et j'ai pu aller plus loin une fois que j'ai installé les outils de ligne de commande (puisque j'ai maintenant Xcode 4.3). Cependant, je reçois toujours une erreur:
Fetching yaml-0.1.4.tar.gz to /Users/xxx/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/xxx/.rvm/src
Configuring yaml in /Users/xxx/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/xxx/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/xxx/.rvm/usr
gcc-4.2: error trying to exec '/usr/bin/i686-Apple-darwin11-gcc-4.2.1': execvp: No such file or directory
Installing Ruby from source to: /Users/xxx/.rvm/rubies/Ruby-1.9.3-p0, this may take a while depending on your cpu(s)...
Ruby-1.9.3-p0 - #fetching
Ruby-1.9.3-p0 - #extracted to /Users/xxx/.rvm/src/Ruby-1.9.3-p0 (already extracted)
Ruby-1.9.3-p0 - #configuring
Error running ' ./configure --prefix=/Users/xxx/.rvm/rubies/Ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/xxx/.rvm/usr ', please read /Users/xxx/.rvm/log/Ruby-1.9.3-p0/configure.log
There has been an error while running configure. Halting the installation.
Vous trouverez ci-dessous le configure.log (désolé, ce message devient si long, mais j'espère qu'il peut aussi aider les autres):
[2012-03-04 09:29:35] ./configure --prefix="/Users/xxx/.rvm/usr"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking build system type... x86_64-Apple-darwin11.3.0
checking Host system type... x86_64-Apple-darwin11.3.0
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/llvm-gcc-4.2/libexec/gcc/i686-Apple-darwin11/4.2.1/ld
checking if the linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-Apple-darwin11/4.2.1/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking the maximum length of command line arguments... 196608
checking whether the Shell understands some XSI constructs... yes
checking whether the Shell understands "+="... yes
checking for /usr/llvm-gcc-4.2/libexec/gcc/i686-Apple-darwin11/4.2.1/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from gcc object... ok
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-Apple-darwin11/4.2.1/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin11.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for doxygen... false
checking for ANSI C header files... (cached) yes
checking for stdlib.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
configure: creating ./config.status
config.status: creating yaml-0.1.pc
config.status: creating include/Makefile
config.status: creating src/Makefile
config.status: creating Makefile
config.status: creating tests/Makefile
config.status: creating win32/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
Le problème est que dans Lion Xcode 4.3 n'installe pas (ou n'inclut même pas) par défaut les outils de ligne de commande tels que gcc - et ce sont ceux qui sont nécessaires ici. Dans le volet Téléchargements des préférences de Xcode, sous Composants, demandez les outils de ligne de commande. (Voir le readme: https://developer.Apple.com/library/content/documentation/DeveloperTools/Conceptual/WhatsNewXcode/Chapters/xcode_4_0.html#//Apple_ref/doc/uid/TP40016147-SW35 =)
En fait, je pense que vous n'avez pas du tout besoin d'installer Xcode, car en fait, l'outil de ligne de commande peut maintenant être téléchargé et installé séparément.
J'avais déjà installé des outils de ligne de commande (xCode également) ... et j'avais toujours cette erreur (initiale).
Le problème était que xCode et les outils de ligne de commande n'installaient plus le compilateur gcc. Je ne sais pas quand ils ont cessé de l'expédier, mais je dirige Mountain Lion, et ce n'est pas ici. Donc, ce qui a finalement résolu mon problème, c'était d'installer gcc à partir de zéro ( https://github.com/kennethreitz/osx-gcc-installer ).
Garder le sourire :)
Si quelqu'un a le même problème pour Ubuntu Linux, la solution était:
Sudo apt-get install build-essential
Sudo apt-get install libsqlite3-dev