Building GCC: Difference between revisions

m
Test
[unchecked revision][unchecked revision]
m (Bot: Replace deprecated source tag with syntaxhighlight)
m (Test)
 
Line 26:
You can view your current compiler version by invoking:
 
<syntaxhighlight lang="bash">gcc --version</syntaxhighlight>
gcc --version
</syntaxhighlight>
 
If you have patience and wish to build yourself the latest and greatest cross-compiler, you'll want to bootstrap your system compiler before building your [[GCC Cross-Compiler]].
Line 33 ⟶ 35:
It certainly couldn't hurt, but if your Binutils isn't too horribly out of date, it should be good enough for your new system compiler. You can view your current Binutils version by invoking:
 
<syntaxhighlight lang="bash">ld --version</syntaxhighlight>
ld --version
</syntaxhighlight>
 
You probably need at least Binutils 2.22, or preferably the latest 2.25 release.
Line 52 ⟶ 56:
 
=== Preparation ===
<syntaxhighlight lang="bash">export PREFIX="$HOME/opt/gcc-x.y.z"</syntaxhighlight>
export PREFIX="$HOME/opt/gcc-x.y.z"
</syntaxhighlight>
 
=== Binutils ===
Line 104 ⟶ 110:
You can now run your new compiler by invoking something like:
 
<syntaxhighlight lang="bash">$HOME/opt/gcc-x.y.z/bin/gcc --version</syntaxhighlight>
$HOME/opt/gcc-x.y.z/bin/gcc --version
</syntaxhighlight>
 
To use your new compiler simply by invoking <tt>gcc</tt>, add <tt>$HOME/opt/gcc-x.y.z/bin</tt> to your <tt>$PATH</tt> by typing:
 
<syntaxhighlight lang="bash">export PATH="$HOME/opt/gcc-x.y.z/bin:$PATH"</syntaxhighlight>
export PATH="$HOME/opt/gcc-x.y.z/bin:$PATH"
</syntaxhighlight>
 
This command will add your new compiler to your PATH for this shell session. If you wish to use it permanently, add the PATH command to your <tt>~/.profile</tt> configuration shell script or similar. Consult your shell documentation for more information.