source: chapter05/binutils-pass1.xml@ 9c9d585

Last change on this file since 9c9d585 was 1375d26, checked in by Matthew Burgess <matthew@…>, 20 years ago
  • (chapter05/*.xml) RELAX NG validation fixes

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/LFS-RNG/BOOK@4385 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 5.7 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE section [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
6<section xmlns="http://docbook.org/docbook-ng"
7 xmlns:xi="http://www.w3.org/2003/XInclude"
8 xml:id="ch-tools-binutils-pass1" role="wrap">
9<info><title>Binutils-&binutils-version; - Pass 1</title></info>
10<?dbhtml filename="binutils-pass1.html"?>
11
12<indexterm zone="ch-tools-binutils-pass1">
13<primary sortas="a-Binutils">Binutils</primary>
14<secondary>tools, pass 1</secondary></indexterm>
15
16<section role="package"><title/>
17<xi:include href="../chapter06/binutils.xml" xpointer="xpointer(/*[1]/*[3]/*[2])"/>
18
19<segmentedlist>
20<segtitle>&buildtime;</segtitle>
21<segtitle>&diskspace;</segtitle>
22<seglistitem><seg>1.0 SBU</seg><seg>194 MB</seg></seglistitem>
23</segmentedlist>
24
25<xi:include href="../chapter06/binutils.xml" xpointer="xpointer(/*[1]/*[3]/*[4])"/>
26
27</section>
28
29<section role="installation">
30<info><title>Installation of Binutils</title></info>
31
32<para>It is important that Binutils be the first package to get compiled,
33because both Glibc and GCC perform various tests on the available linker and
34assembler to determine which of their own features to enable.</para>
35
36<para>This package is known to behave badly when you change its default
37optimization flags (including the <parameter>-march</parameter> and
38<parameter>-mcpu</parameter> options). Therefore, if you have defined any
39environment variables that override default optimizations, such as CFLAGS and
40CXXFLAGS, we recommend un-setting them when building Binutils.</para>
41
42<para>The Binutils documentation recommends building Binutils outside of the
43source directory in a dedicated build directory:</para>
44
45<screen><userinput>mkdir ../binutils-build
46cd ../binutils-build</userinput></screen>
47
48<note><para>If you want the SBU values listed in the rest of the book to be of
49any use, you will have to measure the time it takes to build this package --
50from the configuration up to and including the first install. To achieve this
51easily, you could wrap the four commands in a <command>time</command> command
52like this: <userinput>time { ./configure ... &amp;&amp; ... &amp;&amp; ...
53&amp;&amp; make install; }</userinput>.</para></note>
54
55<para>Now prepare Binutils for compilation:</para>
56
57<screen><userinput>../binutils-&binutils-version;/configure --prefix=/tools --disable-nls</userinput></screen>
58
59<para>The meaning of the configure options:</para>
60
61<variablelist>
62<varlistentry>
63<term><parameter>--prefix=/tools</parameter></term>
64<listitem><para>This tells the configure script to prepare to install the Binutils
65programs in the <filename class="directory">/tools</filename> directory.</para></listitem>
66</varlistentry>
67
68<varlistentry>
69<term><parameter>--disable-nls</parameter></term>
70<listitem><para>This disables internationalization (a word often shortened to
71i18n). We don't need this for our static programs and <emphasis>nls</emphasis>
72often causes problems when linking statically.</para></listitem>
73</varlistentry>
74</variablelist>
75
76<para>Continue with compiling the package:</para>
77
78<screen><userinput>make configure-host
79make LDFLAGS="-all-static"</userinput></screen>
80
81<para>The meaning of the make parameters:</para>
82
83<variablelist>
84<varlistentry>
85<term><parameter>configure-host</parameter></term>
86<listitem><para>This forces all the subdirectories to be configured immediately.
87A statically linked build will fail without it. We therefore use this option to work
88around the problem.</para></listitem>
89</varlistentry>
90
91<varlistentry>
92<term><parameter>LDFLAGS="-all-static"</parameter></term>
93<listitem><para>This tells the linker that all the Binutils programs should be
94linked statically. However, strictly speaking, <parameter>"-all-static"</parameter>
95is passed to the <command>libtool</command> program, which then passes
96<parameter>"-static"</parameter> to the linker.</para></listitem>
97</varlistentry>
98</variablelist>
99
100<para>Compilation is complete. Normally we would now run the test suite, but
101at this early stage the test suite framework (Tcl, Expect and DejaGNU) is not
102yet in place. And there would be little point in running the tests anyhow,
103since the programs from this first pass will soon be replaced by those from the
104second.</para>
105
106<para>Now install the package:</para>
107
108<screen><userinput>make install</userinput></screen>
109
110<para>Now prepare the linker for the <quote>Adjusting</quote> phase later on:</para>
111
112<screen><userinput>make -C ld clean
113make -C ld LDFLAGS="-all-static" LIB_PATH=/tools/lib</userinput></screen>
114
115<para>The meaning of the make parameters:</para>
116
117<variablelist>
118<varlistentry>
119<term><parameter>-C ld clean</parameter></term>
120<listitem><para>This tells the make program to remove all the compiled files
121in the <filename class="directory">ld</filename> subdirectory.</para></listitem>
122</varlistentry>
123
124<varlistentry>
125<term><parameter>-C ld LDFLAGS="-all-static"
126LIB_PATH=/tools/lib</parameter></term>
127<listitem><para>This option rebuilds everything in the
128<filename class="directory">ld</filename> subdirectory. Specifying the LIB_PATH
129makefile variable on the command line allows us to override the default value
130and have it point to our temporary tools location. The value of this variable
131specifies the linker's default library search path. You will see how this
132preparation is used later on in the chapter.</para></listitem>
133</varlistentry>
134</variablelist>
135
136
137<warning><para><emphasis>Do not yet remove</emphasis> the Binutils build and
138source directories. You will need them again in their current state a bit
139further on in this chapter.</para></warning>
140
141
142</section>
143
144<section role="content"><info><title/></info>
145<para>The details on this package are found in <xref linkend="contents-binutils"/>.</para>
146</section>
147
148</section>
Note: See TracBrowser for help on using the repository browser.