gupthaisready has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,
I want to use this module Math::GMP (for example)

Is it possible for me to install it in Linux and just simply copy the .pm files and .so files it creates to appropriate directories in a HP-UX machine and shall I still expect it to work properly??

Or should I install it separately there??

The reason I'm asking this is because I want to use Net::SFTP and Net::SSH::Perl in my software which should be running in HP-UX, Linux and Windows. I thought I can install these modules and just include the requried .pm files in to my software package.

I would really be glad to hear some advice on this.

Regards,
Kamal

Replies are listed 'Best First'.
Re: Compiled .so/ .sl across OS??
by moritz (Cardinal) on Jul 23, 2008 at 08:13 UTC
    Don't expect shared object files to work across operating systems. Install them on each OS separately.
      Well, I'd go even further:
      • don't expect (at all) that .so files can go from one operating system to another: object files change format between operating systems (it's COFF in some UNIces, a.out in others, PE in Win32, ELF in most linuxen/BSD, etc), for starters;
      • don't expect even that .so files can go from one version of one OS to another: it's possible that they depend on the installation of different versions of the kernel or some userspace libraries;
      • actually, don't expect also that .so files can go from one installation of one version of one OS to another: it's possible that they depend on some userspace libraries that weren't installed.
      • The installation process of a module (be it by ActiveState PPM or by CPAN or CPAN+) can put configuration files on each computer or have some other collateral effects needed for the operation of the module.
      All that said, in the specific case of Net::SFTP and Net::SSH::Perl, if I were you, I would use Inline::Module -- because apparently they are both pure perl modules and it will nicely tuck them into the .pmc file of your module, that you can then distribute between your machines...
      []s, HTH, Massa (κς,πμ,πλ)
Re: Compiled .so/ .sl across OS??
by derby (Abbot) on Jul 23, 2008 at 12:50 UTC
Re: Compiled .so/ .sl across OS??
by Perlbotics (Archbishop) on Jul 23, 2008 at 09:42 UTC
    And even when staying on the same platform, you can run into trouble if the local Perl installation was compiled differently/individually (linker, compiler, special dependencies, etc.). If you are lucky, it will work, but I would not risk it for anything 'production-like'.
    My recommendation is to individually install the Net::-packages in question. perl -MCPAN -e shell facilitates that. You can add these dependencies as prerequisites to your module. If you are in a kind of 'offline-situation' you might save a copy of the desired Net::*sources separately on your installation media.