Ignore:
Timestamp:
Aug 21, 2006, 10:38:49 PM (18 years ago)
Author:
Joe Ciccone <jciccone@…>
Branches:
clfs-1.2, clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
Children:
95ab747
Parents:
b65bb044
Message:

Added a multilib wrapper to perl on multilib builds.

Location:
BOOK/final-system/multilib
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • BOOK/final-system/multilib/perl-64bit.xml

    rb65bb044 r9c1db810  
    99  <?dbhtml filename="perl-64bit.html"?>
    1010
    11   <title>Perl-&perl-version;</title>
     11  <title>Perl-&perl-version; 64 Bit</title>
    1212
    1313  <indexterm zone="ch-system-perl">
     
    2222    <title>Installation of Perl</title>
    2323
    24     <para os="m1">In multilib builds we install compilers and libraries for each available
    25     architecture.  The description below says that perl installs several hundred
    26     libraries, but they are used by invoking <command>perl</command>, not by linking
    27     to them with <command>ld</command>.  Although it is possible to install perl for
    28     32 bits, move it to a different name, and then install the 64-bit version, it is
    29     almost always invoked as just <command>perl</command>. That means only the
    30     libraries and modules for the last version installed will be accessible. We
    31     therefore only install one version.</para>
    32 
    3324    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    3425    href="../common/perl.xml"
     
    4031
    4132    <para os="p3">Perl does not, by default, know about library directories with names other
    42     than lib, such as lib64.  The following patch will allow it to install to lib64:</para>
     33    than lib, The following patch will allow it to install to other directories:</para>
    4334
    4435<screen os="p4"><userinput>patch -Np1 -i ../&perl-multilib-patch;</userinput></screen>
    4536
    46     <para os="p5">There is a further (possibly cosmetic) anomaly - if we install perl and
     37    <para os="s1">There is a further (possibly cosmetic) anomaly - if we install perl and
    4738    then run <command>perl -V</command> it will claim that libc is in /lib.  The
    48     following patch fixes this, but only takes effect when <command>make install
     39    following sed fixes this, but only takes effect when <command>make install
    4940    </command> is run:</para>
    5041
    51 <screen os="p6"><userinput>patch -Np1 -i ../&perl-lib64-patch;</userinput></screen>
     42<screen os="s2"><userinput>sed -i "/libc/s@/lib@/lib64@" hints/linux.sh</userinput></screen>
    5243
    5344    <para os="m2">We still need to tell perl to actually use lib64:</para>
     
    119110    xpointer="xpointer(//*[@os='k'])"/>
    120111
     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
    121157  </sect2>
    122158
Note: See TracChangeset for help on using the changeset viewer.