source: chapter06/gcc-pass2.xml@ 460f575

arm
Last change on this file since 460f575 was 460f575, checked in by William Harrington <kb0iic@…>, 2 years ago

Initial LFS-ARM book.

  • Property mode set to 100644
File size: 5.4 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-tools-gcc-pass2" role="wrap" xreflabel="gcc-pass2">
9 <?dbhtml filename="gcc-pass2.html"?>
10
11 <sect1info condition="script">
12 <productname>gcc-pass2</productname>
13 <productnumber>&gcc-version;</productnumber>
14 <address>&gcc-url;</address>
15 </sect1info>
16
17 <title>GCC-&gcc-version; - Pass 2</title>
18
19 <indexterm zone="ch-tools-gcc-pass2">
20 <primary sortas="a-GCC">GCC</primary>
21 <secondary>tools, pass 2</secondary>
22 </indexterm>
23
24 <sect2 role="package">
25 <title/>
26
27 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
28 href="../chapter08/gcc.xml"
29 xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
30
31 <segmentedlist>
32 <segtitle>&buildtime;</segtitle>
33 <segtitle>&diskspace;</segtitle>
34
35 <seglistitem>
36 <seg>&gcc-tmpp2-sbu;</seg>
37 <seg>&gcc-tmpp2-du;</seg>
38 </seglistitem>
39 </segmentedlist>
40
41 </sect2>
42
43 <sect2 role="installation">
44 <title>Installation of GCC</title>
45
46 <para>As in the first build of GCC, the GMP, ISL, MPFR, and MPC packages are
47 required. Unpack the tarballs and move them into the required directory
48 names:</para>
49
50<screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
51mv -v mpfr-&mpfr-version; mpfr
52tar -xf ../gmp-&gmp-version;.tar.xz
53mv -v gmp-&gmp-version; gmp
54tar -xf ../mpc-&mpc-version;.tar.gz
55mv -v mpc-&mpc-version; mpc
56tar -xf ../isl-&isl-version;.tar.xz
57mv -v isl-&isl-version; isl</userinput></screen>
58
59
60 <para>If building on aarch64, change the default directory name for 64-bit
61 libraries to <quote>lib</quote>:</para>
62
63<screen><userinput remap="pre">case $(uname -m) in
64 aarch64)
65 sed -e '/mabi.lp64=/s/lib64/lib/' \
66 -i.orig gcc/config/aarch64/t-aarch64-linux
67 ;;
68esac</userinput></screen>
69
70 <para>Create a separate build directory again:</para>
71
72<screen><userinput remap="pre">mkdir -v build
73cd build</userinput></screen>
74
75 <para>Create a symlink that allows libgcc to be built with posix threads
76 support:</para>
77
78<screen><userinput remap="pre">mkdir -pv $LFS_TGT/libgcc
79ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h</userinput></screen>
80
81 <para>Before starting to build GCC, remember to unset any environment
82 variables that override the default optimization flags.</para>
83
84 <para>Now prepare GCC for compilation:</para>
85
86<screen><userinput remap="configure">../configure \
87 --build=$(../config.guess) \
88 --host=$LFS_TGT \
89 --prefix=/usr \
90 CC_FOR_TARGET=$LFS_TGT-gcc \
91 --with-build-sysroot=$LFS \
92 --enable-initfini-array \
93 --disable-nls \
94 --disable-multilib \
95 --disable-decimal-float \
96 --disable-libatomic \
97 --disable-libgomp \
98 --disable-libquadmath \
99 --disable-libssp \
100 --disable-libvtv \
101 --disable-libstdcxx \
102 --enable-languages=c,c++</userinput></screen>
103
104 <variablelist>
105 <title>The meaning of the new configure options:</title><!-- WIP -->
106
107 <varlistentry>
108 <term><parameter>-with-build-sysroot=$LFS</parameter></term>
109 <listitem>
110 <para>Normally, using <parameter>--host</parameter> ensures that
111 a cross-compiler is used for building GCC, and that compiler knows
112 that it has to look for headers and libraries in <filename
113 class="directory">$LFS</filename>. But the build system of GCC uses
114 other tools, which are not aware of this location. This switch is
115 needed to have them find the needed files in <filename
116 class="directory">$LFS</filename>, and not on the host.</para>
117 </listitem>
118 </varlistentry>
119
120 <varlistentry>
121 <term><parameter>--enable-initfini-array</parameter></term>
122 <listitem>
123 <para>This option is automatically enabled when building a native
124 compiler with a native compiler on ARM. But here, we build with
125 a cross compiler, so we need to explicitly set this option.</para>
126 </listitem>
127 </varlistentry>
128
129 </variablelist>
130
131 <para>Compile the package:</para>
132
133<screen><userinput remap="make">make</userinput></screen>
134
135 <para>Install the package:</para>
136
137<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
138
139 <para>As a finishing touch, create a utility symlink. Many programs and scripts
140 run <command>cc</command> instead of <command>gcc</command>, which is
141 used to keep programs generic and therefore usable on all kinds of UNIX
142 systems where the GNU C compiler is not always installed. Running
143 <command>cc</command> leaves the system administrator free to decide
144 which C compiler to install:</para>
145
146<screen><userinput remap="install">ln -sv gcc $LFS/usr/bin/cc</userinput></screen>
147
148 </sect2>
149
150 <sect2 role="content">
151 <title/>
152
153 <para>Details on this package are located in
154 <xref linkend="contents-gcc" role="."/></para>
155
156 </sect2>
157
158</sect1>
Note: See TracBrowser for help on using the repository browser.