3

我在 Windows 10 上从草莓perl.com 下载并安装了草莓-perl-5.30.0.1-64bit.msi,并尝试使用 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
4

1 回答 1

0

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

  • 点击下载社区版..

  • 然后选择安装什么

  • 然后点击“安装”

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

nmake -f makefile.vc

win提取的 Tcl 源代码分发的子文件夹中(在我的计算机上它位于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,然后关闭命令提示符并再次重新打开以刷新路径设置。

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

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

> 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(草莓 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.

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

于 2019-10-31T06:52:37.440 回答