source: BOOK/cross-tools/common/gcc-static.xml@ 7cb0700

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 7cb0700 was b2297f5, checked in by Jim Gifford <clfs@…>, 16 years ago

Updates to Prefix Spec in GCC

  • Property mode set to 100644
File size: 5.1 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-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="ag">Change the StartFile Spec to point to the correct library
45 location:</para>
46
47<screen os="ah"><userinput>for file in $(find gcc/config -name linux.h -o -name linux64.h ! -wholename gcc/config/linux.h); do
48echo -e '\n#undef STARTFILE_PREFIX_SPEC\n#define STARTFILE_PREFIX_SPEC "/tools/lib/"' &gt;&gt; ${file}</userinput></screen>
49
50 <para os="ai">Now alter <command>gcc</command>'s c preprocessor's default
51 include search path to use <filename class="directory">/tools</filename> only:</para>
52
53<screen os="aj"><userinput>cp -v gcc/Makefile.in{,.orig}
54sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \
55 gcc/Makefile.in.orig &gt; gcc/Makefile.in</userinput></screen>
56
57 <para os="t1">We will create a dummy limits.h so the build will not use the one
58 provided by the host distro:</para>
59
60<screen os="t2"><userinput>touch /tools/include/limits.h</userinput></screen>
61
62 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
63 href="../../final-system/common/gcc.xml"
64 xpointer="xpointer(//*[@os='f'])"/>
65
66 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
67 href="../../final-system/common/gcc.xml"
68 xpointer="xpointer(//*[@os='g'])"/>
69
70 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
71 href="../../final-system/common/gcc.xml"
72 xpointer="xpointer(//*[@os='h'])"/>
73
74<screen os="al"><userinput>AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \
75 ../gcc-&gcc-version;/configure --prefix=/cross-tools \
76 --build=${CLFS_HOST} --host=${CLFS_HOST} --target=${CLFS_TARGET} \
77 --disable-multilib --with-local-prefix=/tools --disable-nls \
78 --without-headers --with-newlib --disable-decimal-float \
79 --with-mpfr=/cross-tools --with-gmp=/cross-tools \
80 --disable-libgomp --disable-libmudflap --disable-libssp \
81 --disable-shared --disable-threads --enable-languages=c</userinput></screen>
82
83 <variablelist os="am">
84 <title>The meaning of the configure options:</title>
85
86 <varlistentry>
87 <term><parameter>--with-local-prefix=/tools</parameter></term>
88 <listitem>
89 <para>The purpose of this switch is to remove <filename
90 class="directory">/usr/local/include</filename> from
91 <command>gcc</command>'s include search path. This is not
92 absolutely essential, however, it helps to minimize the
93 influence of the host system.</para>
94 </listitem>
95 </varlistentry>
96
97 <varlistentry>
98 <term><parameter>--disable-shared</parameter></term>
99 <listitem>
100 <para>Disables the creation of the shared libraries.</para>
101 </listitem>
102 </varlistentry>
103
104 <varlistentry>
105 <term><parameter>--disable-threads</parameter></term>
106 <listitem>
107 <para>This will prevent GCC from looking for the multi-thread
108 include files, since they haven't been created for this architecture
109 yet. GCC will be able to find the multi-thread information after
110 the Glibc headers are created.</para>
111 </listitem>
112 </varlistentry>
113
114 <varlistentry>
115 <term><parameter>--enable-languages=c</parameter></term>
116 <listitem>
117 <para>This option ensures that only the C compiler is built.</para>
118 </listitem>
119 </varlistentry>
120
121 </variablelist>
122
123 <para os="an">Continue with compiling the package:</para>
124
125<screen os="ao"><userinput>make</userinput></screen>
126
127 <para os="ap">Install the package:</para>
128
129<screen os="aq"><userinput>make install</userinput></screen>
130
131 </sect2>
132
133 <sect2 role="content">
134 <title/>
135
136 <para>Details on this package are located in <xref
137 linkend="contents-gcc" role="."/></para>
138
139 </sect2>
140
141</sect1>
Note: See TracBrowser for help on using the repository browser.