From 6e84b15fa13a4b5d1b4f98afcd014febf424d93f Mon Sep 17 00:00:00 2001 From: rschupp Date: Mon, 11 Mar 2024 14:05:05 +0100 Subject: [PATCH] investigate failure to build XSBar --- Changes | 8 +++ lib/PAR/Packer.pm | 2 +- t/87-xs-cross.t | 103 ++++++++++++++++++++++---------------- t/data/XSQuux/Makefile.PL | 7 +++ 4 files changed, 77 insertions(+), 43 deletions(-) diff --git a/Changes b/Changes index 369f40e..067e87b 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,11 @@ +1.062_002 2024-03-11 + +Devel release, more debug output. + +1.062_001 2024-03-10 + +Devel release, investigate problems with t/b7-xs-cross.t + 1.062 2024-03-05 - Fix #84: PAR::Packer packaged scripts lose the ability to parse UTF-8 arguments from the command line diff --git a/lib/PAR/Packer.pm b/lib/PAR/Packer.pm index b706454..cbd27d2 100644 --- a/lib/PAR/Packer.pm +++ b/lib/PAR/Packer.pm @@ -3,7 +3,7 @@ use 5.008001; use strict; use warnings; -our $VERSION = '1.063'; +our $VERSION = '1.062_002'; =head1 NAME diff --git a/t/87-xs-cross.t b/t/87-xs-cross.t index fddd91c..cad6be7 100644 --- a/t/87-xs-cross.t +++ b/t/87-xs-cross.t @@ -19,42 +19,42 @@ plan skip_all => "Tests only relevant on Windows" unless $^O eq 'MSWin32'; # and e.g. Gtk2.xs.dll calls functions in Pango.xs.dll and Cairo.xs.dll. -### debug helpers (Windows only) -#use File::Find; -#use IPC::Run3; -#use Module::ScanDeps; -# -#sub show_tree -#{ -# my ($top) = @_; -# my @files; -# find(sub { push @files, $File::Find::name if -f $_ }, $top); -# diag(join("\n", "--- $top ---", (sort @files), "---")); -#} -# -#sub show_dlls -#{ -# my ($install_base, $mod_name) = @_; -# my @mod_parts = split("::", $mod_name); -# my $mod_dll = catfile($install_base, qw(lib perl5), $Config{archname}, -# qw(auto), @mod_parts, "$mod_parts[-1].$Config{dlext}"); -# diag("XS module $mod_name => $mod_dll"); -# -# my ($out, $err); -# run3([qw(objdump -ax), $mod_dll], \undef, \$out, \$err); -# if ($? != 0) -# { -# diag(qq["objdump -ax $mod_dll" failed:\n$err]); -# return; -# } -# run3([$^X, "-nE", "print if /DLL Name.*/"], \$out, \$err, \$err); -# if ($? != 0) -# { -# diag(qq[Extracting DLL names from $mod_dll failed:\n$err]); -# return; -# } -# diag("$mod_dll links to:\n$err"); -#} +## debug helpers (Windows only) +use File::Find; +use IPC::Run3; +use Module::ScanDeps; + +sub show_tree +{ + my ($top) = @_; + my @files; + find(sub { push @files, $File::Find::name if -f $_ }, $top); + diag(join("\n", "--- $top ---", (sort @files), "---")); +} + +sub show_dlls +{ + my ($install_base, $mod_name) = @_; + my @mod_parts = split("::", $mod_name); + my $mod_dll = catfile($install_base, qw(lib perl5), $Config{archname}, + qw(auto), @mod_parts, "$mod_parts[-1].$Config{dlext}"); + diag("XS module $mod_name => $mod_dll"); + + my ($out, $err); + run3([qw(objdump -ax), $mod_dll], \undef, \$out, \$err); + if ($? != 0) + { + diag(qq["objdump -ax $mod_dll" failed:\n$err]); + return; + } + run3([$^X, "-nE", "print if /DLL Name.*/"], \$out, \$err, \$err); + if ($? != 0) + { + diag(qq[Extracting DLL names from $mod_dll failed:\n$err]); + return; + } + diag("$mod_dll links to:\n$err"); +} my @checks = ( @@ -106,13 +106,32 @@ foreach my $mod (qw(XSQuux XSBar)) { diag("build and install $mod"); chdir(catdir($cwd, qw(t data), $mod)) or die "can't chdir to $mod source: $!"; - run_ok($^X, "Makefile.PL", "INSTALL_BASE=$base"); - run_ok($make); - run_ok($make, "install"); - run_ok($make, "clean"); - # DEBUG show_tree($base); - # DEBUG show_dlls($base, $mod); + my ($out, $err); + + diag(qq[run "$^X Makefile.PL INSTALL_BASE=$base"]); + ($out, $err) = run_ok($^X, "Makefile.PL", "INSTALL_BASE=$base"); + diag("OUT:\n$out\nERR:\n$err\n"); + foreach my $file (qw(Files.pm Makefile)) + { + local $/ = undef; open my $fh, "<", $file or die "can't open $file"; + diag(join("\n", "--- $file ---", <$fh>, "---")); + close $fh; + } + + diag(qq[run "$make"]); + ($out, $err) = run_ok($make); + diag("OUT:\n$out\nERR:\n$err\n"); + + diag(qq[run "$make install"]); + ($out, $err) = run_ok($make, "install"); + diag("OUT:\n$out\nERR:\n$err\n"); + + diag(qq[run "$make clean"]); + ($out, $err) = run_ok($make, "clean"); + diag("OUT:\n$out\nERR:\n$err\n"); + show_tree($base); + show_dlls($base, $mod); } chdir($cwd) or die "can't chdir back to build dir: $!"; diff --git a/t/data/XSQuux/Makefile.PL b/t/data/XSQuux/Makefile.PL index 4b05d9a..cd454de 100644 --- a/t/data/XSQuux/Makefile.PL +++ b/t/data/XSQuux/Makefile.PL @@ -2,6 +2,9 @@ use 5.008009; # should match MIN_PERL_VERSION in toplevel Makefile.PL use ExtUtils::MakeMaker; use ExtUtils::Depends; +print STDERR "ExtUtils::MakeMaker::VERSION => $ExtUtils::MakeMaker::VERSION\n"; +print STDERR "ExtUtils::Depends::VERSION => $ExtUtils::Depends::VERSION\n"; + my $pkg = ExtUtils::Depends->new(qw(XSQuux)); $pkg->add_xs(qw(XSQuux.xs)); $pkg->add_pm('XSQuux.pm' => '$(INST_LIB)/XSQuux.pm'); @@ -18,3 +21,7 @@ WriteMakefile( $pkg->get_makefile_vars(), clean => { FILES => "Files.pm" }, # must come after get_makefile_vars ); + +use Data::Dumper; +my %vars = $pkg->get_makefile_vars(); +print STDERR "get_makefile_vars => ", Dumper(\%vars);