/[gentoo]/xml/htdocs/doc/en/gcc-upgrading.xml
Gentoo

Diff of /xml/htdocs/doc/en/gcc-upgrading.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.5 Revision 1.6
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version='1.0' encoding="UTF-8"?>
2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/gcc-upgrading.xml,v 1.5 2006/01/30 15:32:52 jkt Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/gcc-upgrading.xml,v 1.6 2006/02/02 15:59:29 neysx Exp $ -->
3 3
4<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 4<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
5 5
6<guide link="/doc/en/gcc-upgrading.xml"> 6<guide link="/doc/en/gcc-upgrading.xml">
7<title>Gentoo Linux GCC Upgrade Guide</title> 7<title>Gentoo Linux GCC Upgrade Guide</title>
14</author> 14</author>
15<author title="Editor"> 15<author title="Editor">
16 <mail link="halcy0n@gentoo.org">Mark Loeser</mail> 16 <mail link="halcy0n@gentoo.org">Mark Loeser</mail>
17</author> 17</author>
18 18
19
20<abstract> 19<abstract>
21This document will guide the user through the process of upgrading GCC on their 20This document will guide the user through the process of upgrading GCC on their
22Gentoo Linux machines. 21Gentoo Linux machines.
23</abstract> 22</abstract>
24 23
25<!-- The content of this document is licensed under the CC-BY-SA license --> 24<!-- The content of this document is licensed under the CC-BY-SA license -->
26<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> 25<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
27<license/> 26<license/>
28 27
29<version>4</version> 28<version>5</version>
30<date>2006-01-30</date> 29<date>2006-02-02</date>
31 30
32<chapter id="intro"> 31<chapter id="intro">
33<title>Introduction</title> 32<title>Introduction</title>
34<section> 33<section>
35<title>GCC Upgrading</title> 34<title>GCC Upgrading</title>
52change your mind, or remove the old compiler from the system. 51change your mind, or remove the old compiler from the system.
53</p> 52</p>
54 53
55<p> 54<p>
56This guide will document the necessary steps required to perform a seamless 55This guide will document the necessary steps required to perform a seamless
57upgrade of the compiler used by your Gentoo box. A specific section is dedicated 56upgrade of the compiler used by your Gentoo box. A specific section is
58to the <uri link="#upgrade-3.3-to-3.4">upgrade from GCC 3.3 to the 3.4 57dedicated to the <uri link="#upgrade-3.3-to-3.4">upgrade from GCC 3.3 to 3.4 or
59version</uri> and issues with <c>libstdc++</c>. 58greater versions</uri> and issues with <c>libstdc++</c>. A second specific
59section is for users <uri link="#first-install">first installing</uri> Gentoo
60using a stage3 tarball, after a new GCC major/minor version has been released.
60</p> 61</p>
62
63<note>
64It should be noted that upgrading from GCC-3.4 to GCC-4.0 or greater requires
65no real changes to be made by the user, as GCC-3.4 and GCC-4.0 use the same
66ABI. All that is required is that <c>gcc-config</c> is used to select the
67compiler desired.
68</note>
61 69
62</body> 70</body>
63</section> 71</section>
64</chapter> 72</chapter>
65 73
68<section> 76<section>
69<title>Introduction</title> 77<title>Introduction</title>
70<body> 78<body>
71 79
72<impo> 80<impo>
73If you're looking for instructions specific to upgrades from GCC-3.3 to 81If you're looking for instructions specific to upgrades from GCC-3.3 to GCC-3.4
74GCC-3.4, please consult the <uri link="#upgrade-3.3-to-3.4">dedicated 82or greater, please consult the <uri link="#upgrade-3.3-to-3.4">dedicated
83section</uri>.
84</impo>
85
86<impo>
87If you're looking for instructions specific to upgrades in GCC for new
88installs, please consult the <uri link="#first-install">dedicated
75section</uri>. 89section</uri>.
76</impo> 90</impo>
77 91
78<p> 92<p>
79Generally speaking, upgrades to <e>bug fix releases</e>, like from 3.3.5 to 93Generally speaking, upgrades to <e>bug fix releases</e>, like from 3.3.5 to
112# <i>emerge -eav system</i> 126# <i>emerge -eav system</i>
113# <i>emerge -eav world</i> 127# <i>emerge -eav world</i>
114</pre> 128</pre>
115 129
116<p> 130<p>
117It is safe to remove older GCC version at this time. If you feel the 131It is safe to remove the older GCC version at this time. If you feel the need,
118need, please issue the following command (as usual, substitute 132please issue the following command (as usual, substitute
119<c>=sys-devel/gcc-3.3*</c> with the version you want to uninstall): 133<c>=sys-devel/gcc-3.3*</c> with the version you want to uninstall):
120</p> 134</p>
121 135
122<pre caption="Removing older GCC version"> 136<pre caption="Removing older GCC version">
123# <i>emerge -aC =sys-devel/gcc-3.3*</i> 137# <i>emerge -aC =sys-devel/gcc-3.3*</i>
126</body> 140</body>
127</section> 141</section>
128</chapter> 142</chapter>
129 143
130<chapter id="upgrade-3.3-to-3.4"> 144<chapter id="upgrade-3.3-to-3.4">
131<title>Upgrading from GCC-3.3 to 3.4</title> 145<title>Upgrading from GCC-3.3 to 3.4 or greater</title>
132<section> 146<section>
133<title>Introduction</title> 147<title>Introduction</title>
134<body> 148<body>
135 149
136<p> 150<p>
137The upgrade from GCC/3.3 to 3.4 is not so seamless as the C++ ABI changed 151The upgrade from GCC-3.3 to 3.4 or greater is not seamless as the C++ ABI
138between these two versions so there is an issue with <c>libstdc++</c> library 152changed between these two versions. There is an issue with the <c>libstdc++</c>
139which must be taken care of as well. 153library which must be taken care of, as well.
140</p> 154</p>
141 155
142</body> 156</body>
143</section> 157</section>
144<section id="upgrade-3.3-to-3.4-choices"> 158<section id="upgrade-3.3-to-3.4-choices">
151some internal <uri link="http://gcc.gnu.org/gcc-3.4/sparc-abi.html">ABI 165some internal <uri link="http://gcc.gnu.org/gcc-3.4/sparc-abi.html">ABI
152changes</uri> in GCC's parameter passing. 166changes</uri> in GCC's parameter passing.
153</impo> 167</impo>
154 168
155<p> 169<p>
156You have two possibilities on how to upgrade your system. <uri 170You have two possibilities on how to upgrade your system. The <uri
157link="#upgrade-3.3-to-3.4-revdep-rebuild">First method</uri> is faster and 171link="#upgrade-3.3-to-3.4-revdep-rebuild">first method</uri> is faster and
158requires use of <c>revdep-rebuild</c> tool from package <c>gentoolkit</c> while 172requires use of the <c>revdep-rebuild</c> tool from package <c>gentoolkit</c>
159the <uri link="#upgrade-3.3-to-3.4-emerge-e">second one</uri> rebuilds the 173while the <uri link="#upgrade-3.3-to-3.4-emerge-e">second one</uri> rebuilds the
160entire system from scratch so it will make use of new GCC features. It's up to 174entire system from scratch so it will make use of new GCC features. It's up to
161you to decide which of these two ways you will choose. 175you to decide which of these two ways you will choose. In most cases, the first
176method is sufficient.
162</p> 177</p>
163 178
164</body> 179</body>
165</section> 180</section>
166<section id="upgrade-3.3-to-3.4-revdep-rebuild"> 181<section id="upgrade-3.3-to-3.4-revdep-rebuild">
318<c>gcc-config</c> again, followed by <c>source /etc/profile</c>. Only do this if 333<c>gcc-config</c> again, followed by <c>source /etc/profile</c>. Only do this if
319you do not have any cross-compilers set up, though. 334you do not have any cross-compilers set up, though.
320</p> 335</p>
321 336
322<p> 337<p>
323If a package fails during <c>emerge -e system/world</c>, you can resume 338If a package fails during <c>emerge -e system</c> or <c>emerge -e world</c>,
324operation with <c>emerge --resume</c>. If a package fails repeatedly, skip it 339you can resume operation with <c>emerge --resume</c>. If a package fails
325with <c>emerge --resume --skipfirst</c>. Don't run any other instances of emerge 340repeatedly, skip it with <c>emerge --resume --skipfirst</c>. Don't run any
326in between or you will lose the resume information. 341other instances of emerge in between or you will lose the resume information.
327</p> 342</p>
328 343
329<p> 344<p>
330If you get an error message <e>spec failure: unrecognized spec option</e> while 345If you get an error message <e>spec failure: unrecognized spec option</e> while
331upgrading your compiler, try to switch back to your default compiler, unset the 346upgrading your compiler, try to switch back to your default compiler, unset the
339# <i>emerge -uav gcc</i> 354# <i>emerge -uav gcc</i>
340</pre> 355</pre>
341 356
342</body> 357</body>
343</section> 358</section>
359</chapter>
344 360
361<chapter id="first-install">
362<title>Upgrading to GCC on a First Install</title>
363<section>
364<title>Introduction</title>
365<body>
366
367<p>
368A GCC upgrade on a system after installation from a stage3 tarball is a simple
369affair. One advantage users of new installations have is they do not have a
370plethora of software installed that links against the older version of GCC.
371The following example is for a GCC-3.3 to 3.4 or greater upgrade. Certain parts
372will be different if upgrading from other versions of GCC. For example, the
373library names used for <c>revdep-rebuild</c> below are GCC 3.3 specific, as
374well as the need to install <c>libstdc++-v3</c>.
375</p>
376
377<p>
378If a user has not made any customizations to their system yet, then there are
379very few steps to get their system upgraded to a new GCC version. As with the
380GCC-3.3 to 3.4 upgrade, the user has a couple options. However, unlike the
381GCC-3.3 to 3.4 upgrade, this one is less complicated as there are fewer
382differences between the methods. The <uri
383link="#first-install-revdep-rebuild">first method</uri> is faster and makes use
384of the <c>revdep-rebuild</c> tool from <c>gentoolkit</c>, similar to the above
385procedure. Using revdep-rebuild causes only packages which actually link
386against GCC libraries to be rebuilt, while the <uri
387link="#first-install-emerge-e">second method</uri> causes your entire new
388install to be recompiled with the new GCC version and takes much longer. This
389second method is never required and only documented for completeness.
390</p>
391
392<p>
393These first steps are common between both methods, and should be completed by
394everyone.
395</p>
396
397<pre caption="Upgrading GCC">
398# <i>emerge -uav gcc</i>
399# <i>gcc-config i686-pc-linux-gnu-3.4.4</i>
400# <i>source /etc/profile</i>
401
402<comment>(Rebuilding libtool)</comment>
403# <i>emerge --oneshot -av libtool</i>
404</pre>
405
406<note>
407This assumes that you have <c>CHOST="i686-pc-linux-gnu"</c> set. If you are
408using another CHOST, please use the appropriate gcc-config line.
409</note>
410
411<p>
412To provide compatibility with older binary C++ applications,
413<c>sys-libs/libstdc++-v3</c> needs to be merged onto your system.
414</p>
415
416<pre caption="Installing libstdc++-v3">
417# <i>emerge --oneshot sys-libs/libstdc++-v3</i>
418</pre>
419
420</body>
421</section>
422
423<section id="first-install-revdep-rebuild">
424<title>Using revdep-rebuild</title>
425<body>
426
427<p>
428This method requires that you first install <c>gentoolkit</c> if you have not
429already done so. We will then run <c>revdep-rebuild</c> to actually scan the
430installed packages for ones we need to rebuild, then rebuild them.
431</p>
432
433<pre caption="Installing gentoolkit and running revdep-rebuild">
434# <i>emerge -an gentoolkit</i>
435# <i>revdep-rebuild --library libstdc++.so.5 -- -p -v</i>
436# <i>revdep-rebuild --library libstdc++.so.5</i>
437</pre>
438
439<note>
440It is possible that you might have problems with non-existing package versions
441due to them being outdated or masked. If this is the case, you will want to use
442the <c>--package-names</c> option to <c>revdep-rebuild</c>. This causes packages
443to be recompiled based on the package name, rather than the exact name and
444version.
445</note>
446
447</body>
448</section>
449<section id="first-install-emerge-e">
450<title>Using emerge -e</title>
451<body>
452
453<p>
454This method, while much slower, will rebuild the system target to ensure that
455everything has been rebuilt with your new compiler. This is not necessary, but
456is valid if you are also making changes to CFLAGS or other make.conf variables
457that will affect the system compile.
458</p>
459
460<pre caption="Upgrading GCC">
461# <i>emerge -uav gcc</i>
462# <i>gcc-config i686-pc-linux-gnu-3.4.4</i>
463# <i>source /etc/profile</i>
464
465<comment>(Rebuilding libtool)</comment>
466# <i>emerge --oneshot -av libtool</i>
467</pre>
468
469<note>
470This assumes that you have <c>CHOST="i686-pc-linux-gnu"</c> set. If you are
471using another CHOST, please use the appropriate gcc-config line.
472</note>
473
474<p>
475To provide compatibility with older binary C++ applications,
476<c>sys-libs/libstdc++-v3</c> needs to be merged onto your system.
477</p>
478
479<pre caption="Installing libstdc++-v3">
480# <i>emerge --oneshot sys-libs/libstdc++-v3</i>
481</pre>
482
483<p>
484Since we are performing these actions after an initial installation, we do not
485need to recompile the world target as we would when doing an upgrade on an
486already installed system. However, you may choose to perform a world update in
487place of the system update, to ensure that all packages are updated.
488</p>
489
490<pre caption="Rebuilding system">
491# <i>emerge -e system</i>
492</pre>
493
494<p>
495It is also safe to remove older GCC versions at this time. Since this is an
496initial installation, we are using portage's prune feature to remove all older
497versions of GCC.
498</p>
499
500<pre caption="Cleaning up">
501# <i>emerge -aP sys-devel/gcc</i>
502</pre>
503
504</body>
505</section>
345</chapter> 506</chapter>
346</guide> 507</guide>

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.20