Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: "symbol lookup error" message help

by Special_K (Monk)
on Jan 23, 2023 at 17:40 UTC ( [id://11149793]=note: print w/replies, xml ) Need Help??


in reply to Re: "symbol lookup error" message help
in thread "symbol lookup error" message help

> XS modules need to be compiled when installed, using the same compiler as the Perl they are being installed to.

Can you please elaborate on this? I'm not familiar with XS, but a brief search turns up the "xsubpp" utility, which is apparently used to compile Perl XS code into C code. If I run xsubpp -v on each of the two machines, I receive the following output:

RHEL7: xsubpp version 2.21 RHEL8: xsubpp version 3.24

These xsubpp versions seem completely separate from any version of perl installed on the system. Are you saying that when an XS module such as List::Util is installed, whatever version of xsubpp happens to be installed on the system is used to compile the C code and from then on, only machines with that same version of xsubpp installed can use the module?

Replies are listed 'Best First'.
Re^3: "symbol lookup error" message help
by choroba (Cardinal) on Jan 24, 2023 at 16:40 UTC
    Don't care about xsubpp. When you upgrade Perl, simply reinstall all the modules for the new version.

    Alternatively, use PerlBrew to keep several Perl versions. Each version needs its own set of modules (again, in fact, only XS modules need to be different, but if you don't know which these are, just install all of them for each version).

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      Let's say I have a script that starts as follows:



      #!/usr/bin/perl use strict; use warnings; use lib '/home/foo/perl_modules/5.32.1/lib/perl5' use List::MoreUtils qw(uniq);


      Assume on one machine /usr/bin/perl points to perl version 5.32.1. Also assume the List::MoreUtils module is installed in /home/foo/perl_modules/5.32.1/lib/perl5 using perl 5.32.1.

      Now assume on another machine /usr/bin/perl points to perl 5.26.3. Also assume the List::MoreUtils module is installed in /home/foo/perl_modules/5.26.3/lib/perl5 using perl 5.26.3.

      Is there a way to manage this such that the script can be run on both machines, each with their respective perl versions, without having to make 2 copies of the script, one for each module path?

        If there's only one perl installed on each machine, it makes no sense to include its version into the path. Install the modules into the same path on both the machines and you can use the same script.

        If you insist on having the Perl version included in the path and not having Perl configured to search for modules there, you can use something like

        use lib '/home/foo/perl_modules/' . substr($^V, 1) . '/lib/perl5';

        But why?

        map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      Given a directory where perl modules are already installed (ex: /home/user_foo/perl_modules/lib/perl5 from my original message), how do I determine what version of perl was used to install them?
        Use Module::Metadata (core) to examine the path:
        /usr/bin/perl -MModule::Metadata -le 'print Module::Metadata->find_mod +ule_by_name("Class::Struct")'
        /System/Library/Perl/5.18/Class/Struct.pm

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11149793]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-25 15:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found