Perl";使用if";cygwin中断配置脚本中的语句

Perl";使用if";cygwin中断配置脚本中的语句,perl,cygwin,packages,package-managers,Perl,Cygwin,Packages,Package Managers,我试图从cygwin上的源代码编译openssl。在cygwin中运行时,随附的配置脚本在条件“use if…”包含语句中出现中断 在Linux上(成功): $ perl -v This is perl 5, version 26, subversion 0 (v5.26.0) built for i686-linux-gnu- thread-multi-64int .... $ CC='/usr/bin/gcc -static' ./Configure no-shared no-async

我试图从cygwin上的源代码编译openssl。在cygwin中运行时,随附的配置脚本在条件“use if…”包含语句中出现中断

在Linux上(成功):

$ perl -v

This is perl 5, version 26, subversion 0 (v5.26.0) built for i686-linux-gnu-
thread-multi-64int
....
$ CC='/usr/bin/gcc -static' ./Configure no-shared no-async linux-x86_64
File::Glob::glob() will disappear in perl 5.30. Use File::Glob::bsd_glob() 
instead. at ./Configure line 272.
Configuring OpenSSL version 1.1.0f (0x1010006fL)
    no-asan         [default]  OPENSSL_NO_ASAN
....
Configured for linux-x86_64.
$ perl -v

This is perl 5, version 22, subversion 4 (v5.22.4) built for cygwin-thread-
multi
...
$ CC='/usr/bin/gcc -static' ./Configure no-shared no-async mingw
Can't locate if.pm in @INC (you may need to install the if module) (@INC 
contains: /usr/lib/perl5/site_perl/5.22/x86_64-cygwin-threads 
/usr/lib/perl5/site_perl/5.22 /usr/lib/perl5/vendor_perl/5.22/x86_64-cygwin-
threads /usr/lib/perl5/vendor_perl/5.22 /usr/lib/perl5/5.22/x86_64-cygwin-
threads /usr/lib/perl5/5.22 .) at ./Configure line 17.
BEGIN failed--compilation aborted at ./Configure line 17.

$ head -n 17 Configure
#! /usr/bin/env perl
# -*- mode: perl; -*-
# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the OpenSSL license (the "License").  You may not use
# this file except in compliance with the License.  You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html

##  Configure -- OpenSSL source tree configuration script

use 5.10.0;
use strict;
use File::Basename;
use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
use File::Path qw/mkpath/;
use if $^O ne "VMS", 'File::Glob' => qw/glob/;
在Cygwin上(失败):

$ perl -v

This is perl 5, version 26, subversion 0 (v5.26.0) built for i686-linux-gnu-
thread-multi-64int
....
$ CC='/usr/bin/gcc -static' ./Configure no-shared no-async linux-x86_64
File::Glob::glob() will disappear in perl 5.30. Use File::Glob::bsd_glob() 
instead. at ./Configure line 272.
Configuring OpenSSL version 1.1.0f (0x1010006fL)
    no-asan         [default]  OPENSSL_NO_ASAN
....
Configured for linux-x86_64.
$ perl -v

This is perl 5, version 22, subversion 4 (v5.22.4) built for cygwin-thread-
multi
...
$ CC='/usr/bin/gcc -static' ./Configure no-shared no-async mingw
Can't locate if.pm in @INC (you may need to install the if module) (@INC 
contains: /usr/lib/perl5/site_perl/5.22/x86_64-cygwin-threads 
/usr/lib/perl5/site_perl/5.22 /usr/lib/perl5/vendor_perl/5.22/x86_64-cygwin-
threads /usr/lib/perl5/vendor_perl/5.22 /usr/lib/perl5/5.22/x86_64-cygwin-
threads /usr/lib/perl5/5.22 .) at ./Configure line 17.
BEGIN failed--compilation aborted at ./Configure line 17.

$ head -n 17 Configure
#! /usr/bin/env perl
# -*- mode: perl; -*-
# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the OpenSSL license (the "License").  You may not use
# this file except in compliance with the License.  You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html

##  Configure -- OpenSSL source tree configuration script

use 5.10.0;
use strict;
use File::Basename;
use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
use File::Path qw/mkpath/;
use if $^O ne "VMS", 'File::Glob' => qw/glob/;
替换

use if $^O ne "VMS", 'File::Glob' => qw/glob/;

使脚本成功,直到下一个“use if”语句:

$ head -n 17 Configure
#! /usr/bin/env perl
# -*- mode: perl; -*-
# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the OpenSSL license (the "License").  You may not use
# this file except in compliance with the License.  You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html

##  Configure -- OpenSSL source tree configuration script

use 5.10.0;
use strict;
use File::Basename;
use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
use File::Path qw/mkpath/;
use File::Glob qw/glob/;

$ CC='/usr/bin/gcc -static' ./Configure no-shared no-async mingw
CC='/usr/bin/gcc -static' ./Configure no-shared no-async mingw
Configuring OpenSSL version 1.1.0f (0x1010006fL)
no-asan         [default]  OPENSSL_NO_ASAN
...
no-zlib-dynamic [default]
Configuring for mingw
Warning: failed to load Config_git.pl, something strange about this perl...
Something wrong with this line:
Program fragment delivered error ``Can't locate if.pm in @INC (you may need 
to install the if module) (@INC contains: util 
/usr/lib/perl5/site_perl/5.22/x86_64-cygwin-threads 
/usr/lib/perl5/site_perl/5.22 /usr/lib/perl5/vendor_perl/5.22/x86_64-cygwin-
threads /usr/lib/perl5/vendor_perl/5.22 /usr/lib/perl5/5.22/x86_64-cygwin-
threads /usr/lib/perl5/5.22 .) at /home/tester/socat/build/openssl-
1.1.0f/test/build.info line 296.
at /home/tester/socat/build/openssl-1.1.0f/test/build.info at ./Configure 
line 1616.
如何使cygwin Perl像Linux Perl一样工作?是否有其他方法可以使此配置脚本成功

以下是我安装的模块:

$ perl -E'say for @INC' | xargs ls
ls: cannot access '/usr/lib/perl5/site_perl/5.22/x86_64-cygwin-threads': No such file or directory
ls: cannot access '/usr/lib/perl5/site_perl/5.22': No such file or directory
ls: cannot access '/usr/lib/perl5/vendor_perl/5.22/x86_64-cygwin-threads': No such file or directory
.:
(redacted)

/usr/lib/perl5/5.22:
AutoLoader.pm   Carp.pm      DirHandle.pm  FileHandle.pm  Locale          Params     SelectSaver.pm  Tie            version
AutoSplit.pm    Class        Exporter      FindBin.pm     locale.pm       parent.pm  SelfLoader.pm   Time           version.pm
B               Config       Exporter.pm   Getopt         Math            Parse      strict.pm       unicore        warnings
base.pm         constant.pm  ExtUtils      I18N           Module          PerlIO     Symbol.pm       UNIVERSAL.pm   warnings.pm
bytes.pm        CPAN         feature.pm    integer.pm     overload        PerlIO.pm  Term            utf8.pm        Win32API
bytes_heavy.pl  Digest       fields.pm     IO             overload.pm     Pod        Test            utf8_heavy.pl  x86_64-cygwin-threads
Carp            Digest.pm    File          IPC            overloading.pm  Safe.pm    Text            vars.pm        XSLoader.pm

/usr/lib/perl5/5.22/x86_64-cygwin-threads:
attributes.pm  Config.pm        Data           Encode     Fcntl.pm  IO      List    Opcode.pm  re.pm      Storable.pm  Win32API
auto           Config_heavy.pl  Digest         Encode.pm  File      IO.pm   MIME    PerlIO     Scalar     Time
B.pm           Cwd.pm           DynaLoader.pm  Errno.pm   I18N      lib.pm  mro.pm  POSIX.pm   Socket.pm  Win32.pm

/usr/lib/perl5/vendor_perl/5.22:
CPAN

if.pm
是标准perl包的一部分

$ cygcheck -f /usr/lib/perl5/5.22/if.pm
perl-5.22.4-1
您应该检查软件包是否正确安装

$ cygcheck -c perl
Cygwin Package Information
Package              Version        Status
perl                 5.22.4-1       OK
如果没有,就像看起来的那样,重新安装它

此外,正如您在
setup.ini
中看到的,在setup-
arch
.exe上有3个可用的软件包版本,您应该注意它们的混合

@ perl
sdesc: "Perl programming language interpreter"
...
version: 5.22.4-1
...
[prev]
version: 5.22.3-1
..
[test]
version: 5.24.1-1
当前版本是
5.22.4-1
5.24.1-1
是供将来可能使用的测试版本。由于您显然不需要
测试
版本,只需使用当前稳定的
5.22.4-1

混用对您不利…

解决方案:安装了错误版本的
perl
软件包。

问题是由于未选择
perl\u base
package造成的

指示症状:

$ perl -v

This is perl 5, version 22, subversion 4 (v5.22.4) built for cygwin-
thread-multi
通过手动选择perl_基本包解决了此问题。然后,Perl升级到v5.24.1,并在
@INC
中包含
if.pm
模块:

溶液指示: $perl-v

This is perl 5, version 24, subversion 1 (v5.24.1) built for x86_64-cygwin-
threads-multi

安装
perl_base
包后,在没有
的情况下完成的配置脚本无法在@INC
错误中找到if.pm

您是否尝试在cygwin上安装
if
模块(即
cpan if
)?@mob
if
应该是自Perl 5.6.2以来的核心模块。如果找不到
If.pm
,则说明Perl安装有问题。Perl-e'use If'打印什么错误消息?如果
If
模块安装正确,它应该类似于“
参数太少,无法“使用If”
…”。如果不是,它应该类似于“
在@INC中找不到If.pm(您可能需要安装If模块)
…”。可能是这样,但是再次安装它可能不会有什么坏处。至少在我尝试重新安装
perl
之前,它会尝试安装
if
。对于在Cygwin下使用perl的其他人来说,运行相同的命令将非常有用。我希望我能找到一个命令来重新安装包
cygwin-setup-x86_64.exe-q-P perl-5.22.4-1
如果包已经安装,则不会执行任何操作。当我安装
perl_base
时,问题就消失了。我在答复中提供了全部细节。谢谢@femtoban,不,是当你像matzeri建议的那样重新安装
perl
(“perl然后升级到v5.24.1”)。不,是重新安装
perl
包(“perl然后升级到v5.24.1”)修复了它,就像matzeri回答的那样。您只是使用了一种复杂的方法来实现这一点。我不确定仅仅选择较新版本的
perl
包是否就能解决这个问题。似乎安装了一个没有相应的
perl_base
包的
perl
版本。手动选择
perl\u base
后,会自动选择较新的
perl
,问题得到解决。看起来很迂腐,但是如果仅仅升级
perl
并不能解决他们的问题,那么其他遇到同样问题的人可能会感到困惑。如果你说“我不确定仅仅选择较新版本的perl包是否就能解决问题”,你的说法完全是颠倒的
perl_base
与此无关。缺少的文件(
if.pm
)是由
perl
提供的,而不是
perl\u base
。因此,当然,重新安装/升级
perl
将解决您的问题。