OS X Lion: gcc/g++ Error: Command not Found

Logo GCC

 

Da quando ho aggiornato il mio MacBook alla versione 10.7.1 (OS X Lion) non ho mai avuto la necessita’ di compilare codici sorgenti, ma oggi mentre eseguivo il classico ./configure , la shell mi sputato fuori il seguente problema.

 

[sourcecode language=”bash”]
unicondor@MacBook:etherape-0.9.12\> ./configure
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… ./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… /Developer/usr/bin/gcc
checking whether the C compiler works… no
configure: error: in `/Users/unicondor/Downloads/etherape-0.9.12′:
configure: error: C compiler cannot create executables
See `config.log’ for more details.

[/sourcecode]

Il problema e’ dovuto al fatto di non aver aggiornato XCode alla versione 4.1 ( ma questo non e’ bastato per la risoluzione del problema ) e di conseguenza, non aver installato l’ultima versione di GCC compatibile con il nostro nuovo SO.

Dopo aver installato XCode 4.1, ho provato a settare la variabile d’ambiente CC con il percorso dell’eseguibile gcc /Developer/usr/bin

[sourcecode language=”bash”]

unicondor@MacBook:~> export CC=/Developer/usr/bin/gcc

[/sourcecode]

Ma il tentativo e’ stato lo stesso vano. Dopo aver ricercato un po’ su google ho trovato un commento in un blog dove si consigliava di installare Direttamente GCC senza installare XCode 4.1.

 

Soluzione:

 

Scaricate GCC-10.7.pkg ed installatelo

Sito di riferimento nel caso non funzionare il link sovrastante https://github.com/kennethreitz/osx-gcc-installer

Dopo aver installo il packages dovrebbe funzionare tutto come prima, e potrete di nuovo compilare i vostri sorgenti 😉

[sourcecode language=”bash”]

unicondor@MacBook:~> gcc –version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.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.

[/sourcecode]

Una risposta a “OS X Lion: gcc/g++ Error: Command not Found”

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.