2012-07-16 17 views
18

Estoy leyendo el libro LFS (versión 7.1) y estoy bloqueado en la página 53. Tratando de compilar gcc, intenté el siguiente comando:Compilación Gcc "no se puede calcular el sufijo de los archivos objeto: no se puede compilar"

./configure --target=$LFS_TGT --prefix=$LFS/build/gcc-build --disable-nls\ 
--disable-shared --disable-multilib --disable-decimal-float --disable-threads\ 
--disable-libmudflap --disable-libssp --disable-libgomp --disable-libquadmath\ 
--disable-target-libiberty --disable-target-zlib\ 
--enable-languages=c\ 
--without-ppl --without-cloog\ 
--with-mpfr-include=$LFS/source/mpfr/src 
--with-mpfr-lib=$LFS/source/mpfr/src/.libs\ 
--with-gmp-include=/mnt/LFS/source/gmp\ 
--with-gmp-lib=/mnt/LFS/source/gmp/.libs\ 
--with-mpc-include=/mnt/LFS/source/mpc/src\ 
--with-mpc-lib=/mnt/LFS/source/mpc/src/.libs 

para ejecutar el script de configuración de gcc (por supuesto, también compilé mpfr, mpc y gmp). Pero una vez que el lanzamiento:

make -j4 

me sale el siguiente error:

checking for suffix of object files... configure: error: in `/mnt/LFS/source/gcc-4.6.2/x86_64-lfs-linux-gnu/libgcc': 
configure: error: cannot compute suffix of object files: cannot compile 
See `config.log' for more details. 
make[1]: *** [configure-target-libgcc] Error 1 

Traté de google para ello y trataron las soluciones que he encontrado, pero nada funcionó. ¿Alguien sabe por qué me sale este error?

+0

sucede cuando se intenta configurar para compilar algunos programas de prueba. [Este enlace] (http://gcc.gnu.org/wiki/FAQ#configure_suffix) podría ser útil. – ArjunShankar

+2

* Ver 'config.log 'para más detalles. * - Buen consejo, es por eso que está en el mensaje de error. – DevSolar

+0

Gracias por el enlace. Pero lo intenté todo, y no tenía ni idea de cuál podía ser el problema. Algunos foros dicen que es un error de GCC que no lee libs de mpc o mpfr. Intentaré investigar de nuevo.Gracias de todos modos –

Respuesta

13

Este problema está causado por el problema de la ruta de la biblioteca de enlace dyanmic cuando los programas de prueba intentan enlazar con libmpc/libmpfr/libgmp.

Anexar a continuación variable de entorno para permitir ld enlace en contra de la correcta archivo por lo:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/mpc/lib/ 

A continuación, intente construir gcc nuevo.

+0

¿Puedes dar un ejemplo a una ruta '/ ruta/a/mpc/lib /' o cómo la encuentro? – WebQube

+0

@WebQube ¿No puedes ejecutar 'sudo find/-iname" libmpc.so "'? Eso le permitirá conocer la ruta o ejecutar el comando 'whereis libmpc.so' o' locate libmpc.so'. – enthusiasticgeek

+0

Sin embargo, existen implicaciones: como sé que la biblioteca mpc no está instalada de manera predeterminada en los sistemas * nix y es posible que deba instalarla manualmente, la ruta real depende de lo que pase a 'configure --prefix =/xx/xx' , de forma predeterminada, configure script se instalaría en '/ user/local/lib /' – Fei

8

"* GCC construcción no es trivial, pero no es difícil si se siguen las instrucciones cuidadosamente Muchas personas se precipitan en tratar de construirlo sin leer los documentos de instalación correctamente y hacer uno o más de estos errores comunes:.

1) no ejecute ./configure de gcc src dir (esto no es compatible) => necesita ejecutar configurar desde fuera del directorio de origen gcc

2) Nota: si los enlaces del CCG dinámicamente a las bibliotecas de requisitos previos (GMP/MPFR/MPC), entonces las bibliotecas compartidas deben estar en la ruta del enlazador dinámico (LD_LIBRARY_PATH), tanto al compilar gcc como al usar el compilador instalado. * "

ejemplo simple (sin enlace dinámico a GMP/MPFR/MPC):

tar xzf gcc-4.8.0.tar.gz 
cd gcc-4.8.0 
./contrib/download_prerequisites 
cd .. 
mkdir objdir 
cd objdir 
$PWD/../gcc-4.8.0/configure --prefix=/opt/gcc-4.8.0 
make 
make install 

Fuentes: Advogato Doc - mensaje GNU Doc

+1

. Voto por construir sin enlace dinámico, realmente hace la vida más fácil. – TwilightSun

3

Este error puede surgir de una serie de razones diferentes. La mejor manera de averiguar cuál es verificar el archivo de registro '/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc/config.log' en el siguiente ejemplo. O en el caso original de carteles '/mnt/LFS/source/gcc-4.6.2/x86_64-lfs-linux-gnu/libgcc' y busque la última línea de error.

Citando Preguntas GCC: http://gcc.gnu.org/wiki/FAQ#configure_suffix

Like any of the GNU projects, GCC is using the GNU autotools to commonly configure the compilation for the specifics of the build system. The configure script thereby uses small test programs - usually called conftest.c - to test if certain functions and/or features are available. If the compilation of such a test program fails, you'll see an error message like:

checking for suffix of object files... configure: error: in 
`/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc': configure: error: 
cannot compute suffix of object files: cannot compile See `config.log' 
for more details. make[2]: *** [configure-stage1-target-libgcc] Error 
1 make[2]: Leaving directory `/home/manu/gcc/gcc' 

This error message is quite misleading and frequently the problem has nothing to do with the message. You have to check the file 'config.log' in the directory where the error occurred. In the example above, you would have to check the 'config.log' file in the directory '/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc'. There might be several test programs that failed during the configuration, but some of these failures are non-critical. Check for the last error entry in the file.

Common causes for this error message are:

  • Required libraries for the GCC build are missing, specifically MPFR, GMP and MPC. If installed as shared libraries they must be in the runtime linker's search path so they can be found. Please, follow the instructions in the answer to Why does my ./configure and make fail?

  • The compiler crashed. For example, if there is an error such as 'conftest.c: internal compiler error:', this indicates a bug in the compiler. If you are using an unmodified version of GCC, please follow the procedure to report the bug.

Cuestiones relacionadas