我在* nix系统(FreeBSD,Linux和Mac)上经常使用几个perl模块。我总是从cpan安装这些。今年早些时候,我需要在64位Windows系统上使用其中的一些工具,并且在大约2个小时内,我安装了当时最新的Strawberry Perl软件包,并从cpan中以相同的方式安装了我想要的模块过去在* nix下执行。一切都按预期进行。
在另一个64位Windows系统上,我现在尝试设置cygwin64环境,而不是安装Strawberry Perl。在该系统上,我们需要一些工具,这些工具在cygwin64下已经可以正常工作,因此,将新的perl功能添加到已经存在的cygwin64环境中似乎是一个好主意。为了在不干扰生产环境的情况下测试这种可能性,我在一个单独的干净Windows系统上执行试错程序。
我下载了当前最新的cygwin64安装程序,可以很好地安装我们过去需要的所有工具。我也可以安装perl5。但是通过“ cpan install”安装模块不起作用。 不幸的是,我并不是真的知道cpan依赖的* nix软件包,因为所有在我的unices上(以及显然在Windows下也有Strawberry Perl),每个依赖项都是自动安装的,而我从来不需要关心它们。 我的cygwin64环境显然错过了cpan运行的构建过程所需的某些软件包。但是cygwin64中的cpan在传达缺失或错误之处方面做得很糟糕。
我尝试使用cygwin安装程序安装clang,gcc,mingw和其他开发人员工具的多个组合,但仍无法正常运行“ cpan install required :: module”。根据我使用的包装混合物,我会得到不同的错误(或错误迹象)。
作为一个相当可靠的起点,您能否给我一份我最应该安装的cygwin软件包列表,以使“ cpan install ...”能够成功运行。
添加#1:
如果我仅安装最基本的cygwin软件包(zsh,perl)以及无论如何都附带的软件包,那么我最终会得到这个...
keve@cygtest ~
$ perl -v
This is perl 5, version 26, subversion 3 (v5.26.3) built for x86_64-cygwin-threads-multi
(with 7 registered patches, see perl -V for more detail)
Copyright 1987-2018, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
keve@cygtest ~
$ curl --version
curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL
Release-Date: [unreleased]
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL
任何make,gmake,cmake,nmake,gcc,clang都会导致“找不到命令”响应。
启动cpan会执行此操作...
$ cpan
Loading internal null logger. Install Log::Log4perl for logging messages
Sorry, we have to rerun the configuration dialog for CPAN.pm due to
some missing parameters. Configuration will be written to
<</home/Valaki/.cpan/CPAN/MyConfig.pm>>
CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.
Would you like to configure as much as possible automatically? [yes]
Use of uninitialized value $what in concatenation (.) or string at /usr/share/perl5/5.26/App/Cpan.pm line 669, <STDIN> line 1.
<install_help>
Warning: You do not have write permission for Perl library directories.
To install modules, you need to configure a local Perl library directory or
escalate your privileges. CPAN can help you by bootstrapping the local::lib
module or by configuring itself to use 'sudo' (if available). You may also
resolve this problem manually if you need to customize your setup.
What approach do you want? (Choose 'local::lib', 'sudo' or 'manual')
[local::lib]
ALERT: 'make' is an essential tool for building perl Modules.
Please make sure you have 'make' (or some equivalent) working.
Press SPACE and ENTER to disable curl
Press SPACE and ENTER to disable curl
Press SPACE and ENTER to disable curl
Press SPACE and ENTER to disable curl
Press SPACE and ENTER to disable curl
Press SPACE and ENTER to disable curl
Press SPACE and ENTER to disable curl
Press SPACE and ENTER to disable curl
Press SPACE and ENTER to disable curl
Press SPACE and ENTER to disable curl
,直到我按Ctrl + C时,“按空格和Enter”行一直填充我的屏幕。
因此,我再次启动Cygwin安装程序,并安装devel / make软件包。这样我就有了...
$ make -v
GNU Make 4.2.1
Built for x86_64-unknown-cygwin
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ cpan
Loading internal null logger. Install Log::Log4perl for logging messages
Sorry, we have to rerun the configuration dialog for CPAN.pm due to
some missing parameters. Configuration will be written to
<</home/Valaki/.cpan/CPAN/MyConfig.pm>>
CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.
Would you like to configure as much as possible automatically? [yes]
Use of uninitialized value $what in concatenation (.) or string at /usr/share/perl5/5.26/App/Cpan.pm line 669, <STDIN> line 1.
<install_help>
Warning: You do not have write permission for Perl library directories.
To install modules, you need to configure a local Perl library directory or
escalate your privileges. CPAN can help you by bootstrapping the local::lib
module or by configuring itself to use 'sudo' (if available). You may also
resolve this problem manually if you need to customize your setup.
What approach do you want? (Choose 'local::lib', 'sudo' or 'manual')
[local::lib]
Press SPACE and ENTER to disable curl
Press SPACE and ENTER to disable curl
Press SPACE and ENTER to disable curl
Press SPACE and ENTER to disable curl
Press SPACE and ENTER to disable curl
Press SPACE and ENTER to disable curl
这次没有关于“ make”缺失的警告,但是同一行“ Press SPACE and ENTER”行填满了屏幕。仍然存在“未初始化的$ what”,以及有关对文件夹没有适当权限的警告。我在其他人的疑问中看到了这一点,通常是通过重新安装最新的perl软件包(我拥有最新的)来解决的。
那么,我想念什么包裹? 还是我通过接受默认值而在上面做出了错误的选择? 请注意:我先前尝试安装了其他开发包。但是,为了使事情现在变得简单,我只有“ perl”和“ make”。
添加#2
按照Håkon和mob的回答,我再次启动cygwin安装程序,并安装了推荐的软件包。所以现在我有了devel / binutils,devel / clang,devel / cmake,devel / gcc-core,devel / gcc-g ++,gccmakedep和make了。还可以使用curl,它已经存在,所以我不需要安装(也许是依赖项)。
不幸的是,我在启动“ cpan”时仍然得到此信息:
$ cpan
Loading internal null logger. Install Log::Log4perl for logging messages
Sorry, we have to rerun the configuration dialog for CPAN.pm due to
some missing parameters. Configuration will be written to
<</home/Valaki/.cpan/CPAN/MyConfig.pm>>
CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.
Would you like to configure as much as possible automatically? [yes]
Use of uninitialized value $what in concatenation (.) or string at /usr/share/perl5/5.26/App/Cpan.pm line 669, <STDIN> line 1.
<install_help>
Warning: You do not have write permission for Perl library directories.
To install modules, you need to configure a local Perl library directory or
escalate your privileges. CPAN can help you by bootstrapping the local::lib
module or by configuring itself to use 'sudo' (if available). You may also
resolve this problem manually if you need to customize your setup.
What approach do you want? (Choose 'local::lib', 'sudo' or 'manual')
[local::lib]
Press SPACE and ENTER to disable curl
Press SPACE and ENTER to disable curl
关于$ what警告: Cpan.pm的660到670行就像这样...
BEGIN {
my $scalar = '';
sub _hook_into_CPANpm_report
{
no warnings 'redefine';
*CPAN::Shell::myprint = sub {
my($self,$what) = @_;
$scalar .= $what;
我可以通过将669行修改为该警告来消除该警告...
$scalar .= ($what // '');
...但这不能解决为什么$ what仍然未定义的问题。但是,我仍然最终看到“按SPACE和ENTER禁用卷曲”填满了屏幕。如果我键入“ manual”并按Enter键而不接受默认的local :: lib选项,也会发生同样的情况。
答案 0 :(得分:2)
根据您的cpan
输出,可以在重新运行cpan
之前尝试使用Cygwin安装程序安装以下附加软件包:
ALERT: 'make' is an essential tool for building perl Modules.
->安装make
软件包。
Press SPACE and ENTER to disable curl
,安装curl
软件包。另外,我认为软件包gcc
和gcc-g++
是许多CPAN模块安装所必需的。然后,可能需要libcrypt-devel
来进行与SSH相关的操作,并且libreadline-devel
很适合在Cygwin终端窗口中调用历史记录。
libgmp-devel
。我会在收到您的反馈时添加更多内容:)答案 1 :(得分:1)
根据我自己的已安装软件包集以及关于在cpan工具链中有用的软件包的内存:
binutils
bzip2
clang
cmake
gcc-core
gcc-g++
gccmakedep
make
curl and/or wget
答案 2 :(得分:1)
事情发生了有趣的转变。我注意到,即使我从一开始就开始使用curl(使用最基本的默认cygwin环境),但从未安装(不是通过cygwin安装程序安装)。
keve@cygtest ~
$ curl --version
curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL
Release-Date: [unreleased]
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL
keve@cygtest ~
$ which curl
/cygdrive/c/Windows/system32/curl
并且有一个curl软件包可用来标记要安装。所以我通过cygwin安装程序安装了Net / curl,然后得到了它。
keve@cygtest ~
$ which curl
/usr/bin/curl
keve@cygtest ~
$ curl --version
curl 7.65.0 (x86_64-pc-cygwin) libcurl/7.65.0 OpenSSL/1.1.1b zlib/1.2.11 brotli/1.0.7 libidn2/2.0.4 libpsl/0.18.0 (+libidn2/2.0.2) libssh/0.8.7/openssl/zlib nghttp2/1.37.0
Release-Date: 2019-05-22
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS brotli Debug GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz Metalink NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP TrackMemory UnixSockets
keve@cygtest ~
$ which -a curl
/usr/bin/curl
/cygdrive/c/Windows/system32/curl
这时,cpan不再打印“按SPACE和ENTER禁用卷曲”消息,而是开始按预期运行。
keve@cygtest ~
$ cpan
Loading internal null logger. Install Log::Log4perl for logging messages
Sorry, we have to rerun the configuration dialog for CPAN.pm due to
some missing parameters. Configuration will be written to
<</home/keve/.cpan/CPAN/MyConfig.pm>>
CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.
Would you like to configure as much as possible automatically? [yes]
Use of uninitialized value $what in concatenation (.) or string at /usr/share/perl5/5.26/App/Cpan.pm line 669, <STDIN> line 1.
<install_help>
Warning: You do not have write permission for Perl library directories.
To install modules, you need to configure a local Perl library directory or
escalate your privileges. CPAN can help you by bootstrapping the local::lib
module or by configuring itself to use 'sudo' (if available). You may also
resolve this problem manually if you need to customize your setup.
What approach do you want? (Choose 'local::lib', 'sudo' or 'manual')
[local::lib]
Autoconfiguration complete.
Attempting to bootstrap local::lib...
Writing /home/keve/.cpan/CPAN/MyConfig.pm for bootstrap...
commit: wrote '/home/keve/.cpan/CPAN/MyConfig.pm'
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/01mailrc.txt.gz
Reading '/home/keve/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with HTTP::Tiny:
http://www.cpan.org/modules/02packages.details.txt.gz
Reading '/home/keve/.cpan/sources/modules/02packages.details.txt.gz'
Database was generated on Sat, 01 Jun 2019 09:17:02 GMT
HTTP::Date not available
.............
New CPAN.pm version (v2.26) available.
[Currently running version is v2.18]
You might want to try
install CPAN
reload cpan
to both upgrade CPAN.pm and run the new version without leaving
the current session.
...............................................................DONE
Fetching with HTTP::Tiny:
http://www.cpan.org/modules/03modlist.data.gz
Reading '/home/keve/.cpan/sources/modules/03modlist.data.gz'
DONE
Writing /home/keve/.cpan/Metadata
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/H/HA/HAARG/local-lib-2.000024.tar.gz
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/H/HA/HAARG/CHECKSUMS
Checksum for /home/keve/.cpan/sources/authors/id/H/HA/HAARG/local-lib-2.000024.tar.gz ok
'YAML' not installed, will not store persistent state
Configuring H/HA/HAARG/local-lib-2.000024.tar.gz with Makefile.PL
Attempting to create directory /home/keve/perl5
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for local::lib
Writing MYMETA.yml and MYMETA.json
HAARG/local-lib-2.000024.tar.gz
/usr/bin/perl Makefile.PL --bootstrap -- OK
Running make for H/HA/HAARG/local-lib-2.000024.tar.gz
cp lib/local/lib.pm blib/lib/local/lib.pm
cp lib/POD2/PT_BR/local/lib.pod blib/lib/POD2/PT_BR/local/lib.pod
cp lib/POD2/DE/local/lib.pod blib/lib/POD2/DE/local/lib.pod
cp lib/lib/core/only.pm blib/lib/lib/core/only.pm
Manifying 4 pod documents
HAARG/local-lib-2.000024.tar.gz
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 "/usr/bin/perl.exe" "-I/home/keve/perl5/lib/perl5" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/bad_variables.t ...... ok
t/carp-mismatch.t ...... ok
t/classmethod.t ........ ok
t/de-dup.t ............. ok
t/lib-core-only.t ...... ok
t/pipeline.t ........... ok
t/shell.t .............. ok
t/stackable.t .......... ok
t/subroutine-in-inc.t .. ok
t/taint-mode.t ......... ok
All tests successful.
Files=10, Tests=172, 29 wallclock secs ( 0.03 usr 0.17 sys + 4.24 cusr 11.30 csys = 15.74 CPU)
Result: PASS
HAARG/local-lib-2.000024.tar.gz
/usr/bin/make test -- OK
Running make install
Manifying 4 pod documents
Installing /home/keve/perl5/lib/perl5/lib/core/only.pm
Installing /home/keve/perl5/lib/perl5/local/lib.pm
Installing /home/keve/perl5/lib/perl5/POD2/DE/local/lib.pod
Installing /home/keve/perl5/lib/perl5/POD2/PT_BR/local/lib.pod
Installing /home/keve/perl5/man/man3/lib.core.only.3pm
Installing /home/keve/perl5/man/man3/local.lib.3pm
Installing /home/keve/perl5/man/man3/POD2.DE.local.lib.3pm
Installing /home/keve/perl5/man/man3/POD2.PT_BR.local.lib.3pm
Appending installation info to /home/keve/perl5/lib/perl5/x86_64-cygwin-threads-multi/perllocal.pod
HAARG/local-lib-2.000024.tar.gz
/usr/bin/make install -- OK
local::lib is installed. You must now add the following environment variables
to your shell configuration files (or registry, if you are on Windows) and
then restart your command line shell and CPAN before installing modules:
PATH="/home/keve/perl5/bin${PATH:+:${PATH}}"; export PATH;
PERL5LIB="/home/keve/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="/home/keve/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"/home/keve/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=/home/keve/perl5"; export PERL_MM_OPT;
Would you like me to append that to /home/keve/.bashrc now? [yes]
commit: wrote '/home/keve/.cpan/CPAN/MyConfig.pm'
You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.
cpan shell -- CPAN exploration and modules installation (v2.18)
Enter 'h' for help.
cpan[1]>
现在,我可以通过通常的“ install required :: package”方法开始构建模块。所以我终于到了我想要去的地方。 有趣的是,我要构建的每个模块都构建失败。但是在狂怒中,它们以我从* nix熟悉的方式失败了。因此,这又是另一天的问题。
要回答我的原始问题:要在cygwin下获得有效的“ cpan”,您必须至少安装这些软件包。 。
最后一个 Net / curl 非常重要。因为基本的cygwin环境确实已经具有功能性curl,但是“ cpan”不适用于该功能。您必须通过cygwin安装程序安装Net / curl软件包。这将消除在运行“ cpan”时填满窗口的“按空格键和ENTER键以禁用卷曲”消息。