sclite(SCTK)`make check`故障,C ++/perl/Cygwin,可以安全使用Perl4的东西吗? [英] sclite (SCTK) `make check` faliure, C++/perl/Cygwin, Safe to use Perl4 stuff?

查看:233
本文介绍了sclite(SCTK)`make check`故障,C ++/perl/Cygwin,可以安全使用Perl4的东西吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在尝试安装NIST的sclite,它是SCTK 2.4.0的一部分( github 更新的版本).我正在尝试在bash中的Cygwin上进行安装.使用make完成安装.

I am currently trying to install NIST's sclite, which is part of SCTK 2.4.0 (github or newer version). I am attempting the install on Cygwin in bash. The installation is done using make.

我已经跳过了安装的make configuremake all部分.这并非没有付出任何努力(请参见第一(file not recognized)和

I have gotten past the make configure and make all parts of the installation. This didn't come without some effort (See the SO posts on the first (file not recognized) and second (template/scoping) problems). When I get to the make check part of the install, a lot of the checks/tests pass, but then I get the following error.

Testing acomp.pl
   No tests defined for acomp.pl
make[2]: Leaving directory '/cygdrive/c/David/programs/sctk2.4.0/sctk/src/acomp'
(cd def_art; make check)
make[2]: Entering directory '/cygdrive/c/David/programs/sctk2.4.0/sctk/src/def_art'
Testing def_art.pl
   def_art.pl passed without tests
make[2]: Leaving directory '/cygdrive/c/David/programs/sctk2.4.0/sctk/src/def_art'
(cd hubscr; make check)
make[2]: Entering directory '/cygdrive/c/David/programs/sctk2.4.0/sctk/src/hubscr'
Testing hubscr.pl
./RunTests.pl
   Running test 'test1-sastt', operation 'test', options '-G -f rttm -F rttm -a', directory 'test1-sastt.test'
      Executing command
Error: unable to get the version for program def_art.pl with the command 'def_art.pl' at ../hubscr.pl line 419.
Error: Execution failed at ./RunTests.pl line 30.
make[2]: *** [makefile:20: check] Error 2
make[2]: Leaving directory '/cygdrive/c/David/programs/sctk2.4.0/sctk/src/hubscr'
make[1]: *** [makefile:68: checkFast] Error 2
make[1]: Leaving directory '/cygdrive/c/David/programs/sctk2.4.0/sctk/src'
make: *** [makefile:52: check] Error 2

我已经做了一些研究(如下所述),并且已经能够克服这个问题.但是,这涉及包括一些过时的perl模块(Perl4).

I've done some research (described below), and I've been able to get past this problem. However, this involved including some outdated perl modules (Perl4).

我的第一个问题是如何解决此错误或如何跳过测试的那部分.我已经能够解决该错误,并且如果人们认为它是安全的,我将其作为答案.请注意,在解决此问题之后,make check还有另一个问题,但是我最后提到如何克服该问题.

My first question was how to fix this error or how to skip that part of the test. I've been able to fix the error, and if people think that it's safe, I'll put it as an answer. Note that there is one more problem with make check after this problem is fixed, but I mention how to get past that at the end.

我想知道使用旧的Perl(Perl4::CoreLibs)是否安全和/或良好的编程习惯.更改源代码以使用Perl5更好吗?

I'm wondering if using the old Perl (Perl4::CoreLibs) is safe and/or good programming practice. Would it be better to change the source code to use Perl5 stuff?

是否有更好的方法?

我想确定的一件事是,在make check行下没有可能会失败的关键测试.

One thing I want to be sure of is that there are no critical tests further down the make check line which might fail.

$ uname -a
CYGWIN_NT-6.1 CAP-D-ENG-INT3 2.10.0(0.325/5/3) 2018-02-02 15:16 x86_64 Cygwin
$ bash --version
GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin) ...
$ gcc --version
gcc (GCC) 6.4.0 ...
$ g++ --version
g++ (GCC) 6.4.0 ...
$ make --version
GNU Make 4.2.1
Built for x86_64-unknown-cygwin ...
$ systeminfo | sed -n 's/^OS\ *//p'
Name:                   Microsoft Windows 7 Enterprise
Version:                6.1.7601 Service Pack 1 Build 7601
Manufacturer:           Microsoft Corporation
Configuration:          Member Workstation
Build Type:             Multiprocessor Free


我的尝试/研究

在上面的输出中,我们让def_art.pl通过了检查,因为没有检查-"def_art.pl passed without tests".但是,下一个检查的hubscr.pl失败.错误来自def_art.pl.


My Attempts/Research

From the output above, we have def_art.pl passing the check because there are no checks - "def_art.pl passed without tests". However, the next thing checked, hubscr.pl, failed. The error comes from def_art.pl.

要做的显而易见的事情似乎是运行def_art.pl

The obvious thing to do seemed to be to run def_art.pl, which I did.

$ ./src/def_art/def_art.pl
Can't locate getopts.pl in @INC 
(@INC contains: /usr/local/lib/perl5/site_perl/5.26/x86_64-cygwin-threads /usr/local/share/perl5/site_perl/5.26 /usr/lib/perl5/vendor_perl/5.26/x86_64-cygwin-threads /usr/share/perl5/vendor_perl/5.26 /usr/lib/perl5/5.26/x86_64-cygwin-threads /usr/share/perl5/5.26) 
at ./src/def_art/def_art.pl line 40.

所以在我看来,这是一个已弃用的perl文件(或模块,或其他).

So it seems to me that this is a deprecated perl file (or module, or whatever).

我进一步挖掘,发现此讨论在2014年的kaldi讨论中.(kaldi是使用SCTK评分系统的语音识别工具包).我认为讨论中有3个部分特别相关,我将链接这些部分(第二第三).我将在这里插入零件:

I dug a little further and found this discussion on a kaldi discussion from 2014. (kaldi is a speech-recognition toolkit that uses the SCTK scoring system). There are 3 sections of the discussion that I think are especially relevant, which I will link (first, second, third). I'll insert parts here:

def_art.pl正在寻找在计算机上找不到的getopts.pl

def_art.pl is looking for getopts.pl which I coudn't find on my machine!

... [T] hese是旧版软件包,最近版本不再支持 Perl5.我不认为我们应该接受对它们的依赖.他们有 从Perl 5开始就不推荐使用. 而不是'require"getopt.pl",我们应该这样做 use Getopt::Std (注意:对于系统软件包,现代perl代码不应调用"require"). 在Perl脚本中,"flush.pl"也存在类似的问题.我不知道 Perl 5软件包的名称是什么. ...在几个地方会发生这种情况.

... [T]hese are legacy packages that are no longer supported in recent versions of Perl 5. I don't think we should accept a dependency on them. They have been deprecated since the beginning of Perl 5. Instead of 'require "getopt.pl"', we should be doing use Getopt::Std (note: modern perl code should not call "require" for system packages). There is a similar issue with "flush.pl" in the Perl scripts. I don't know what the Perl 5 package name is. ... There are several places where this occurs.

我终于发现getopts.plflush.pl都可以从 Perl4::CoreLibs .本站点引用了我用于wget的URL.显然,在其他*NIX发行版中,可以使用程序包管理器,例如

I finally found that both getopts.pl and flush.pl are available from Perl4::CoreLibs. The URL that I use for wget was referenced at this site. Apparently, in other *NIX distros, the package manager can be used, e.g.

apt-get install libperl4-corelibs-perl

yum install perl-Perl4-CoreLibs

,但是我找不到通过apt-cyg进行的安装.如我在做什么部分所述,我可以从tarball安装它们.

but I could not find an install via apt-cyg. I was able to install them from a tarball, as described in the What I'm Doing section.

再说一次我的主要问题:这是安全/良好的编程习惯吗?有更好的解决方案吗?

One again, I'll state my main question: Is this safe/good programming practice? Is there a better solution?

如果有更好的解决方案(使用Perl 5),则似乎此链接可能会引领潮流.

If there is a better solution (using Perl 5), it seems that this link might lead the way to it.

一些可能相关的其他链接: link_ {n} 和<关于flush.pl链接{n + 1} /224716>链接_ {n + 2} &关于getopts.plPerl4::CoreLibs链接_ {n + 3} .

Some other links that are possibly related: link_{n} and link{n+1} about flush.pl, link_{n+2} & link_{n+3} about getopts.pl and Perl4::CoreLibs.

$ mkdir perl_added

$ cd perl_added

$ wget http://search.cpan.org/CPAN/authors/id/Z/ZE/ZEFRAM/Perl4-CoreLibs-0.004.tar.gz

$ tar -xzf Perl4-CoreLibs-0.004.tar.gz  

$ cd Perl4-CoreLibs-0.004

我没有使用一次性命令行,环境变量添加内容将此目录的lib子目录添加到PERLLIB环境变量,而是执行了以下操作.

Rather than adding this directory's lib subdirectory to the PERLLIB environment variable with a one-time command-line, environment-variable-addition thing, I did the following.

/usr/lib目录中新建一个目录,然后将文件移至该位置

Make a new directory in the /usr/lib directory, move the files there

$ stat /usr/lib/libperl4-corelibs-perl
stat: cannot stat '/usr/lib/libperl4-corelibs-perl': No such file or directory
# Checked that the directory didn't already exist. It didn't exist.

$ mkdir /usr/lib/libperl4-corelibs-perl

# Make each file executable, then move it into the new directory
# I'd like to come back and explain this.
$ find ./lib -type f -name "*.pl" -print0 | xargs -I'{}' -0 \
bash -c 'new_dir=/usr/lib/libperl4-corelibs-perl/; chmod +x {}; \
mv {} ${new_dir}'

最后,我做到了,这样每次我使用终端时,通过将以下行添加到我的~/.bashrc中,此目录将成为perl搜索路径的一部分. 此命令将路径添加到PERLLIB环境变量.不同版本的Linux在添加到环境变量时使用不同的语法,请确保找出您所用的内容!

Finally, I made it so that this directory will become part of the perl search path every time I use a terminal by adding the following line to my ~/.bashrc This command adds the path to the PERLLIB environment variable. Different flavors of Linux have different syntax for adding to environment variables, make sure to find out what yours is!

export PERLLIB="/usr/bin/libperl4-corelibs-perl:$PERLLIB"

为此我运行的命令是

$ echo -e "\n\n## Allow Perl to use the files in Perl4::CoreLibs" >> $HOME/.bashrc

$ echo -e "export PERLLIB=\"/usr/lib/libperl4_corelibs_perl:$PERLLIB\"" >> $HOME/.bashrc

$ source $HOME/.bashrc

(感谢@melpomene指出当前版本为0.004,而不是0.003.)

(Thanks to @melpomene for noting that the current version is 0.004, not 0.003.)

之后,我回到安装的基本文件夹并运行make cleanmake configmake allmake check.

After that, I went back to the base folder of the install and ran make clean, make config, make all, and make check.

那确实使我在make check中走得更远,但不是很远.

That did get me farther in the make check but not by far.

我想知道使用旧的Perl(Perl4 :: CoreLibs)是否安全和/或良好的编程习惯.更改源代码以使用Perl5更好吗?

P.S.完成所有这些操作后,您可能想返回并删除解压缩所有内容的文件夹.就我而言:

P.S. After all this, you probably want to go back and delete the folder where you untarred everything. In my case:

rm -rf /path/to/where/I/started/perl_added


结果/后续步骤

一堆通过的测试,然后


The Result/Next Steps

A bunch of tests that passed and then

(cd hubscr; make check)
make[2]: Entering directory '/cygdrive/c/David/programs/sctk2.4.0/sctk/src/hubscr'
Testing hubscr.pl
./RunTests.pl
   Running test 'test1-sastt', operation 'test', options '-G -f rttm -F rttm -a', directory 'test1-sastt.test'
      Executing command
Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/{_recursive_/_recur_{ <-- HERE _sive_/_si_ve_}_}/ at ../../md-eval/md-eval.pl line 1099, <DATA> line 12.
Error: MDEVAL failed
      Command: md-eval.pl -nafcs -c 0.25 -o  -r sastt-case1.ref.rttm.filt -s sastt-case1.sys.rttm.filt -M sastt-case1.sys.rttm.filt.mdeval.spkrmap 1> sastt-case1.sys.rttm.filt.mdeval at ../hubscr.pl line 679.
Error: Execution failed at ./RunTests.pl line 30.
make[2]: *** [makefile:20: check] Error 255
make[2]: Leaving directory '/cygdrive/c/David/programs/sctk2.4.0/sctk/src/hubscr'
make[1]: *** [makefile:68: checkFast] Error 2
make[1]: Leaving directory '/cygdrive/c/David/programs/sctk2.4.0/sctk/src'
make: *** [makefile:52: check] Error 2

也许会有所帮助.我将针对此问题发布一个单独的问题,或者,如果解决方案很快,我将在该帖子上添加解决方案.

Maybe this will be helpful. I will post a separate question for this issue or, if the solution is quick, I will add the solution on this post.

推荐答案

更好的方法

(实际上,有几种更好的方法.请参阅我在问题下的评论,以获取kaldi解决方案.)

在与同事和朋友交谈时,似乎对Perl4并没有什么不安全的地方.我确实找到了一种更好的方式来安装"它们,但是我将把注释留在问题中,以显示tarball,PERLPATH等的很长距离".

In talking with colleagues and friends, it seems that there isn't anything unsafe about the Perl4 stuff. I did find a better way to get them "installed", but I'll leave the notes in the question showing the "long way" with the tarball, PERLPATH, etc.

检查您是否拥有CPAN

$ which cpan

如果看到以which: no cpan in (...)开头的内容,则很可能没有.尝试安装perl.对我来说,在Cygwin上,我用过

If you see something starting with which: no cpan in (...), you most likely don't have it. Try installing perl. For me, on Cygwin, I used

$ apt-cyg install perl

(如果需要,请安装apt-cyg,请参见此处以获取说明.)

(Install apt-cyg if necessary, cf. here for instructions.)

您可能不必安装Perl.您可能会在which cpan的输出中看到类似/usr/bin/cpan的内容.如果是这样,那你就很好.在命令提示符下输入cpan.

You probably won't have to install Perl. You will likely see something like /usr/bin/cpan as the output of which cpan. If so, you're good. Enter cpan at the command prompt.

$ cpan

这是您的第一次,它将询问有关配置的一系列问题.每次我都按"Enter"键接受默认值,最后我得到如下提示:

If it's your first time, it will ask a bunch of questions about the configuration. I just pressed "Enter" to accept the default each time, I finally got a prompt like this:

cpan shell -- CPAN exploration and modules installation (v2.18)
Enter 'h' for help.

cpan[1]> 

在那里,我进入了

cpan[1]> install Perl4::CoreLibs

将继续安装.完成后,您将能够键入exit并按"Enter",这将带您回到bash命令提示符.

The install will proceed. When it will have finished, you will be able to type exit and press "Enter", which will take you back to the bash command prompt.

cpan[2]> exit
Lockfile removed.

$

这时,make check仍会阻塞,但安装将成功完成.如果您希望make check贯穿始终,请转到下面的"通过make check "部分.不过,此时您可以执行该过程的最后两个步骤.

At this point, make check will still choke, but the install will complete successfully. If you want the make check to get all the way through, go to the "Getting past make check" section below. At this point, though, you can do the last two steps in the process.

$ make install

这时,我将安装路径添加到了PATH变量中.希望我能够加入有关该过程的链接. 此处是一次性解决方案.

At this point I added the install path to my PATH variable. Hopefully, I'll be able to put in a link about that process. Here is a one-time solution.

$ export PATH=/path/to/sctk/bin:$PATH

这里是一种持久的解决方案.

Here is a lasting solution.

现在,对于安装过程的最后一步:

Now, for the last step in the installation process:

$ make doc

make doc之后,我确保man页面可用.我看了看我的机器,直到找到其他man文件所在的地方. (对不起,我没有系统的方法,只是在很多地方查看.)对我而言,在Cygwin上,目录为/usr/man/man1

After the make doc, I made sure that the man pages were available. I looked on my machine until I found the place where other man files went. (Sorry, I don't have a systematic way of doing it, I just looked in a lot of places.) For me, on Cygwin, the directory was /usr/man/man1

我进入了doc目录

cd doc

并将所有文件复制到我找到的目录中

and copied all of the files into the directory I had found

cp -r ./* /usr/man/man1/

请注意,目录中现在还提供了htmlhtm文件,也提供了文档.

Note that there are also now html and htm files in the directory that also provide documentation.

因此,您真的希望看到它顺利进行.您需要更改以下文件:src/hubscr/RunTests.pl

So, you really want to see it go through without errors. You need to change the following file: src/hubscr/RunTests.pl

最初它具有以下开头,我已使用head命令进行了显示.

Originally it has the following beginning, which I have used the head command to show.

$ head -n 15 src/hubscr/RunTests.pl
#!/usr/bin/perl -w
use strict;
my $operation = (defined($ARGV[0]) ? $ARGV[0] : "test");
sub runIt{
my ($op, $testId, $options, $glm, $hub, $lang, $ref, $systems) = @_;
my $baseDir = $testId.".base";
my $outDir = $testId.($op eq "setTests" ? ".base" : ".test");
print " Running test '$testId', operation '$op', options '$options', 
directory '$outDir'\n";
system ("mkdir -p $outDir");
system ("rm -fr $outDir/test* $outDir/lvc*");
### Copy files
foreach my $file($glm, $ref, split(/\s+/,$systems)){
    system("cp $file $outDir");

对其进行更改,以使在print命令之后,您具有如下新行.我再次使用head命令显示文件的开头

Change it so that, after the print command, you have new lines as follows. I again use the head command to show the beginning of the file

$ head -n 63 src/hubscr/RunTests.pl
#!/usr/bin/perl -w

use strict;
my $operation = (defined($ARGV[0]) ? $ARGV[0] : "test");

sub runIt{
    my ($op, $testId, $options, $glm, $hub, $lang, $ref, $systems) = @_;
    my $baseDir = $testId.".base";
    my $outDir = $testId.($op eq "setTests" ? ".base" : ".test");

    print "   Running test '$testId', operation '$op', options '$options', directory '$outDir'\n";

    ####DWB, 2018-05-21 Getting `make check` to work####
    if ( $testId eq "test1-sastt" &&
         $operation eq "test" &&
         $options eq "-G -f rttm -F rttm -a" &&
         $outDir eq "test1-sastt.test" ) # <problem 1>
    {
        print "\n";
        print "\n#### SKIPPING ####";
        print "\nJust kidding. That breaks the make.";
        print "\nIt said: \n\n";
        print "\nUnescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/{_recursive_/_recur_{ <-- HERE _sive_/_si_ve_}_}/ at ../../md-eval/md-eval.pl line 1099, <DATA> line 12.";
        print "\nrror: MDEVAL failed";
        print "\nCommand: md-eval.pl -nafcs -c 0.25 -o  -r sastt-case1.ref.rttm.filt -s sastt-case1.sys.rttm.filt -M sastt-case1.sys.rttm.filt.mdeval.spkrmap 1> sastt-case1.sys.rttm.filt.mdeval at ../hubscr.pl line 679.";
        print "\nError: Execution failed at ./RunTests.pl line 30.\n\n";
        print "\n"
        print "\nThat's a perl legacy problem, see:"
        print "\n[https://unix.stackexchange.com/a/375505/291375][1]"
        print "\nI'm outta here.";
        print "\n   Sincerely, bballdave025";
        print "\n";
        print "\n";

        return;

    }#endof:  if (<problem 1>)

    if ( $testId eq "test2-sastt" &&
         $operation eq "test" &&
         $options eq "-G -f rttm -F rttm -a" &&
         $outDir eq "test2-sastt.test" ) # <problem 2>
    {
        print "\n";
        print "\n#### SKIPPING ####";
        print "\nJust kidding. That breaks the make.";
        print "\nIt said: \n\n";
        print "\nError: Test test2-sastt has failed.  Diff output is :";
        print "\ndiff -i -x CVS -x .DS_Store -x log -x '*lur' -I '[cC]reation[ _]date' -I md-eval -r test2-sastt.test/sastt-case2.sys.rttm.filt.alignments/segmentgroup-116.html test2-sastt.base/sastt-case2.sys.rttm.filt.alignments/segmentgroup-116.html";
        print "\n 45c45";
        print "\n < jg.drawStringRect(\"SUB48\",0, 47, scale*656, \"left\");";
        print "\n ---";
        print "\n####  and a whole bunch of other draw stuff! ####";
        print "\n1 at ./RunTests.pl line 61.\n\n";
        print "\n"
        print "\nThat looks like Java drawing code, and I don't"
        print "\neven want to mess with it!"
        print "\nI'm outta here.";
        print "\n   Sincerely, bballdave025";
        print "\n";
        print "\n";

        return;

    }#endof:  if (<problem 2>)

    system ("mkdir -p $outDir")

现在您应该能够通过.试试吧:

Now you should be able to get through. Try it:

make check

这篇关于sclite(SCTK)`make check`故障,C ++/perl/Cygwin,可以安全使用Perl4的东西吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆