Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing on Win10/ActivePerl 5.24.0 hangs #403

Open
MarcelVersteeg opened this issue Jun 22, 2023 · 10 comments
Open

Installing on Win10/ActivePerl 5.24.0 hangs #403

MarcelVersteeg opened this issue Jun 22, 2023 · 10 comments
Labels
🐞Bug Something fails that should not (not a feature)

Comments

@MarcelVersteeg
Copy link

I am trying to install Alient-Libxml2 on my Windows10 computer running ActivePerl 5.24.0 (due to a shared hosting service, I cannot use another version of Perl right now unfortunately), but the installation hangs on the extaction of the downloaded tar.xz.

I created the makefile using the command

perl Makefile.PL

Then started the build using the command

dmake

The output of the dmake command is:

dmake:  makefile:  line 753:  Warning: -- Empty recipe for special or meta target .NOTPARALLEL
dmake:  makefile:  line 755:  Warning: -- Empty recipe for special or meta target .NO_PARALLEL
cp lib/Alien/Libxml2.pm blib\lib/Alien/Libxml2.pm
"D:\Perl64\bin\perl.exe" -MAlien::Build::MM=cmd -e prefix site D:\Perl64\lib D:\Perl64\site\lib
Alien::Build::Plugin::PkgConfig::Negotiate> Using PkgConfig plugin: PkgConfig::PP
main> prefix D:/Perl64/site/lib/auto/share/dist/Alien-Libxml2
"D:\Perl64\bin\perl.exe" -MAlien::Build::MM=cmd -e version 0.19
Alien::Build::Plugin::PkgConfig::Negotiate> Using PkgConfig plugin: PkgConfig::PP
"D:\Perl64\bin\perl.exe" -MAlien::Build::MM=cmd -e download
Alien::Build::Plugin::PkgConfig::Negotiate> Using PkgConfig plugin: PkgConfig::PP
Alien::Build::Plugin::Core::Download> candidate *https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.4.tar.xz
Alien::Build::Plugin::Core::Download> candidate  https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.3.tar.xz
Alien::Build::Plugin::Core::Download> candidate  https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.2.tar.xz
Alien::Build::Plugin::Core::Download> candidate  https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.1.tar.xz
Alien::Build::Plugin::Core::Download> candidate  https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.0.tar.xz
Alien::Build::Plugin::Core::Download> candidate  https://download.gnome.org/sources/libxml2/2.10/libxml2-2.10.4.tar.xz
Alien::Build::Plugin::Core::Download> candidate  https://download.gnome.org/sources/libxml2/2.10/libxml2-2.10.3.tar.xz
Alien::Build::Plugin::Core::Download> candidate  https://download.gnome.org/sources/libxml2/2.10/libxml2-2.10.2.tar.xz
Alien::Build::Plugin::Core::Download> candidate  ...
Alien::Build::Plugin::Core::Download> setting version based on archive to 2.11.4
Alien::Build::Plugin::Core::Download> downloaded libxml2-2.11.4.tar.xz
"D:\Perl64\bin\perl.exe" -MAlien::Build::MM=cmd -e build
Alien::Build::Plugin::PkgConfig::Negotiate> Using PkgConfig plugin: PkgConfig::PP
Alien::Build::Plugin::Extract::CommandLine> + tar -xf E:/WebPages/personal/Shared/_test/Alien-Libxml2-0.19/_alien/download_Nv7P/libxml2-2.11.4.tar.xz

And then it stops

@plicease
Copy link
Member

What version of tar is in your path? I think on modern windows it is usually bsdtar?

@MarcelVersteeg
Copy link
Author

The command tar --help gives the following output:

tar(bsdtar): manipulate archive files
First option must be a mode specifier:
  -c Create  -r Add/Replace  -t List  -u Update  -x Extract
Common Options:
  -b #  Use # 512-byte records per I/O block
  -f <filename>  Location of archive (default \\.\tape0)
  -v    Verbose
  -w    Interactive
Create: tar -c [options] [<file> | <dir> | @<archive> | -C <dir> ]
  <file>, <dir>  add these items to archive
  -z, -j, -J, --lzma  Compress archive with gzip/bzip2/xz/lzma
  --format {ustar|pax|cpio|shar}  Select archive format
  --exclude <pattern>  Skip files that match pattern
  -C <dir>  Change to <dir> before processing remaining files
  @<archive>  Add entries from <archive> to output
List: tar -t [options] [<patterns>]
  <patterns>  If specified, list only entries that match
Extract: tar -x [options] [<patterns>]
  <patterns>  If specified, extract only entries that match
  -k    Keep (don't overwrite) existing files
  -m    Don't restore modification times
  -O    Write entries to stdout, don't restore to disk
  -p    Restore permissions (including ACLs, owner, file flags)
bsdtar 3.5.2 - libarchive 3.5.2 zlib/1.2.5.f-ipp

So it is indeed bsdtar version 3.5.2.
To be complete, my Windows version is Windows 10 22H2 (OS build 19045.3086)

@plicease plicease transferred this issue from PerlAlien/Alien-Libxml2 Jun 23, 2023
@plicease plicease added the 🐞Bug Something fails that should not (not a feature) label Jun 23, 2023
@plicease
Copy link
Member

I don't have access to my Windows box right now, but should be able to look at this soon. I've transferred this issue to Alien-Build because it is not specific to Alien::Libxml2.

@plicease
Copy link
Member

plicease commented Jun 24, 2023

@MarcelVersteeg can you try this trail version of Alien::Build:
https://cpan.metacpan.org/authors/id/P/PL/PLICEASE/Alien-Build-2.81_01.tar.gz
and then try reinstalling Alien::Libxml2? It should use the Archive::Tar instead of the command line BSD tar to extract the tarball.

@MarcelVersteeg
Copy link
Author

@plicease I tried to install that version, but after installing/updating a lot of the required modules for that, I got stuck at installing Compress::Raw::Lzma:

E:\WebPages\personal\Shared\_test\Compress-Raw-Lzma-2.204>dmake
cp lib/Compress/Raw/Lzma.pm blib\lib\Compress\Raw\Lzma.pm
AutoSplitting blib\lib\Compress\Raw\Lzma.pm (blib\lib\auto\Compress\Raw\Lzma)
Running Mkbootstrap for Lzma ()
"D:\Perl64\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 "Lzma.bs"
"D:\Perl64\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- Lzma.bs blib\arch\auto\Compress\Raw\Lzma\Lzma.bs 644
"D:\Perl64\bin\perl.exe" "D:\Perl64\lib\ExtUtils\xsubpp"  -typemap D:\Perl64\lib\ExtUtils\typemap -typemap E:\WebPages\personal\Shared\_test\Compress-Raw-Lzma-2.204\typemap  Lzma.xs > Lzma.xsc
"D:\Perl64\bin\perl.exe" -MExtUtils::Command -e mv -- Lzma.xsc Lzma.c
D:\Perl64\site\lib\auto\MinGW\bin\gcc.exe -c  -I/usr/local/include      -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2     -DVERSION=\"2.204\"   -DXS_VERSION=\"2.204\"  "-ID:\Perl64\lib\CORE"  -Wall -Wno-comment Lzma.c
Lzma.xs:18:18: fatal error: lzma.h: No such file or directory
compilation terminated.
dmake:  Error code 129, while making 'Lzma.o'

I cannot compile that one, so I can't install it in order to install the trial version.

@plicease
Copy link
Member

plicease commented Jun 27, 2023

This is a problem with AS Perl and/or Compress::Raw::Lzma. (Compress::Raw::Lzma and lzma.h have come with Strawberry Perl for a while I think). If you have a support agreement with AS it might be worth opening a ticket with them. Unfortunately they do not provide downloads of older versions of AS Perl so I have no way of even reproducing this to see if there is a workaround to get the Lzma module installed.

Failing all of that here is a workaround that you can use to get it working for you:

Download the libxml2 package https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.4.tar.xz into a directory patch in the Alien-Libxml2 dist. Decompress with xz (I believe it is already in your path, that is what is causing the hang with bsdtar).

mkdir patch
cd patch
curl -LO https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.4.tar.xz
xd -d libxml2-2.11.4.tar.xz

then apply this patch to use the local copy instead of trying to fetch it from gitlab:

diff --git a/alienfile b/alienfile
index dcfb4eb..56ce7f2 100644
--- a/alienfile
+++ b/alienfile
@@ -131,19 +131,9 @@ share {
   # off there.  Turn it on elsewhere as it saves a copy.
   meta->prop->{out_of_source} = $^O eq 'MSWin32' ? 0 : 1;
 
-  plugin 'Download::GitLab' => (
-    gitlab_host     => 'https://gitlab.gnome.org',
-    gitlab_user     => 'GNOME',
-    gitlab_project  => 'libxml2',
-    type            => 'link',
-    format          => 'tar.xz',
-    version_from    => 'tag_name',
-    convert_version => sub {
-      my $version = shift;
-      $version =~ s/^v//;
-      $version;
-    },
-  );
+  start_url './patch/libxml2-2.11.4.tar';
+  plugin 'Download';
+  plugin 'Extract';
 
   if($^O eq 'MSWin32' && $Config{ccname} eq 'cl')
   {

Then try installing as normal.

@MarcelVersteeg
Copy link
Author

@plicease Sorry for the late reply, but something else came up inbetween.

I downloaded the file to the patch directory and extracted it, resulting in a file named libxml2-2.11.4.tar. The I applied the patch to the alienfile that is located in the root of the package.

Then I executed dmake again, but it still does not work:

dmake:  makefile:  line 732:  Warning: -- Empty recipe for special or meta target .NOTPARALLEL
dmake:  makefile:  line 734:  Warning: -- Empty recipe for special or meta target .NO_PARALLEL
"D:\Perl64\bin\perl.exe" -MAlien::Build::MM=cmd -e build
Alien::Build::Plugin::PkgConfig::Negotiate> Using PkgConfig plugin: PkgConfig::PP
tried to call extract before download at D:/Perl64/site/lib/Alien/Build.pm line 742.
dmake:  Error code 130, while making '_alien\mm\build'

It says "tried to call extract before download at D:/Perl64/site/lib/Alien/Build.pm line 742."

To make sure, the patch is applied correctly, lines 128-170 of alienfile are as follows now:

share {

  # out of source build is borked on Windows, so we turn it
  # off there.  Turn it on elsewhere as it saves a copy.
  meta->prop->{out_of_source} = $^O eq 'MSWin32' ? 0 : 1;

  start_url './patch/libxml2-2.11.4.tar';
  plugin 'Download';
  plugin 'Extract';

  if($^O eq 'MSWin32' && $Config{ccname} eq 'cl')
  {
    build [
      sub { shift->install_prop->{prefix} =~ s/\//\\/g;},
      'cd win32',
      'cscript configure.js prefix=%{.install.prefix} iconv=no compiler=msvc static=yes',
      'nmake -f Makefile.msvc',
      'nmake -f Makefile.msvc install',
    ];

    plugin 'Gather::IsolateDynamic';

    gather sub {
      my($build) = @_;
      my $prefix = $build->runtime_prop->{prefix};
      $build->runtime_prop->{cflags} = "-I$prefix/include/libxml2";
      $build->runtime_prop->{libs}   = "-L$prefix/lib libxml2_a.lib";
    };
  }
  else
  {
    plugin 'Build::Autoconf' => ();

    build [
      '%{configure} --prefix=%{.install.autoconf_prefix} --without-python --disable-shared --enable-static',
      '%{make}',
      '%{make} install',
    ];

    plugin 'PkgConfig::MakeStatic' => ();
  }

};

@plicease
Copy link
Member

plicease commented Jul 4, 2023

@plicease Sorry for the late reply, but something else came up inbetween.

I downloaded the file to the patch directory and extracted it, resulting in a file named libxml2-2.11.4.tar. The I applied the patch to the alienfile that is located in the root of the package.

Then I executed dmake again, but it still does not work:

dmake:  makefile:  line 732:  Warning: -- Empty recipe for special or meta target .NOTPARALLEL
dmake:  makefile:  line 734:  Warning: -- Empty recipe for special or meta target .NO_PARALLEL
"D:\Perl64\bin\perl.exe" -MAlien::Build::MM=cmd -e build
Alien::Build::Plugin::PkgConfig::Negotiate> Using PkgConfig plugin: PkgConfig::PP
tried to call extract before download at D:/Perl64/site/lib/Alien/Build.pm line 742.
dmake:  Error code 130, while making '_alien\mm\build'

It says "tried to call extract before download at D:/Perl64/site/lib/Alien/Build.pm line 742."

Did you re-use the same Alien-Libxml2 extract from before? if so can you try applying to a fresh copy of Alien-Libxml2?

@MarcelVersteeg
Copy link
Author

@plicease I indeed used the same Alien-Libxml2 when I encountered the error. I unpacked the CPAN archive again, reapplied the patch and then dmake worked.

What I am wondering though, is it correct that I only have a Libxml2.pm and no binary dll after running dmake? It seems that the only binary compilation is required for testing if I look at the dmake output. I need to know this, because I am compiling/installing it locally and then need to transfer the files to the shared hosing server (running the same version of ActivePerl).

@plicease
Copy link
Member

plicease commented Jul 4, 2023

What I am wondering though, is it correct that I only have a Libxml2.pm and no binary dll after running dmake? It seems that the only binary compilation is required for testing if I look at the dmake output. I need to know this, because I am compiling/installing it locally and then need to transfer the files to the shared hosing server (running the same version of ActivePerl).

The libxml2 binaries are installed in a share directory. You can find the path for that share directory using the dist_dir method:

perl -MAlien::Libxml2 -E 'say Alien::Libxml2->dist_dir'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞Bug Something fails that should not (not a feature)
Development

No branches or pull requests

2 participants