Re: Shared double?

[email protected] (Johan Vromans)
Newsgroups perl.par
Organization Squirrel Consultancy
Message-ID <[email protected]>
On Mon, 4 Jul 2016 10:25:39 +0200
Roderich Schupp <[email protected]> wrote:

> PAR::Packer also uses a set of rules for those
> Perl modules where static analysis - for some reason or other - is
> known to produce incomplete dependency information. They're actually
> in Module::ScanDeps, see %Preload.

Ah, interesting. Unfortunately I do not see a method to add entries to this
list. 

> But adding static rules, e.g.. for
> Wx, won't help, since shared libs are named differently on different
> OSes, may contain changing version numbers in their names etc.

This is where Alien::wxWidgets is for.

For example, when I "use Wx", this requires the components base, core and
adv. Wx::AUI requires component aui, which implies base and core.
Wx::Richtext requires net, html, xml and richtext.
Alien::wxWidgets->shared_libraries translates the components into shared
library names.

See attachment.

> Maybe you could post them to the mailing list, as a starting point for
> others with the same problem?

See attachment.

> > It would be helpful if pp supported a command line option to set the
> > search/load path for libraries. Under Linux I can set LD_LIBRARY_PATH,
> > Windows requires PATH, not very convenient.  
> 
> Such a command line option for pp is impossible as it would need to be
> implemented in the executable myldr/boot which is generated when you
> build PAR::Packer.

Maybe I misformulated. I did mean static lookup during pack time, not
run-time. In other words, assuming a hypothetical "-L" option:

  -L/opt/citrus/lib/Alien/wxWidgets/gtk_2_8_12_uni/lib/
  -llibwx_baseu-2.8.so
  -llibwx_gtk2u_core-2.8.so

this would be equivalent to:

  -l/opt/citrus/lib/Alien/wxWidgets/gtk_2_8_12_uni/lib/libwx_baseu-2.8.so
  -l/opt/citrus/lib/Alien/wxWidgets/gtk_2_8_12_uni/lib/libwx_gtk2u_core-2.8.so

except the latter is much less friendly, in particular when -L can be set
on the command line while the -l lines come from an @file .

-- Johan
wxdeps.pl (application/x-perl, 1.6 KB)
#!/usr/bin/perl

# Produce pp options to Wx components.
#
# WARNING: ALPHA VERSION. PLEASE FEEDBACK.

use strict;
use warnings;
use Alien::wxWidgets;
use File::Spec;

unless ( @ARGV ) {
    die("Usage $0 [ Wx::Module... | component... | \"all\" ]\n");
}

my %stddeps =
  (
    'Wx'		=> [ qw( base core adv ) ],
    'Wx::AUI'		=> [ qw( aui ) ],
    'Wx::Html'		=> [ qw( html net ) ],
    'Wx::Media'		=> [ qw( media ) ],
    'Wx::RichText'	=> [ qw( base html xml richtext ) ],
    'Wx::XRC'		=> [ qw( base html xml xrc ) ],
    'Wx::GLCanvas'	=> [ qw( gl ) ],
    'Wx::Socket'	=> [ qw( net ) ],
    'Wx::WebView'	=> [ qw( webview ) ],
    'Wx::STC'		=> [ qw( stc ) ],
    'Wx::PropertyGrid'	=> [ qw( propgrid ) ],
  );

# Site specific install lib, if any (MS Windows only).
my $lib;
eval { $lib = Alien::wxWidgets->shared_library_path() };
if ( $lib ) {
    $lib =~ s/[\\\/]*//;
}
else {
    $lib = "";
}

my @components;

foreach ( @ARGV ) {
    if ( /^Wx(?:$|::)/ ) {
	push( @components, @{ $stddeps{$_} } ) if exists $stddeps{$_};
    }
    else {
	push( @components, $_ ) unless $_ eq "all";
    }
}

my @libs = Alien::wxWidgets->shared_libraries(@components);

foreach my $l ( @libs ) {
    $l = File::Spec->catfile( $lib, $l ) if $lib;
    print("--link=$l\n");
}

=head1 LICENSE

Copyright (C) 2016, Johan Vromans <[email protected]>

This program is free software. You can redistribute it and/or
modify it under the terms of the Artistic License 2.0.

This program is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.

=cut

1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.