【发布时间】:2017-09-16 14:00:29
【问题描述】:
我正在尝试从 cygwin 上的源代码编译 openssl。在 cygwin 中运行时,openssl-1.1.0f 附带的配置脚本似乎在条件“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.
在 Cygwin 上(失败):
$ 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 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
【问题讨论】:
-
您是否尝试在 cygwin 上安装
if模块(即cpan if)? -
@mob
if应该是自 Perl 5.6.2 以来的核心模块。如果找不到if.pm,则说明Perl 安装有问题。 -
perl -e 'use if'打印什么错误信息?如果if模块安装正确,它应该类似于“Too few arguments to 'use if'...”。如果不是,它应该类似于“Can't locate if.pm in @INC (you may need to install the if module)...”。 -
也许可以,但是
ifhas a dual-life 并且重新安装它可能不会有什么坏处。在我尝试重新安装perl之前,它会尝试安装if,至少。 -
对于在 Cygwin 下使用 Perl 运行相同命令的其他人来说,这将是最有用的。
标签: perl cygwin packages package-managers