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-cross-tools-gcc-static" role="wrap"> |
---|
9 | <?dbhtml filename="gcc-static.html"?> |
---|
10 | |
---|
11 | <title>Cross GCC-&gcc-version; - Static</title> |
---|
12 | |
---|
13 | <indexterm zone="ch-cross-tools-gcc-static"> |
---|
14 | <primary sortas="a-GCC">GCC</primary> |
---|
15 | <secondary>cross tools, static</secondary> |
---|
16 | </indexterm> |
---|
17 | |
---|
18 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" |
---|
19 | href="../../final-system/common/gcc.xml" |
---|
20 | xpointer="xpointer(//*[@role='package'])"/> |
---|
21 | |
---|
22 | <sect2 role="installation"> |
---|
23 | <title>Installation of Cross GCC Compiler with Static libgcc |
---|
24 | and no Threads</title> |
---|
25 | |
---|
26 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" |
---|
27 | href="../../final-system/common/gcc.xml" |
---|
28 | xpointer="xpointer(//*[@os='p1'])"/> |
---|
29 | |
---|
30 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" |
---|
31 | href="../../final-system/common/gcc.xml" |
---|
32 | xpointer="xpointer(//*[@os='p2'])"/> |
---|
33 | |
---|
34 | <para os="aa">Make a couple of essential adjustments to the specs file |
---|
35 | to ensure GCC uses our build environment:</para> |
---|
36 | |
---|
37 | <screen os="ab"><userinput>patch -Np1 -i ../&gcc-specs-patch;</userinput></screen> |
---|
38 | |
---|
39 | <para os="ac">To make sure that a couple of tools use the proper syntax, |
---|
40 | apply the following patch:</para> |
---|
41 | |
---|
42 | <screen os="ad"><userinput>patch -Np1 -i ../&gcc-posix-patch;</userinput></screen> |
---|
43 | |
---|
44 | <para os="s1">We will change the search locations from / to /tools:</para> |
---|
45 | |
---|
46 | <screen os="s2"><userinput>for file in $(find gcc/config -name linux64.h -o -name linux.h); do |
---|
47 | cp -v ${file}{,.orig} |
---|
48 | sed -e 's@/lib@/tools/lib@g' ${file}.orig > $file |
---|
49 | done"</userinput></screen> |
---|
50 | |
---|
51 | <para os="ag">Change the StartFile Spec to point to the correct library |
---|
52 | location:</para> |
---|
53 | |
---|
54 | <screen os="ah"><userinput>for file in $(find gcc/config -name linux64.h -o -name linux.h); do |
---|
55 | echo " |
---|
56 | #undef STANDARD_STARTFILE_PREFIX_1 |
---|
57 | #undef STANDARD_STARTFILE_PREFIX_2 |
---|
58 | #define STANDARD_STARTFILE_PREFIX_1 \"/tools/lib/\" |
---|
59 | #define STANDARD_STARTFILE_PREFIX_2 \"\"" >> ${file}</userinput></screen> |
---|
60 | |
---|
61 | <para os="ai">Now alter <command>gcc</command>'s c preprocessor's default |
---|
62 | include search path to use <filename class="directory">/tools</filename> only:</para> |
---|
63 | |
---|
64 | <screen os="aj"><userinput>cp -v gcc/Makefile.in{,.orig} |
---|
65 | sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \ |
---|
66 | gcc/Makefile.in.orig > gcc/Makefile.in</userinput></screen> |
---|
67 | |
---|
68 | <para os="t1">We will create a dummy limits.h so the build will not use the one |
---|
69 | provided by the host distro:</para> |
---|
70 | |
---|
71 | <screen os="t2"><userinput>touch /tools/include/limits.h</userinput></screen> |
---|
72 | |
---|
73 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" |
---|
74 | href="../../final-system/common/gcc.xml" |
---|
75 | xpointer="xpointer(//*[@os='f'])"/> |
---|
76 | |
---|
77 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" |
---|
78 | href="../../final-system/common/gcc.xml" |
---|
79 | xpointer="xpointer(//*[@os='g'])"/> |
---|
80 | |
---|
81 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" |
---|
82 | href="../../final-system/common/gcc.xml" |
---|
83 | xpointer="xpointer(//*[@os='h'])"/> |
---|
84 | |
---|
85 | <screen os="al"><userinput>AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \ |
---|
86 | ../gcc-&gcc-version;/configure --prefix=/cross-tools \ |
---|
87 | --build=${CLFS_HOST} --host=${CLFS_HOST} --target=${CLFS_TARGET} \ |
---|
88 | --disable-multilib --with-local-prefix=/tools --disable-nls \ |
---|
89 | --without-headers --with-newlib --disable-decimal-float \ |
---|
90 | --with-mpfr=/cross-tools --with-gmp=/cross-tools \ |
---|
91 | --disable-libgomp --disable-libmudflap --disable-libssp \ |
---|
92 | --disable-shared --disable-threads --enable-languages=c</userinput></screen> |
---|
93 | |
---|
94 | <variablelist os="am"> |
---|
95 | <title>The meaning of the configure options:</title> |
---|
96 | |
---|
97 | <varlistentry> |
---|
98 | <term><parameter>--with-local-prefix=/tools</parameter></term> |
---|
99 | <listitem> |
---|
100 | <para>The purpose of this switch is to remove <filename |
---|
101 | class="directory">/usr/local/include</filename> from |
---|
102 | <command>gcc</command>'s include search path. This is not |
---|
103 | absolutely essential, however, it helps to minimize the |
---|
104 | influence of the host system.</para> |
---|
105 | </listitem> |
---|
106 | </varlistentry> |
---|
107 | |
---|
108 | <varlistentry> |
---|
109 | <term><parameter>--disable-shared</parameter></term> |
---|
110 | <listitem> |
---|
111 | <para>Disables the creation of the shared libraries.</para> |
---|
112 | </listitem> |
---|
113 | </varlistentry> |
---|
114 | |
---|
115 | <varlistentry> |
---|
116 | <term><parameter>--disable-threads</parameter></term> |
---|
117 | <listitem> |
---|
118 | <para>This will prevent GCC from looking for the multi-thread |
---|
119 | include files, since they haven't been created for this architecture |
---|
120 | yet. GCC will be able to find the multi-thread information after |
---|
121 | the Glibc headers are created.</para> |
---|
122 | </listitem> |
---|
123 | </varlistentry> |
---|
124 | |
---|
125 | <varlistentry> |
---|
126 | <term><parameter>--enable-languages=c</parameter></term> |
---|
127 | <listitem> |
---|
128 | <para>This option ensures that only the C compiler is built.</para> |
---|
129 | </listitem> |
---|
130 | </varlistentry> |
---|
131 | |
---|
132 | </variablelist> |
---|
133 | |
---|
134 | <para os="an">Continue with compiling the package:</para> |
---|
135 | |
---|
136 | <screen os="ao"><userinput>make</userinput></screen> |
---|
137 | |
---|
138 | <para os="ap">Install the package:</para> |
---|
139 | |
---|
140 | <screen os="aq"><userinput>make install</userinput></screen> |
---|
141 | |
---|
142 | </sect2> |
---|
143 | |
---|
144 | <sect2 role="content"> |
---|
145 | <title/> |
---|
146 | |
---|
147 | <para>Details on this package are located in <xref |
---|
148 | linkend="contents-gcc" role="."/></para> |
---|
149 | |
---|
150 | </sect2> |
---|
151 | |
---|
152 | </sect1> |
---|