PerlAlien / Alien-Build

Build external dependencies for use in CPAN
16 stars 25 forks source link

Test t/alien_build_util.t fails fails on Windows 10, MSYS2 #213

Open hakonhagland opened 4 years ago

hakonhagland commented 4 years ago

System info: Windows 10, MSYS2, perl version 5.32.0.

$ make test
PERL_DL_NONLAZY=1 "/usr/bin/perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00_diag.t .......................................... 1/? #
#
#
# HARNESS_ACTIVE=1
# HARNESS_VERSION=3.42
# LANG=en_US.UTF-8
# PERL5LIB=/home/hakon/perl/cpan-source/debug/Alien-Build-2.26/blib/lib:/home/hakon/perl/cpan-source/debug/Alien-Build-2.26/blib/arch
# PERL_DL_NONLAZY=1
# PERL_USE_UNSAFE_INC=1
# SHELL=/usr/bin/bash
#
#
#
# PERL5LIB path
# /home/hakon/perl/cpan-source/debug/Alien-Build-2.26/blib/lib
# /home/hakon/perl/cpan-source/debug/Alien-Build-2.26/blib/arch
#
#
#
# perl                     5.032000
# Acme::Alien::DontPanic   -
# Alien::Base::ModuleBuild -
# Alien::Libbz2            -
# Alien::cmake3            -
# Alien::gzip              -
# Alien::xz                -
# Archive::Tar             2.36
# Archive::Zip             -
# Capture::Tiny            0.48
# Devel::Hide              -
# Env::ShellWords          -
# ExtUtils::CBuilder       0.280234
# ExtUtils::MakeMaker      7.44
# ExtUtils::ParseXS        3.40
# FFI::CheckLib            0.27
# FFI::Platypus            -
# File::Listing            6.04
# File::Listing::Ftpcopy   -
# File::Which              1.23
# File::chdir              0.1010
# HTML::Parser             3.72
# HTTP::Tiny               0.076
# IO::Compress::Bzip2      2.093
# IO::Socket::SSL          2.068
# IO::Uncompress::Bunzip2  2.093
# IO::Zlib                 1.10
# JSON::PP                 4.04
# LWP                      6.46
# LWP::Protocol::https     6.09
# List::Util               1.55
# Mojo::DOM58              -
# Mojolicious              -
# Net::FTP                 3.11
# Net::SSLeay              1.89_01
# Path::Tiny               0.114
# PkgConfig                0.23026
# PkgConfig::LibPkgConf    -
# Readonly                 -
# Sort::Versions           1.62
# Test2::API               1.302175
# Test2::V0                0.000130
# Text::ParseWords         3.30
# URI                      1.76
# YAML                     -
#
#
#
# $VAR1 = {
#           'cmake_generator' => 'Unix Makefiles',
#           'system_type' => 'unix',
#           'pkg-config' => {
#                             'pkg-config' => '/usr/bin/pkg-config',
#                             'pkgconf' => undef
#                           },
#           'compiler_type' => 'unix'
#         };
# pkg-config negotiate pick = PkgConfig::CommandLine
#
#
# [config.site]
# # file automatically generated by /home/hakon/perl/cpan-source/debug/Alien-Build-2.26/blib/lib/Alien/Build/Plugin/Build/Autoconf.pm
# libdir='${prefix}/lib'
#
#
#
t/00_diag.t .......................................... ok
t/01_use.t ........................................... ok
t/alien_base.t ....................................... ok
t/alien_base__system_installed.t ..................... skipped: test requires Alien::Base::ModuleBuild
t/alien_base_pkgconfig.t ............................. ok
t/alien_base_wrapper.t ............................... ok
t/alien_build.t ...................................... ok
[...]
t/alien_build_plugin_test_mock.t ..................... ok
t/alien_build_rc.t ................................... ok
t/alien_build_temp.t ................................. ok
t/alien_build_tempdir.t .............................. ok
t/alien_build_util.t ................................. 1/?
# Failed test 'mirror'
# at t/alien_build_util.t line 84.
# Caught exception in subtest: unable to symlink libfoo.so.1.2.3 => /tmp/mirror_dst_nnDo/lib/libfoo.so at /home/hakon/perl/cpan-source/debug/Alien-Build-2.26/blib/lib/Alien/Build/Util.pm line 63.
t/alien_build_util.t ................................. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/5 subtests
t/alien_build_version_basic.t ........................ ok
t/alien_role.t ....................................... ok
t/alienfile.t ........................................ ok
[...]
hakonhagland commented 4 years ago

I believe this failure is caused by line 76 in Alien::Build::Util:

        my $target = readlink "$src"; 

If $src is /tmp/mirror_src_aCM0/lib/libfoo.so, readlink returns libfoo.so.1.2.3. Note that the prefix /tmp/mirror_src_aCM0/lib is missing. So later on line 78:

 symlink($target, $dst) || die "unable to symlink $target => $dst";

Tries to symlink libfoo.so.1.2.3 to /tmp/mirror_dest_aCM0/lib/libfoo.so.1.2.3 which will create a broken symlink on linux, but will fail on MSYS2.