1 votos

¿Cómo volver a enlazar con el compilador de C correcto?

Al intentar instalar fink-0.38.4 me aparece el ERROR: No hay compilador de C en tu sistema. Asegúrate de que las herramientas de desarrollo están instaladas.

También me han dado errores sobre la falta de un compilador de C al intentar instalar algunas otras cosas, pero no recuerdo qué paquetes eran.

Soy diseñador y necesito instalar un paquete llamado Emokit, pero soy totalmente ajeno a todas estas cosas de código abierto que tenía que instalar. Estoy en la manera sobre mi cabeza, que es la razón por la que hice un lío gigante. Para nombrar algunas cosas que he instalado en el último par de días: MacPorts, Homebrew, Xcode, X11, FoxToolkit, hidapi (tal vez, no estoy seguro si instalé esto correctamente o no), Python, cython, y un par más y algunas bibliotecas también. Mientras hacía esto he aprendido lo que son algunas cosas. Ahora sé que MacPorts y Homebrew tienen un propósito similar y que tenerlos a ambos da problemas. Sin embargo no me atrevo a borrar uno de ellos porque creo que algunas cosas dependen de ellos.

Tengo varias versiones de GCC, pero debido a que algunas instalaciones querían una versión diferente, traté de cambiar de una versión a otra algunas veces. A veces funcionaba y a veces no. Olvidé cómo lo cambié y ahora parece que no puedo volver a cambiarlo.

Me he hecho un lío y ahora no tengo ni idea de cómo arreglarlo.

Estoy utilizando OS X 10.10.3.

echo $PATH da (en una lista para facilitar la lectura)

/usr/local/bin/gcc:
/usr/bin/cc:
/usr/local/bin:
/usr/bin/gcc:
/usr/local/bin:
/Applications/Xcode.app/Contents/Developer/usr/bin:
/Library/Frameworks/Python.framework/Versions/3.4/bin:
/Users/rick/.cabal/bin:
/Applications/ghc-7.10.1.app/Contents/bin:
/Users/rick/.cabal/bin:
/Applications/ghc-7.10.1.app/Contents/bin:
/opt/local/bin:
/opt/local/sbin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/opt/X11/bin

gcc -v da

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/lto-wrapper
Target: x86_64-apple-darwin14.0.0
Configured with: ../gcc-4.9-20141029/configure --enable-languages=c++,fortran
Thread model: posix
gcc version 4.9.2 20141029 (prerelease) (GCC) 

whereis gcc no me da nada por el momento. Esto solía ser /usr/bin/gcc

which gcc da /usr/local/bin/gcc

ls -al $(dirname $(which gcc)) | grep 'gcc\|g++\|c++' (No tengo ni idea de lo que hace esto en realidad) da:

lrwxr-xr-x    1 rick  admin       41 May  7 10:43 aot-compile-4.7 -> ../Cellar/gcc47/4.7.4/bin/aot-compile-4.7
lrwxr-xr-x    1 rick  admin       46 May  7 14:07 c++-4.2 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/c++-4.2
lrwxr-xr-x    1 rick  admin       33 May  7 10:43 c++-4.7 -> ../Cellar/gcc47/4.7.4/bin/c++-4.7
lrwxr-xr-x    1 rick  admin       33 May  7 16:11 c++-4.9 -> ../Cellar/gcc/4.9.2_1/bin/c++-4.9
lrwxr-xr-x    1 rick  admin       46 May  7 14:07 cpp-4.2 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2
lrwxr-xr-x    1 rick  admin       33 May  7 10:43 cpp-4.7 -> ../Cellar/gcc47/4.7.4/bin/cpp-4.7
lrwxr-xr-x    1 rick  admin       33 May  7 16:11 cpp-4.9 -> ../Cellar/gcc/4.9.2_1/bin/cpp-4.9
-rwxr-xr-x    1 root  wheel  1166504 Nov  3  2014 g++
lrwxr-xr-x    1 rick  admin       46 May  7 14:07 g++-4.2 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
lrwxr-xr-x    1 rick  admin       33 May  7 10:43 g++-4.7 -> ../Cellar/gcc47/4.7.4/bin/g++-4.7
lrwxr-xr-x    1 rick  admin       33 May  7 16:11 g++-4.9 -> ../Cellar/gcc/4.9.2_1/bin/g++-4.9
lrwxr-xr-x    1 rick  admin       43 May  7 10:43 gappletviewer-4.7 -> ../Cellar/gcc47/4.7.4/bin/gappletviewer-4.7
lrwxr-xr-x    1 rick  admin       36 May  1 13:46 gc++filt -> ../Cellar/binutils/2.25/bin/gc++filt
lrwxr-xr-x    1 rick  admin       40 May  7 10:43 gc-analyze-4.7 -> ../Cellar/gcc47/4.7.4/bin/gc-analyze-4.7
-rwxr-xr-x    1 root  wheel  1166328 Nov  3  2014 gcc
lrwxr-xr-x    1 rick  admin       46 May  7 14:07 gcc-4.2 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
lrwxr-xr-x    1 rick  admin       33 May  7 10:43 gcc-4.7 -> ../Cellar/gcc47/4.7.4/bin/gcc-4.7
lrwxr-xr-x    1 rick  admin       33 May  7 16:11 gcc-4.9 -> ../Cellar/gcc/4.9.2_1/bin/gcc-4.9
-rwxr-xr-x    1 root  wheel    43016 Nov  3  2014 gcc-ar
lrwxr-xr-x    1 rick  admin       36 May  7 10:43 gcc-ar-4.7 -> ../Cellar/gcc47/4.7.4/bin/gcc-ar-4.7
lrwxr-xr-x    1 rick  admin       36 May  7 16:11 gcc-ar-4.9 -> ../Cellar/gcc/4.9.2_1/bin/gcc-ar-4.9
-rwxr-xr-x    1 root  wheel    42992 Nov  3  2014 gcc-nm
lrwxr-xr-x    1 rick  admin       36 May  7 10:43 gcc-nm-4.7 -> ../Cellar/gcc47/4.7.4/bin/gcc-nm-4.7
lrwxr-xr-x    1 rick  admin       36 May  7 16:11 gcc-nm-4.9 -> ../Cellar/gcc/4.9.2_1/bin/gcc-nm-4.9
-rwxr-xr-x    1 root  wheel    43000 Nov  3  2014 gcc-ranlib
lrwxr-xr-x    1 rick  admin       40 May  7 10:43 gcc-ranlib-4.7 -> ../Cellar/gcc47/4.7.4/bin/gcc-ranlib-4.7
lrwxr-xr-x    1 rick  admin       40 May  7 16:11 gcc-ranlib-4.9 -> ../Cellar/gcc/4.9.2_1/bin/gcc-ranlib-4.9
lrwxr-xr-x    1 rick  admin       33 May  7 10:43 gcj-4.7 -> ../Cellar/gcc47/4.7.4/bin/gcj-4.7
lrwxr-xr-x    1 rick  admin       40 May  7 10:43 gcj-dbtool-4.7 -> ../Cellar/gcc47/4.7.4/bin/gcj-dbtool-4.7
lrwxr-xr-x    1 rick  admin       34 May  7 10:43 gcjh-4.7 -> ../Cellar/gcc47/4.7.4/bin/gcjh-4.7
lrwxr-xr-x    1 rick  admin       47 May  7 14:07 gcov-4.2 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/gcov-4.2
lrwxr-xr-x    1 rick  admin       34 May  7 10:43 gcov-4.7 -> ../Cellar/gcc47/4.7.4/bin/gcov-4.7
lrwxr-xr-x    1 rick  admin       34 May  7 16:11 gcov-4.9 -> ../Cellar/gcc/4.9.2_1/bin/gcov-4.9
lrwxr-xr-x    1 rick  admin       34 May  7 16:11 gfortran -> ../Cellar/gcc/4.9.2_1/bin/gfortran
lrwxr-xr-x    1 rick  admin       51 May  7 14:07 gfortran-4.2 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/gfortran-4.2
lrwxr-xr-x    1 rick  admin       38 May  7 10:43 gfortran-4.7 -> ../Cellar/gcc47/4.7.4/bin/gfortran-4.7
lrwxr-xr-x    1 rick  admin       38 May  7 16:11 gfortran-4.9 -> ../Cellar/gcc/4.9.2_1/bin/gfortran-4.9
lrwxr-xr-x    1 rick  admin       33 May  7 10:43 gij-4.7 -> ../Cellar/gcc47/4.7.4/bin/gij-4.7
lrwxr-xr-x    1 rick  admin       34 May  7 10:43 gjar-4.7 -> ../Cellar/gcc47/4.7.4/bin/gjar-4.7
lrwxr-xr-x    1 rick  admin       40 May  7 10:43 gjarsigner-4.7 -> ../Cellar/gcc47/4.7.4/bin/gjarsigner-4.7
lrwxr-xr-x    1 rick  admin       36 May  7 10:43 gjavah-4.7 -> ../Cellar/gcc47/4.7.4/bin/gjavah-4.7
lrwxr-xr-x    1 rick  admin       38 May  7 10:43 gkeytool-4.7 -> ../Cellar/gcc47/4.7.4/bin/gkeytool-4.7
lrwxr-xr-x    1 rick  admin       43 May  7 10:43 gnative2ascii-4.7 -> ../Cellar/gcc47/4.7.4/bin/gnative2ascii-4.7
lrwxr-xr-x    1 rick  admin       35 May  7 10:43 gorbd-4.7 -> ../Cellar/gcc47/4.7.4/bin/gorbd-4.7
lrwxr-xr-x    1 rick  admin       35 May  7 10:43 grmic-4.7 -> ../Cellar/gcc47/4.7.4/bin/grmic-4.7
lrwxr-xr-x    1 rick  admin       35 May  7 10:43 grmid-4.7 -> ../Cellar/gcc47/4.7.4/bin/grmid-4.7
lrwxr-xr-x    1 rick  admin       42 May  7 10:43 grmiregistry-4.7 -> ../Cellar/gcc47/4.7.4/bin/grmiregistry-4.7
lrwxr-xr-x    1 rick  admin       40 May  7 10:43 gserialver-4.7 -> ../Cellar/gcc47/4.7.4/bin/gserialver-4.7
lrwxr-xr-x    1 rick  admin       40 May  7 10:43 gtnameserv-4.7 -> ../Cellar/gcc47/4.7.4/bin/gtnameserv-4.7
lrwxr-xr-x    1 rick  admin       68 May  7 14:07 i686-apple-darwin11-cpp-4.2.1 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/i686-apple-darwin11-cpp-4.2.1
lrwxr-xr-x    1 rick  admin       68 May  7 14:07 i686-apple-darwin11-g++-4.2.1 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/i686-apple-darwin11-g++-4.2.1
lrwxr-xr-x    1 rick  admin       68 May  7 14:07 i686-apple-darwin11-gcc-4.2.1 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/i686-apple-darwin11-gcc-4.2.1
lrwxr-xr-x    1 rick  admin       73 May  7 14:07 i686-apple-darwin11-gfortran-4.2.1 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/i686-apple-darwin11-gfortran-4.2.1
lrwxr-xr-x    1 rick  admin       38 May  7 10:43 jcf-dump-4.7 -> ../Cellar/gcc47/4.7.4/bin/jcf-dump-4.7
lrwxr-xr-x    1 rick  admin       40 May  7 10:43 jv-convert-4.7 -> ../Cellar/gcc47/4.7.4/bin/jv-convert-4.7
lrwxr-xr-x    1 rick  admin       44 May  7 10:43 rebuild-gcj-db-4.7 -> ../Cellar/gcc47/4.7.4/bin/rebuild-gcj-db-4.7
lrwxr-xr-x    1 rick  admin       59 May  7 10:43 x86_64-apple-darwin14.3.0-c++-4.7 -> ../Cellar/gcc47/4.7.4/bin/x86_64-apple-darwin14.3.0-c++-4.7
lrwxr-xr-x    1 rick  admin       59 May  7 16:11 x86_64-apple-darwin14.3.0-c++-4.9 -> ../Cellar/gcc/4.9.2_1/bin/x86_64-apple-darwin14.3.0-c++-4.9
lrwxr-xr-x    1 rick  admin       59 May  7 10:43 x86_64-apple-darwin14.3.0-g++-4.7 -> ../Cellar/gcc47/4.7.4/bin/x86_64-apple-darwin14.3.0-g++-4.7
lrwxr-xr-x    1 rick  admin       59 May  7 16:11 x86_64-apple-darwin14.3.0-g++-4.9 -> ../Cellar/gcc/4.9.2_1/bin/x86_64-apple-darwin14.3.0-g++-4.9
lrwxr-xr-x    1 rick  admin       59 May  7 10:43 x86_64-apple-darwin14.3.0-gcc-4.7 -> ../Cellar/gcc47/4.7.4/bin/x86_64-apple-darwin14.3.0-gcc-4.7
lrwxr-xr-x    1 rick  admin       61 May  7 10:43 x86_64-apple-darwin14.3.0-gcc-4.7.4 -> ../Cellar/gcc47/4.7.4/bin/x86_64-apple-darwin14.3.0-gcc-4.7.4
lrwxr-xr-x    1 rick  admin       59 May  7 16:11 x86_64-apple-darwin14.3.0-gcc-4.9 -> ../Cellar/gcc/4.9.2_1/bin/x86_64-apple-darwin14.3.0-gcc-4.9
lrwxr-xr-x    1 rick  admin       61 May  7 16:11 x86_64-apple-darwin14.3.0-gcc-4.9.2 -> ../Cellar/gcc/4.9.2_1/bin/x86_64-apple-darwin14.3.0-gcc-4.9.2
lrwxr-xr-x    1 rick  admin       62 May  7 10:43 x86_64-apple-darwin14.3.0-gcc-ar-4.7 -> ../Cellar/gcc47/4.7.4/bin/x86_64-apple-darwin14.3.0-gcc-ar-4.7
lrwxr-xr-x    1 rick  admin       62 May  7 16:11 x86_64-apple-darwin14.3.0-gcc-ar-4.9 -> ../Cellar/gcc/4.9.2_1/bin/x86_64-apple-darwin14.3.0-gcc-ar-4.9
lrwxr-xr-x    1 rick  admin       62 May  7 10:43 x86_64-apple-darwin14.3.0-gcc-nm-4.7 -> ../Cellar/gcc47/4.7.4/bin/x86_64-apple-darwin14.3.0-gcc-nm-4.7
lrwxr-xr-x    1 rick  admin       62 May  7 16:11 x86_64-apple-darwin14.3.0-gcc-nm-4.9 -> ../Cellar/gcc/4.9.2_1/bin/x86_64-apple-darwin14.3.0-gcc-nm-4.9
lrwxr-xr-x    1 rick  admin       66 May  7 10:43 x86_64-apple-darwin14.3.0-gcc-ranlib-4.7 -> ../Cellar/gcc47/4.7.4/bin/x86_64-apple-darwin14.3.0-gcc-ranlib-4.7
lrwxr-xr-x    1 rick  admin       66 May  7 16:11 x86_64-apple-darwin14.3.0-gcc-ranlib-4.9 -> ../Cellar/gcc/4.9.2_1/bin/x86_64-apple-darwin14.3.0-gcc-ranlib-4.9
lrwxr-xr-x    1 rick  admin       59 May  7 10:43 x86_64-apple-darwin14.3.0-gcj-4.7 -> ../Cellar/gcc47/4.7.4/bin/x86_64-apple-darwin14.3.0-gcj-4.7
lrwxr-xr-x    1 rick  admin       64 May  7 10:43 x86_64-apple-darwin14.3.0-gfortran-4.7 -> ../Cellar/gcc47/4.7.4/bin/x86_64-apple-darwin14.3.0-gfortran-4.7
lrwxr-xr-x    1 rick  admin       64 May  7 16:11 x86_64-apple-darwin14.3.0-gfortran-4.9 -> ../Cellar/gcc/4.9.2_1/bin/x86_64-apple-darwin14.3.0-gfortran-4.9

gcc-4.2 -v da

couldn't understand kern.osversion `14.3.0'
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /Volumes/Media/Builds/gcc-5666.3/build/obj/src/configure --disable-checking --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++,fortran --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)

gcc-4.7 -v da

Using built-in specs.
COLLECT_GCC=gcc-4.7
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc47/4.7.4/libexec/gcc/x86_64-apple-darwin14.3.0/4.7.4/lto-wrapper
Target: x86_64-apple-darwin14.3.0
Configured with: ../configure --build=x86_64-apple-darwin14.3.0 --prefix=/usr/local/Cellar/gcc47/4.7.4 --enable-languages=c,c++,fortran,java,objc,obj-c++ --program-suffix=-4.7 --with-gmp=/usr/local/opt/gmp4 --with-mpfr=/usr/local/opt/mpfr2 --with-mpc=/usr/local/opt/libmpc08 --with-ppl=/usr/local/opt/ppl011 --with-cloog=/usr/local/opt/cloog-ppl015 --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --with-pkgversion='Homebrew gcc47 4.7.4 --with-all-languages --with-nls --with-profiled-build' --with-bugurl=https://github.com/Homebrew/homebrew-versions/issues --enable-plugin --with-ecj-jar=/usr/local/opt/ecj/share/java/ecj.jar --enable-multilib
Thread model: posix
gcc version 4.7.4 (Homebrew gcc47 4.7.4 --with-all-languages --with-nls --with-profiled-build) 

Este es el mensaje que el ayudante de instalación ( https://github.com/fink/scripts/blob/master/srcinstaller/Install%20Fink.tool#L2 ) me dio:

Checking package... looks good (fink-0.38.4).
Checking system... i386-apple-darwin14.3.0
This system was not released at the time this Fink release was made. 
Prerelease versions of Mac OS X might work with Fink, but there are no guarantees.
Distribution: 10.10
Architecture: x86_64
Checking cc... not found.
ERROR: There is no C compiler on your system. Make sure that the Developer Tools are installed.
logout

[Process completed]

No sé qué más información dar o si esto es demasiada información. Así que por favor pregunten si necesitan algo más. Probablemente este material contiene muchos errores y cosas defectuosas. No entiendo mucho de esto, pero en mi cabeza la única manera de poder arreglar esto ahora es hacer una instalación limpia de mi SO, lo cual no es realmente una posibilidad en este momento porque estoy en medio de la graduación. ¡Muchas gracias por su ayuda!

EDITAR está abajo

Después de borrar un montón de gcc intenté instalar fink de nuevo: mismo error. Traté de ejecutar este simple ¡Hola, mundo! script.

#include <stdio.h>

main()
{
printf(“Hello, world!\n”);
return 0;
}

Y al intentar compilar con gcc me dio lo siguiente:

Ricks-MacBook-Pro:downloads rick$ gcc -o hello hello.c
couldn't understand kern.osversion `14.3.0'
hello.c: In function ‘main’:
hello.c:5: error: stray ‘\342’ in program
hello.c:5: error: stray ‘\200’ in program
hello.c:5: error: stray ‘\234’ in program
hello.c:5: error: ‘Hello’ undeclared (first use in this function)
hello.c:5: error: (Each undeclared identifier is reported only once
hello.c:5: error: for each function it appears in.)
hello.c:5: error: ‘world’ undeclared (first use in this function)
hello.c:5: error: expected ‘)’ before ‘!’ token
hello.c:5: error: stray ‘\’ in program
hello.c:5: error: stray ‘\342’ in program
hello.c:5: error: stray ‘\200’ in program
hello.c:5: error: stray ‘\235’ in program
Ricks-MacBook-Pro:downloads rick$

0voto

Oskar Puntos 1242

Aquí está la respuesta a lo que preguntas - cómo encontrar y ordenar gcc cuando existen múltiples copias.

  1. which gcc
  2. mdls `which gcc`
  3. mdfind "kMDItemDisplayName == 'gcc'"

El primer comando te muestra el gcc que está en tu $PATH variable primero. La segunda te permite inspeccionar los metadatos de ese archivo para que puedas elegir un campo para usar con mdfind.

Ahora, simplemente desinstale / borre cualquier gcc que no quiera mantener o simplemente haga su $PATH para que el deseado gcc aparece en primer lugar. A menudo lo hago mediante la vinculación simbólica de lo que sea gcc Quiero /usr/local/bin/ y hacer que muy temprano en mi $PATH


Ahora un consejo no solicitado. Haz una buena copia de seguridad del Mac, ya que mezclar algo tan antiguo como fink en un nuevo sistema operativo es probable que sea problemático en el futuro. Tener una buena copia de seguridad te libera para borrar fink un fin de semana cuando tengas tiempo libre para aprender lo que se rompe y saber que puedes volver atrás si el cambio a sólo homebrew es prematuro.

AppleAyuda.com

AppleAyuda es una comunidad de usuarios de los productos de Apple en la que puedes resolver tus problemas y dudas.
Puedes consultar las preguntas de otros usuarios, hacer tus propias preguntas o resolver las de los demás.

Powered by:

X