source: BOOK/final-system/multilib/perl-64bit.xml @ 545581a

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since 545581a was 545581a, checked in by Jim Gifford <clfs@…>, 18 years ago

r5186@server: jim | 2006-08-22 09:24:23 -0700
Fixed typo in perl multilib

  • Property mode set to 100644
File size: 5.6 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
4  <!ENTITY % general-entities SYSTEM "../../general.ent">
5  %general-entities;
6]>
7
8<sect1 id="ch-system-perl" role="wrap">
9  <?dbhtml filename="perl-64bit.html"?>
10
11  <title>Perl-&perl-version; 64 Bit</title>
12
13  <indexterm zone="ch-system-perl">
14    <primary sortas="a-Perl">Perl</primary>
15  </indexterm>
16
17  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
18  href="../common/perl.xml"
19  xpointer="xpointer(//*[@role='package'])"/>
20
21  <sect2 role="installation">
22    <title>Installation of Perl</title>
23
24    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
25    href="../common/perl.xml"
26    xpointer="xpointer(//*[@os='p1'])"/>
27
28    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
29    href="../common/perl.xml"
30    xpointer="xpointer(//*[@os='p2'])"/>
31
32    <para os="p3">Perl does not, by default, know about library directories with names other
33    than lib, The following patch will allow it to install to other directories:</para>
34
35<screen os="p4"><userinput>patch -Np1 -i ../&perl-multilib-patch;</userinput></screen>
36
37    <para os="s1">There is a further (possibly cosmetic) anomaly - if we install perl and
38    then run <command>perl -V</command> it will claim that libc is in /lib.  The
39    following sed fixes this, but only takes effect when <command>make install
40    </command> is run:</para>
41
42<screen os="s2"><userinput>sed -i "/libc/s@/lib@/lib64@" hints/linux.sh</userinput></screen>
43
44    <para os="m2">We still need to tell perl to actually use lib64:</para>
45
46<screen os="m3"><userinput>echo 'installstyle="lib64/perl5"' >>hints/linux.sh</userinput></screen>
47
48    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
49    href="../common/perl.xml"
50    xpointer="xpointer(//*[@os='a00'])"/>
51
52    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
53    href="../common/perl.xml"
54    xpointer="xpointer(//*[@os='a01'])"/>
55
56    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
57    href="../common/perl.xml"
58    xpointer="xpointer(//*[@os='a'])"/>
59
60<screen os="b"><userinput>./configure.gnu --prefix=/usr \
61   -Dman1dir=/usr/share/man/man1 \
62   -Dman3dir=/usr/share/man/man3 \
63   -Dpager="/bin/less -isR" \
64   -Dlibpth="/usr/local/lib64 /lib64 /usr/lib64" \
65   -Dcc="gcc ${BUILD64}" \
66   -Dusethreads</userinput></screen>
67
68    <variablelist os="m4">
69      <title>The meaning of the new configure option:</title>
70
71      <varlistentry>
72        <term><parameter>-Dlibpth="/usr/local/lib64 /lib64 /usr/lib64"</parameter></term>
73        <listitem>
74          <para>This tells Perl to link against the 64-bit libraries.</para>
75        </listitem>
76      </varlistentry>
77
78    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
79    href="../common/perl.xml"
80    xpointer="xpointer(//*[@os='c1'])"/>
81
82    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
83    href="../common/perl.xml"
84    xpointer="xpointer(//*[@os='c2'])"/>
85
86    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
87    href="../common/perl.xml"
88    xpointer="xpointer(//*[@os='c3'])"/>
89
90    </variablelist>
91
92    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
93    href="../common/perl.xml"
94    xpointer="xpointer(//*[@os='d'])"/>
95
96    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
97    href="../common/perl.xml"
98    xpointer="xpointer(//*[@os='e'])"/>
99
100    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
101    href="../common/perl.xml"
102    xpointer="xpointer(//*[@os='h'])"/>
103
104    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
105    href="../common/perl.xml"
106    xpointer="xpointer(//*[@os='j'])"/>
107
108    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
109    href="../common/perl.xml"
110    xpointer="xpointer(//*[@os='k'])"/>
111
112    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
113    href="perl.xml"
114    xpointer="xpointer(//*[@os='l'])"/>
115
116<screen os="m"><userinput>mv /usr/bin/perl{,-64}</userinput></screen>
117
118    <para os="n">Now we need to create a multilib wrapper that lets us choose
119    which perl installation to use.</para>
120
121<screen os="o"><userinput>cat &gt; perl_wrapper.c &lt;&lt; "EOF"
122#include &lt;stdio.h&gt;
123#include &lt;stdlib.h&gt;
124#include &lt;string.h&gt;
125#include &lt;unistd.h&gt;
126#include &lt;errno.h&gt;
127
128int main (int argc, char *argv[])
129{
130  char *perl_arch;
131  if ((perl_arch = getenv("PERL_ARCH")) == NULL)
132    perl_arch = "64";
133
134  char *filename = malloc(strlen(argv[0]) + strlen(perl_arch) + 2);
135  strcpy(filename, argv[0]);
136  strcat(filename, "-");
137  strcat(filename, perl_arch);
138
139  int ret = 0;
140  ret = execvp(filename, argv);
141  if ((ret != 0)&amp;&amp;(errno != 0))
142  {
143    char *errmsg = malloc(strlen(filename) + 19);
144    strcpy(errmsg, "Unable to execute ");
145    strcat(errmsg, filename);
146    perror(errmsg);
147    free(errmsg);
148  }
149
150  free(filename);
151
152  return ret;
153}
154EOF
155gcc ${BUILD64} perl_wrapper.c -o /usr/bin/perl</userinput></screen>
156
157  </sect2>
158
159    <para os="p">This multilib wrapper makes it possible to build perl
160    extensions other then 64bit. The PERL_ARCH enviornment variable controls
161    which perl binary to execute. Some packages that may attempt to build
162    against perl will run <command>perl -V:cc</command> to get the command
163    that was used to build perl. If you're building a 32bit extension but you
164    only have a 64bit perl this is not desired. By setting PERL_ARCH=32 you
165    will beable to build the 32bit extension because
166    <command>perl -V:cc</command> will return the command used to build the
167    32bit perl installation.</para>
168
169  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
170  href="../common/perl.xml"
171  xpointer="xpointer(id('contents-perl'))"/>
172
173</sect1>
Note: See TracBrowser for help on using the repository browser.