perl - Strawberry Perl v5.30.0 无法安装 Tcl (Windows 10)

标签 perl tcl cpan strawberry-perl tclsh

我从 strawberryperl.com 下载并安装了 strawberry-perl-5.30.0.1-64bit.msi在我的 Windows 10 上并尝试使用 cpan 安装 Tcl 模块,但由于缺少 tclsh 而失败。可能是什么问题?

C:\Strawberry>cpan Tcl
Loading internal logger. Log::Log4perl recommended for better logging
CPAN: CPAN::SQLite loaded ok (v0.217)
Database was generated on Thu, 24 Oct 2019 12:40:15 GMT
Running install for module 'Tcl'
CPAN: Digest::SHA loaded ok (v6.02)
CPAN: Compress::Zlib loaded ok (v2.086)
Checksum for C:\STRAWB~1\cpan\sources\authors\id\V\VK\VKON\Tcl-1.27.tar.gz ok
CPAN: Archive::Tar loaded ok (v2.32)
CPAN: YAML::XS loaded ok (v0.78)
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v2.150010)
CPAN: CPAN::Meta loaded ok (v2.150010)
CPAN: Module::CoreList loaded ok (v5.20190522)
Configuring V/VK/VKON/Tcl-1.27.tar.gz with Makefile.PL
'tclsh' is not recognized as an internal or external command,
operable program or batch file.
error starting tclsh: $?=256; $!=
No 'Makefile' created  VKON/Tcl-1.27.tar.gz
  C:\Strawberry\perl\bin\perl.exe Makefile.PL -- NOT OK
Stopping: 'install' failed for 'Tcl'.

C:\Strawberry>dir C:\Strawberry\cpan\build\Tcl-1.27-0
 Volume in drive C is OSDisk
 Volume Serial Number is BCC0-703E

 Directory of C:\Strawberry\cpan\build\Tcl-1.27-0

25.10.2019  13.05    <DIR>          .
25.10.2019  13.05    <DIR>          ..
14.07.2018  11.00             5 207 Changes
22.08.2018  11.21            10 139 Makefile.PL
22.08.2018  11.45             1 723 MANIFEST
22.08.2018  11.45             1 140 META.json
22.08.2018  11.44               617 META.yml
14.07.2018  20.26             1 246 README
25.10.2019  13.05    <DIR>          t
25.10.2019  13.05    <DIR>          tcl-core
22.08.2018  11.43            43 540 Tcl.pm
22.08.2018  10.57            46 049 Tcl.xs
16.06.2018  15.18               439 tclcfg.tcl
16.06.2018  15.18                48 typemap
              10 File(s)        110 148 bytes
               4 Dir(s)  316 953 681 920 bytes free

最佳答案

您可以通过从 https://prdownloads.sourceforge.net/tcl/tcl8420-src.zip 下载源代码来构建缺少的依赖项 tclsh .要编译源代码,您需要一个 C 编译器。我尝试了 visual studio 的社区版: https://visualstudio.microsoft.com/vs/

  • 点击下载社区版..

  • 然后选择安装什么

  • 然后点击“安装”

安装完成后,进入菜单“工具->命令行->开发者命令提示符”并运行

nmake -f makefile.vc

来自提取的 Tcl 源代码分发的 win 子文件夹(在我的计算机上它位于 C:\Users\Bruker\tcl\tcl8.4.20\win )

上面的 nmake 命令创建了一个新文件夹 Release_VC13,其中包含一个可执行文件 tclsh84.exe。请注意,可执行文件的名称不是 tclsh.exe

现在将可执行文件的文件夹添加到系统 PATH 环境变量中: C:\Users\Bruker\tcl\tcl8.4.20\win\Release_VC13,然后关闭命令提示符并再次重新打开以刷新路径设置。

尝试键入 tclsh84,您应该会得到一个带有前导 % 提示符的 tcl shell 命令提示符。然后键入 exit 退出 tcl shell。

下一个问题是使用 Strawberry perl 安装 Tcl 模块。首先尝试运行:

> cpan Tcl
[...]
'tclsh' is not recognized as an internal or external command,
operable program or batch file.
error starting tclsh: $?=256; $!=
No 'Makefile' created  VKON/Tcl-1.27.tar.gz
  C:\Strawberry\perl\bin\perl.exe Makefile.PL -- NOT OK
Stopping: 'install' failed for 'Tcl'.

问题在于可执行文件的名称不是tclsh,而是tclsh84(见上文)。

我做的下一件事是下载 Tcl 模块的源代码分发:

> cpan -g Tcl

然后解压下载的文件Tcl-1.27.tar.gz并切换到源码分发目录。通过检查 Makefile.PL,我发现 Makefile.PL 接受了一个命令行参数 --tclsh,它给出了 tcl shell 的名称命令。所以我尝试了:

> perl Makefile.PL --tclsh=tclsh84

现在效果很好。然后我尝试使用 gmake(Strawberry Perl 发行版附带)进行编译:

> gmake

这也有效,但运行 gmake test 失败,并且安装和测试模块:

> gmake install  
> perl -MTcl -e1
failed dlopen(C:/Users/Bruker/tcl/tcl8.4.20/win/Release_VC13/tcl84.dll,...);
failed dlopen(./tcl84.dll,...);
failed dlopen(tcl84.dll,...);
trying dlopen(tcl89.dll,...)
trying dlopen(tcl88.dll,...)
trying dlopen(tcl87.dll,...)
trying dlopen(tcl86.dll,...)
trying dlopen(tcl85.dll,...)
trying dlopen(tcl84.dll,...)
trying dlopen(tcl83.dll,...)
trying dlopen(tcl82.dll,...)
trying dlopen(tcl81.dll,...)
trying dlopen(tcl80.dll,...)
failed all posible tcl vers 8.x from 9 down to 0 at C:/Strawberry/perl/lib/XSLoader.pm line 111.
Failed to load Tcl dll! at C:/Strawberry/perl/lib/XSLoader.pm line 111.
Unable to initialize Tcl at C:/Strawberry/perl/lib/XSLoader.pm line 111.
Compilation failed in require.
BEGIN failed--compilation aborted.

我计划稍后再回到这个问题并进一步调查。

关于perl - Strawberry Perl v5.30.0 无法安装 Tcl (Windows 10),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58556585/

相关文章:

html - 在我的 Perl CGI 脚本中打印 HTML 之后我该做什么?

linux - (清理中)在全局销毁期间无法在未定义的值 Object/InsideOut.pm 行 1953 上调用方法 "FETCH"

sql - 检查查询是否已完成

macos - 如何告诉 cpanm Image::Magick 有关 header 位置的信息?

java - 有没有像 Perl 的 CPAN 这样的集中式 Java 库存储库?

perl - Devel::Cover 和 ModPerl::Registry 没有覆盖运行时

tcl:如何确定模块命令的 shell

colors - 在 Tcl 中操纵颜色

format - 使用格式时 Tcl 中的命令名称无效

perl - 发行版中的每个 Perl 模块都需要有版本号吗?