daniel.sherwood has asked for the wisdom of the Perl Monks concerning the following question:

Hi I am attempting to get a non root module directory working that can be shared by multiple architectures. All the non-binary stuff is working fine (same code for all architectures), and the binary stuff works as expected for all solaris and windows clients, however I am struggling to identify where the .so files should live for x86_64-linux-thread-multi (RHEL4).

This is where I have stored the various modules that work...
modules/5.8.8/sparc-sun-solaris2.6/auto/P4/P4.(bs,so) modules/5.8.8/sparc-sun-solaris2.8/auto/P4/P4.(bs,so) modules/5.8.8/sparc-sun-solaris2.9/auto/P4/P4.(bs,so) modules/5.8.8/MSWin32-x86-multi-thread/auto/P4/P4.(bs,dll,exp,lib) modules/5.10.0/cygwin-thread-multi-64int/auto/P4/P4.dll
And here are a couple of various places I have tried to put the failing ones...
modules/x86_64-linux-thread-multi/auto/P4/P4.(bs,so) modules/5.8.5/x86_64-linux-thread-multi/auto/P4/P4.(bs,so)
But whenever I run, I get the following error...
[p4admin@serv20 p4perl-2008.1]$ perl -MP4 -I /tools/perforce/scripts/ +beta/modules/ -e 'print P4::Identify();' Can't locate loadable object for module P4 in @INC (@INC contains: /to +ols/perforce/scripts/beta/modules/ /usr/lib64/perl5/5.8.5/x86_64-linu +x-thread-multi /usr/lib/perl5/5.8.5 /usr/lib64/perl5/site_perl/5.8.5/ +x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.4/x86_64-lin +ux-thread-multi /usr/lib64/perl5/site_perl/5.8.3/x86_64-linux-thread- +multi /usr/lib64/perl5/site_perl/5.8.2/x86_64-linux-thread-multi /usr +/lib64/perl5/site_perl/5.8.1/x86_64-linux-thread-multi /usr/lib64/per +l5/site_perl/5.8.0/x86_64-linux-thread-multi /usr/lib/perl5/site_perl +/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 +/usr/lib/perl5/site_perl/5.8.2 /usr/lib/perl5/site_perl/5.8.1 /usr/li +b/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib64/perl5/ven +dor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl +/5.8.4/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.3/x +86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.2/x86_64-li +nux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.1/x86_64-linux-thre +ad-multi /usr/lib64/perl5/vendor_perl/5.8.0/x86_64-linux-thread-multi + /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /u +sr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.2 /usr/ +lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib +/perl5/vendor_perl .) at -e line 0 Compilation failed in require. BEGIN failed--compilation aborted.
Here is various system info...
[p4admin@serv20 p4perl-2008.1]$ uname -a Linux serv20 2.6.9-42.0.3.ELsmp #1 SMP Mon Sep 25 17:24:31 EDT 2006 x8 +6_64 x86_64 x86_64 GNU/Linux [p4admin@serv20 p4perl-2008.1]$ perl -V Summary of my perl5 (revision 5 version 8 subversion 5) configuration: Platform: osname=linux, osvers=2.6.9-22.18.bz155725.elsmp, archname=x86_64-l +inux-thread-multi uname='linux hs20-bc1-3.build.redhat.com 2.6.9-22.18.bz155725.elsm +p #1 smp thu nov 17 15:34:08 est 2005 x86_64 x86_64 x86_6 4 gnulinux ' config_args='-des -Doptimize=-O2 -g -pipe -m64 -Dversion=5.8.5 -Dm +yhostname=localhost -Dperladmin=root@localhost -Dcc=gcc - Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Dlibpth=/usr/ +local/lib64 /lib64 /usr/lib64 -Dprivlib=/usr/lib/perl5/5. 8.5 -Dsitelib=/usr/lib/perl5/site_perl/5.8.5 -Dvendorlib=/usr/lib/perl +5/vendor_perl/5.8.5 -Darchlib=/usr/lib64/perl5/5.8.5/x86_ 64-linux-thread-multi -Dsitearch=/usr/lib64/perl5/site_perl/5.8.5/x86_ +64-linux-thread-multi -Dvendorarch=/usr/lib64/perl5/vendo r_perl/5.8.5/x86_64-linux-thread-multi -Darchname=x86_64-linux -Dvendo +rprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_n +dbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseper lio -Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dpager=/usr/bin +/less -isr -Dinc_version_list=5.8.4 5.8.3 5.8.2 5.8.1 5.8 .0' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemulti +plicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-st +rict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOU RCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2 -g -pipe -m64', cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-alias +ing -pipe -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='3.4.6 20060404 (Red Hat 3.4.6-2)', gccos +andvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='gcc', ldflags ='' libpth=/usr/local/lib64 /lib64 /usr/lib64 libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread +-lc perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/libc-2.3.3.so, so=so, useshrplib=true, libperl=libperl.s +o gnulibc_version='2.3.4' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E - +Wl,-rpath,/usr/lib64/perl5/5.8.5/x86_64-linux-thread-mult i/CORE' cccdlflags='-fPIC', lddlflags='-shared' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS USE_64_BIT +_INT USE_64_BIT_ALL USE_LARGE_FILES PERL_IMPLICIT_CONTEXT Built under linux Compiled at Jul 24 2006 18:28:14 @INC: /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/5.8.5 /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.4/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.3/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.2/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.1/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.0/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2 /usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.4/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.3/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.2/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.1/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.2 /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .
Does anybody know where the P4.(bs,so) files should live for this architecture?

Cheers

Daniel

Replies are listed 'Best First'.
Re: Multiarch binary module support
by moritz (Cardinal) on Aug 21, 2008 at 10:03 UTC
    I've seen no modules/5.8.8 in your @INC. (Ignore that. The perl version is actually 5.8.5)

    Did you try to just install the module with prefix modules/ as the installation path?

    I'm amazed that your setup works at all, because I always thought it was a bad idea to have paths for different perl versions in @INC. (But I could be wrong, of course).

Re: Multiarch binary module support
by bart (Canon) on Aug 21, 2008 at 10:10 UTC
    In one of the subdirectories of */5.8.5/x86_64-linux-thread-multi, that's where I would put it.

    It ought to work under any of those subdirectories in @INC, but one of these directories (you have 2 of those) sounds safest, because then you won't accidently use it in a different, wrong, perl.

    Can't you just let make figure it out?

      That was what I tried, but it is not found. This is only a problem for arch specific files, it works on all other platforms, just not this one.

      If I put the file in modules/P4.(bs,so) it works fine for this platform, but others (solaris) will fail because they will find the Linux version of the .so file before the Solaris version!!!!

      I may try (for now) just putting it in the modules/5.8.5 directory as no other platforms are using this version of Perl.
        OK, some more progress...

        Using truss/strace, it appears that the perl-5.8.5 being used on the Linux box only looks for modules/auto/P4/P4.so and modules/P4.so, it doesn't bother looking in any path below modules/ that contains either the Perl version (5.8.5, perl5) or the architecture. The Solaris ones on the other hand look for 5.8.8/solaris-sparc-2.X/aout/P4/P4.so first so I should be able to get it working by putting the Linux one in modules/P4.so.

        Not particularly nice:)

        Does anybody know whether the search for modules in version and architecture directories below an @INC entry was added after 5.8.5, or is this an issue with the RHEL4 version of Perl?

        Cheers
        Eh, what??

        In your perl -V, it explicitly lists that you are using a perl for Linux. So of course it'll try to use the Linux .so file.