aboutsummaryrefslogtreecommitdiffstats
path: root/chapter06/glibc-32.xml
blob: 56e2e1314ebcd4c64af337eed9e3a854be7cfaaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../general.ent">
  %general-entities;
]>

<sect1 arch="ml_32,ml_x32,ml_all" id="ch-system-glibc-32" role="wrap">
  <?dbhtml filename="glibc-32.html"?>

  <sect1info condition="script">
    <productname>glibc-32</productname>
    <productnumber>&glibc-version;</productnumber>
    <address>&glibc-url;</address>
  </sect1info>

  <title>Glibc-&glibc-version; - 32-bit</title>

  <indexterm zone="ch-system-glibc-32">
    <primary sortas="a-Glibc-32">Glibc-32</primary>
  </indexterm>

  <sect2 role="installation">
    <title>Preparation to install of ML-Glibc</title>

<screen><userinput remap="pre">patch -Np1 -i ../&glibc-fhs-patch;</userinput></screen>

    <para>Remove a file that may be left over from a previous build attempt:</para>

<screen><userinput remap="pre">mv /usr/include/limits.h{,.backup} </userinput></screen>

  </sect2>

  <!-- ~~~~~~~~~~~~~~~~~~~~ ABI 32 ~~~~~~~~~~~~~~~~~~~~ -->
  
  <sect2 arch="ml_32,ml_all" role="installation">
    <title>Installation of Glibc - 32-bit</title>

    <para>The Glibc documentation recommends building Glibc 
    in a dedicated build directory:</para>

<screen><userinput remap="pre">mkdir -v build
cd       build</userinput></screen>

    <para>Prepare Glibc for compilation:</para>

<screen><userinput remap="configure">CC="gcc -m32 -ffile-prefix-map=/tools=/usr" \
CXX="g++ -m32 -ffile-prefix-map=/tools=/usr" \
../configure --prefix=/usr                          \
             --disable-werror                       \
             --enable-kernel=&min-kernel;                    \
             --enable-stack-protector=strong        \
             --enable-multi-arch                    \
             --libdir=/usr/lib32                    \
             --libexecdir=/usr/lib32                \
             --with-headers=/usr/include            \
             libc_cv_slibdir=/usr/lib32             \
             i686-pc-linux-gnu</userinput></screen>

    <para>Compile the package:</para>

<screen><userinput remap="make">make</userinput></screen>

    <para>Install the package:</para>

<screen><userinput remap="install">sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile
make install_root=$PWD/DESTDIR install
mv -v DESTDIR/usr/lib32/* /usr/lib32/
install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \
               /usr/include/gnu/
ln -svf ../usr/lib32/ld-linux.so.2 /lib/ld-linux.so.2
ln -svf ../usr/lib32/ld-linux.so.2 /lib/ld-lsb.so.3
ln -svf ../lib/locale /usr/lib32/locale</userinput></screen>

    <para>Configure the linker cache configuration:</para>

<screen><userinput>echo "/usr/lib32" > /etc/ld.so.conf.d/lib32.conf
ldconfig</userinput></screen>

    <para>Do cleanup:</para>

<screen><userinput>cd ..
rm -rf build</userinput></screen>

  </sect2>

  <!-- ~~~~~~~~~~~~~~~~~~~~ ABI x32 ~~~~~~~~~~~~~~~~~~~~ -->

<!--
In case the compilation ends with

...
if test -r /autolfs/sources/glibc-2.29/build/DESTDIR/usr/include/gnu/stubs-x32.h && cmp -s /autolfs/sources/glibc-2.29/build/stubs.h /autolfs/sources/glibc-2.29/build/DESTDIR/usr/include/gnu/stubs-x32.h; \
then echo 'stubs.h unchanged'; \
else /usr/bin/install -c -m 644 /autolfs/sources/glibc-2.29/build/stubs.h /autolfs/sources/glibc-2.29/build/DESTDIR/usr/include/gnu/stubs-x32.h; fi
rm -f /autolfs/sources/glibc-2.29/build/stubs.h
/autolfs/sources/glibc-2.29/build/elf/sln /autolfs/sources/glibc-2.29/build/elf/symlink.list
/autolfs/sources/glibc-2.29/build/elf/sln: /autolfs/sources/glibc-2.29/build/elf/sln: cannot execute binary file
make[1]: *** [Makefile:106: install-symbolic-link] Error 126
make[1]: Leaving directory '/autolfs/sources/glibc-2.29'
make: *** [Makefile:12: install] Error 2

it is a good sign that the actually running kernel isn't ML-enabled.
ArchLinux's kernels are configured like

CONFIG_IA32_EMULATION=y
# CONFIG_IA32_AOUT is not set
# CONFIG_X86_X32 is not set

It isn't x32-enabled ==> Error when building x32 stuff
-->
  
  <sect2 arch="ml_x32,ml_all" role="installation">
    <title>Glibc - x32-bit</title>

    <para>The Glibc documentation recommends building Glibc 
    in a dedicated build directory:</para>

<screen><userinput remap="pre">mkdir -v build
cd       build</userinput></screen>

      <para>Prepare Glibc for compilation:</para>

<screen><userinput remap="configure">CC="gcc -mx32 -ffile-prefix-map=/tools=/usr" \
CXX="g++ -mx32 -ffile-prefix-map=/tools=/usr" \
../configure --prefix=/usr                          \
             --disable-werror                       \
             --enable-kernel=&min-kernel;                    \
             --enable-stack-protector=strong        \
             --enable-multi-arch                    \
             --libdir=/usr/libx32                   \
             --with-headers=/usr/include            \
             libc_cv_slibdir=/usr/libx32            \
             x86_64-pc-linux-gnux32</userinput></screen>

    <para>Compile the package:</para>

<screen><userinput remap="make">make</userinput></screen>

    <para>Install the package:</para>

<screen><userinput remap="install">sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile
make install_root=$PWD/DESTDIR install
mv -v DESTDIR/usr/libx32/* /usr/libx32/
install -vm644 DESTDIR/usr/include/gnu/lib-names-x32.h /usr/include/gnu/
[ -e DESTDIR/usr/include/gnu/stubs-x32.h ] \
  &amp;&amp; install -vm644 DESTDIR/usr/include/gnu/stubs-x32.h /usr/include/gnu/ \
  || ln -v /usr/include/gnu/stubs-64.h /usr/include/gnu/stubs-x32.h
ln -svf ../usr/libx32/ld-linux-x32.so.2 /lib/ld-linux-x32.so.2
ln -svf ../lib/locale /usr/libx32/locale</userinput></screen>
<!-- For whatever reason the stubs-x32.h doesn't get created. The 'ln' above is
just a "brute force" workaraound by copying the stubs-64.h file. -->

    <para>Configure the linker cache configuration:</para>

<screen><userinput>echo "/usr/libx32" > /etc/ld.so.conf.d/libx32.conf
ldconfig</userinput></screen>

    <para>Do cleanup:</para>

<screen><userinput>cd ..
rm -rf build</userinput></screen>

  </sect2>

  <!-- ~~~~~~~~~~~~~~~~~~~~ Cleanup ~~~~~~~~~~~~~~~~~~~~ -->

  <sect2 role="installation">
    <title>Cleanup</title>

    <para>Restore the file we moved temporarily away:</para>

<screen><userinput remap="pre">mv /usr/include/limits.h{.backup,} </userinput></screen>

  </sect2>
  
</sect1>