PAR Wins!

New client, they set up a SuSE Enterprise Linux VM for me to install on. I approach this with trepidation. SLES is distinct from OpenSUSE, so I can't set up a VM at home for staging. Turns out my fears were misplaced; a PAR built on CentOS 5.8 runs on SLES 11.2 with only a minor problem. Colour me Impressed.

The minor problem was that some libraries aren't the same version. But a simple -l db -l gnutls -l gnutls-extra -l gnutls-openssl works around this. Of course, PAR::Packer only looks in LD_LIBRARY_PATH for libraries. MUST NOT BE SIDETRACKED INTO FIXING THIS.

Here's how to check shared libraries. First you build your PAR. Then extract it:

mkdir t
cd t
unzip ../your.par

Now scan that with the following code:


use strict;
use warnings;

use File::Finder;

my %already;
foreach my $lib ( File::Finder->name("*.so")->in('lib') ) {
    foreach my $line ( qx(ldd $lib) ) {
        chomp( $line );
        next unless $line =~ /(.+)\s+=>\s+(.+)\s\(0x/;
        my( $so, $file ) = ( $1, $2 );
        next if $file =~ m(^/lib);  # assume anything in /lib and /lib64 are OK
        next if $already{$file}++;
        print "rpm -qf $file # $lib\n";

This will produce some commands that you then paste into a command prompt on the remote computer. If one of the lines doesn't show up, you will have to include it in the PAR. Note that sometimes one distro will put the library in /usr/lib64 and another distro will put it in /lib64 which might cause false negatives. I wonder what the overhead of including EVERY library in the PAR would be. MUST NOT BE SIDETRACKED.

No comments: