Realizar downgrade del compilador gcc



   AUTOR PREGUNTA

Publicado 10 abril 2014 - 06:37

Hola. Tengo que instalar un software, y este requiere de paquetes que se compilan con una versión específica del compilador gcc/g++ (yo tengo la 4.8 y ocupo la 4.1). Uso Fedora 19. Si trato de buscar el paquete gcc-4-1 o cualquier otro por medio del gestor yum, no aparece. Linux me mantiene los paquetes actualizados.
Por ahí lei que es posible realizar un downgrade al paquete por medio de yum, pero que no es aconsejable. En fin, quisiera saber si es posible realizar el downgrade. He intentado instalar desde el código fuente otra versión pero me salen unos errores y no he podido lograrlo tampoco. Por eso quiero saber lo del downgrade.

Gracias por el tiempo!


¿Tienes la misma pregunta? Yo también

 

Publicado 10 abril 2014 - 11:36

Hola Jose,

No es una gran recomendación realizar downgrade del gcc porque algunos componentes del SO dependen de él, aunque por poder es posible. Si lo quieres realizar, a ver si te puede ayudar alguno, que yo en esto tampoco ando con mucha experiencia.

 

Publicado 10 abril 2014 - 12:46

Lo que quieres hacer depende de qué versión de GCC se instaló. Como dice Hector ser posible degradar el compilador puede, pero no sin problemillas que te puedan surgir de otras áreas ya que existen dependencias en el compilador de C que haya instalado. Lo raro es que no te deje instalar...

Con instalar la 4.1 y también incluir sus bibliotecas, en un entorno separado siendo diferente el nombre para que no se solapen, sino tener las dos instaladas ya que sería más recomendable no modificar el gcc existente. Y así apuntas lo que necesite 4.1 a ese.

 

Publicado 10 abril 2014 - 12:58

Mira lo que dicen los 2 compañeros es muy buena opción, para que puedas instalar varios GCC te dejo este manual

[size=5]How to install multiple versions of GCC[/size]

It may be desirable to install multiple versions of the compiler on the same system. This can be done by using different prefix paths at configure time and a few symlinks.

Basically, configure the two compilers with different --prefix options, then build and install each compiler. Assume you want "gcc" to be the latest compiler and available in /usr/local/bin; also assume that you want "gcc2" to be the older gcc2 compiler and also available in /usr/local/bin.

The easiest way to do this is to configure the new GCC with --prefix=/usr/local/gcc and the older gcc2 with --prefix=/usr/local/gcc2. Build and install both compilers. Then make a symlink from /usr/local/bin/gcc to /usr/local/gcc/bin/gcc and from /usr/local/bin/gcc2 to /usr/local/gcc2/bin/gcc. Create similar links for the "g++", "c++" and "g77" compiler drivers.

An alternative to using symlinks is to configure with a --program-transform-name option. This option specifies a sed command to process installed program names with. Using it you can, for instance, have all the new GCC programs installed as "new-gcc" and the like. You will still have to specify different --prefix options for new GCC and old GCC, because it is only the executable program names that are transformed. The difference is that you (as administrator) do not have to set up symlinks, but must specify additional directories in your (as a user) PATH. A complication with --program-transform-name is that the sed command invariably contains characters significant to the shell, and these have to be escaped correctly, also it is not possible to use "^" or "$" in the command. Here is the option to prefix "new-" to the new GCC installed programs:

--program-transform-name='s,\\\\(.*\\\\),new-\\\\1,'


With the above --prefix option, that will install the new GCC programs into /usr/local/gcc/bin with names prefixed by "new-". You can use --program-transform-name if you have multiple versions of GCC, and wish to be sure about which version you are invoking.
If you use --prefix, GCC may have difficulty locating a GNU assembler or linker on your system, GCC can not find GNU as/GNU ld explains how to deal with this.

Another option that may be easier is to use the --program-prefix= or --program-suffix= options to configure. So if you're installing GCC 2.95.2 and don't want to disturb the current version of GCC in /usr/local/bin/, you could do

configure --program-suffix=-2.95.2 <other configure options>


This should result in GCC being installed as /usr/local/bin/gcc-2.95.2 instead of /usr/local/bin/gcc.


Más info:

Por favor Identificate o Registrate para poder ver este contenido