Dear all Monks:

I have writen a perl script, and It will be placed on both i386 and x86_64 arch boxes. I write it in a x86_64 box, and install the x86_64 modules I need in the local project directory, not the default /usr/lib or /usr/local/lib directory,like these:

"./lib/perl5/site_perl/5.8.5"; "./lib64/perl5/5.8.5/x86_64-linux-thread-multi"; "./lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi";
my crrent work directory is "/home/larry/project/client_script". And I add 'use lib...' to instruct the script to find the local modules, like these:
use lib "./lib/perl5/site_perl/5.8.5"; use lib "./lib64/perl5/5.8.5/x86_64-linux-thread-multi"; use lib "./lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi";
it works well in x86_64 box, but when I put this script in a i386 box, and also install the i386 modules I need in these directory:
"./lib/perl5/5.8.5/i386-linux-thread-multi"; "./lib/perl5/site_perl/5.8.5/i386-linux-thread-multi";
and add these "use lib...." to my script:
use lib "./lib/perl5/5.8.5/i386-linux-thread-multi"; use lib "./lib/perl5/site_perl/5.8.5/i386-linux-thread-multi";
so, finally, I install both i386 and x86_64 modules in my local project directory:
"./lib/perl5/site_perl/5.8.5"; "./lib64/perl5/5.8.5/x86_64-linux-thread-multi"; "./lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi"; "./lib/perl5/5.8.5/i386-linux-thread-multi"; "./lib/perl5/site_perl/5.8.5/i386-linux-thread-multi";
and add these "use lib..." in my script:
use lib "./lib/perl5/site_perl/5.8.5"; use lib "./lib64/perl5/5.8.5/x86_64-linux-thread-multi"; use lib "./lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi"; use lib "./lib/perl5/5.8.5/i386-linux-thread-multi"; use lib "./lib/perl5/site_perl/5.8.5/i386-linux-thread-multi";
then I try to run this script in i386 and x86_64 box respectively, It doesn't work!! This script can't find the right modules in both i386 and x86_64 boxes. For example, there are two arch "threads" module placed in my project directory:
./lib/perl5/5.8.5/i386-linux-thread-multi/threads.pm ./lib64/perl5/5.8.5/x86_64-linux-thread-multi/threads.pm
and when I try to run the script in a x86_64 box, it throws this error:
Can't load '/home/larry/project/client_script/lib/perl5/5.8.5/i386-lin +ux-thread-multi/auto/threads/threads.so' for module threads: /home/la +rry/project/client_script/lib/perl5/5.8.5/i386-linux-thread-multi/aut +o/threads/threads.so: cannot open shared object file: No such file or + directory at /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/XSLoad +er.pm line 68.
when run in i386 box, it throws this error:
Can't load '/home/larry/project/client_script/lib64/perl5/5.8.5/x86_64 +-linux-thread-multi/auto/threads/threads.so' for module threads: /hom +e/larry/project/client_script/lib64/perl5/5.8.5/x86_64-linux-thread-m +ulti/auto/threads/threads.so: cannot open shared object file: No such + file or directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/XS +Loader.pm line 68.
But, if I preserve the only right arch "use lib ..." respectively, It works well on both i386 and x86_64 boxes.
My question is: Is there any way to instruct the perl to load the right arch modules in both i386 and x86_64 boxes?


In reply to How to instrust Perl to load the right modules based on architecture? by sunshine_august

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.