【问题标题】:sclite (SCTK) install, file not recognized, file format not recognized, Cygwinsclite (SCTK) 安装,文件无法识别,文件格式无法识别,Cygwin
【发布时间】:2018-10-21 01:33:09
【问题描述】:

我目前正在尝试安装 NIST 的 sclite,它是 SCTK 2.4.0 的一部分(github 或 current version)。我正在尝试在bash 中的Cygwin 上安装。使用make完成安装。


我做了什么

我为安装创建了一个目录并导航到该目录

mkdir sctk2.4.0
cd sctk2.4.0

(你可能需要$ cd /path/to/dir/sctk2.4.0。)

我从github克隆了项目

git clone https://github.com/chinshr/sctk.git

导航到基本文件夹

cd sctk

然后我开始按照INSTALL 文件中的说明进行操作。

跑步

make config

工作正常,但输入后

make all

我得到了下面的输出

(mkdir -p bin)
(cd src; make all)
make[1]: Entering directory '/cygdrive/c/David/programs/sctk2.4.0/sctk/src'
(cd asclite; make all)
make[2]: Entering directory '/cygdrive/c/David/programs/sctk2.4.0/sctk/src/asclite'
(cd core; make all)
make[3]: Entering directory '/cygdrive/c/David/programs/sctk2.4.0/sctk/src/asclite/core'
g++ -o asclite -g -Os  alignment.o segment.o sgml_reportgenerator.o alignedsegmentiterator.o reportgenerator.o speechset.o segmentsgroup.o logger.o tokenalignment.o sgml_generic_reportgenerator.o recording.o statistics.o compressedlevenshteinmatrix.o segmentor.o id.o trntrn_segmentor.o linestyle_inputparser.o inputparser.o levenshteinmatrix.o levenshtein.o uemfilter.o speakermatch.o spkrautooverlap.o graphalignedsegment.o rawsys_reportgenerator.o graphalignedtoken.o timedobject.o stt_scorer.o aligner.o arraylevenshteinmatrix.o graph.o main.o trn_inputparser.o alignedspeech.o token.o alignedsegment.o graph_coordinate.o rttm_inputparser.o scorer.o properties.o ctmstmrttm_segmentor.o filter.o speech.o alignedspeechiterator.o stm_inputparser.o checker.o ctm_inputparser.o lzma/LzFind.o lzma/LzmaEnc.o lzma/Alloc.o lzma/LzmaLib.o lzma/LzmaDec.o -lm
alignment.o: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
make[3]: *** [makefile:62: asclite] Error 1
make[3]: Leaving directory '/cygdrive/c/David/programs/sctk2.4.0/sctk/src/asclite/core'
make[2]: *** [makefile:12: all] Error 2
make[2]: Leaving directory '/cygdrive/c/David/programs/sctk2.4.0/sctk/src/asclite'
make[2]: *** [makefile:12: all] Error 2
make[2]: Leaving directory '/cygdrive/c/David/programs/sctk2.4.0/sctk/src'
make: *** [makefile:20: all] Error 2

我查看了this SO post,但我确定alignment.o 文件没有损坏。以防万一,我尝试了几个make clean,甚至从github重新克隆了项目,但我仍然得到同样的错误。

谁能帮我完成这个安装,或者至少进入下一步?


系统详情

$ uname -a
CYGWIN_NT-6.1 MyMachine 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

注意

我在问这个问题,然后回答我自己的问题。 (我喜欢 StackOverflow 允许我们这样做。)希望这将使人们更容易帮助我解决我在安装过程中遇到的问题。

我遇到的下一个问题是讨论here。你可以在这个问题的答案中看到下一个问题。

【问题讨论】:

  • 有一种我认为更简单的方法。基本上,您安装kaldi 的tools 部分。您也可以安装src 部分并根据需要使用它(除非您像我一样在Windows 7 下使用Cygwin,在这种情况下会有更多问题。)如果您只想要sclite 的东西,复制@ 987654350@ 到不在kaldi 树内的地方。我做了mkdir $HOME/sctk-2.4.10 && cp /path/to/kaldi/tools/sctk-2.4.10/* $HOME/sctk2.4.10/。稍后我可能会详细说明。
  • 请注意,如果使用 jaguar 提供的更新版本的 sclite,则还需要此处描述的修复程序以及我链接到的其他解决方案(link2、link3)。 ncsl.nist.gov/pub/sctk-2.4.10-20151007-1312Z.tar.bz2
  • 那个更当前版本的链接可能会改变,所以这里是托管站点:https://www.nist.gov/itl/iad/mig/tools。

标签: c++ c makefile cygwin


【解决方案1】:

(请参阅我在kaldi 解决方案问题下的评论。)

这个问题的解决方案在README 中,解决方案通常是这样。 注意:这个问题解决后又出现了一个问题。请参阅此答案的底部以获取帮助。

这是我用来从README 获取相关信息的命令。

cat README | tail -13

这是相关信息


                       64 bits Compilation

With big alignments, sctk needs to be compiled in 64 bits.
By default, the C/C++ software are compiled in 32 bits with the options (-Os)
but can be compiled in 64 bits, -m64 is added to the CFLAGS variable in:
src/asclite/core/makefile
src/asclite/test/makefile
src/rfilter1/makefile
src/sclite/makefile
Example of CFLAGS:
For OSX 10.4+: -fast -m64 -arch x86_64 -arch ppc64

所以,我去了列出的makefiles(rfilter1 除外,见下文)并在那里更改了代码,将每个-Os 替换为-m64。仅对列出的 makefile 执行此操作。我将举一个列出的文件的示例,但请注意,您必须为其他文件这样做。

cd sctk
vim src/asclite/core/makefile

当文件打开时,我发现了这一行:

CFLAGS = -g -Os

我改成了

CFLAGS = -g -m64

(按“i”进入INSERT模式,进行更改,按“Esc”,然后按“:wq”(写入并退出),然后按“Enter”)

我对所有列出的文件进行了更改,除了 src/rfilter1/makefile,因为该文件中没有 -Os。这最终很重要,因为如果我完全更改此文件,安装将无法正常工作。

完成后,我运行了make clean,但我没有运行make config,因为这会撤消我们刚刚所做的更改。我直接去了:

make all

这让我们超越了以前的状态。

这个问题已经解决了,但是还有一个问题:

In file included from main.cpp:20:0:
recording.h:122:36: error: template argument 2 is invalid
         map<string, Filter::Filter*> filters;
                                    ^
recording.h:122:36: error: template argument 4 is invalid

我问过here。

【讨论】:

  • 在 Cygwin here 中有更多关于 32 位和 64 位的东西。
【解决方案2】:

这是“更简单”的解决方案。

以下是我所说的“kaldi 解决方案”的详细信息。现在,它只是一个没有详细信息的命令列表。如此处所示,这些命令将在$HOME (~) 目录下安装一个sclite-2.4.10 目录:

$ cd
$ git clone https://github.com/kaldi-asr/kaldi.git
$ cd kaldi/tools
$ extras/check_dependencies.sh
$ make -j $(nproc --all)
$ cp -R sctk-2.4.10 ~/
$ cd
$ rm -rf kaldi
$ cd sctk-2.4.10/
$ cp $HOME/.bashrc "${HOME}/.bashrc.$(date +%Y%m%d-%H%M%S).bak"
$ echo -e "\n\n## Allow access to sclite, rfilter, etc" >> $HOME/.bashrc
$ echo 'export PATH='"$(pwd)/bin"':$PATH' >> $HOME/.bashrc
$ source ~/.bashrc

有关如何在 Windows 上使用它的详细信息,请参阅this 问题/答案。

【讨论】:

    【解决方案3】:

    更简单的解决方案 - 利用 sclite 的新编辑版本

    这是为了以防有人发现这里的答案很有用。我知道这里没有投票,但我刚拿到一个奖杯,告诉我这是我获得 1000 次观看的第一个问题,所以我将更新我的答案以展示完成工作的最简单方法。

    TL;DR

    https://www.nist.gov/itl/iad/mig/tools

    https://github.com/usnistgov/SCTK

    % cd /the/dir/where/i/want/to/install
    % git clone https://github.com/usnistgov/SCTK.git
    % cd SCTK
    

    来自git master README(引用)以及我放入的一些 cmets。

    % make config

    % sed -i 's#[-]Os#-m64#g' src/asclite/core/makefile
    
    % sed -i 's#[-]Os#-m64#g' src/asclite/test/makefile
    
    % sed -i 's#[-]Os#-m64#g' src/sclite/makefile
    
    % make clean
    
    % ## Possible edit to the `rfilter1 makefile`, which are
    % ## described at the end of the answer but were not necessary
    % ## for me.
    

    % make all

    % make check

    % make install

    % make doc

    我还将可执行文件的目录添加到我的PATH 并通过man 命令提供文档。

    % pwd
    /the/dir/where/i/want/to/install/SCTK
    % # back up your `.bashrc`
    % cp $HOME/.bashrc "${HOME}/.bashrc.$(date +%Y%m%d-%H%M%S).bak"
    % # persistent path changes
    % echo -e "\n\n## Allow access to sclite, rfilter, etc" >> $HOME/.bashrc
    % # your machine might use something other than `export` for this. CHECK!
    % echo 'export PATH='"$(pwd)/bin"':$PATH' >> $HOME/.bashrc
    % # make changes availabel this session
    % source ~/.bashrc
    % # man stuff
    % cd doc
    % cp -r ./* /usr/man/man1
    

    TL;DR 部分结束


    详情

    自从我在 2018 年 5 月发布此内容后,该软件终于有了一些更新:

    我在 2018 年 5 月发布了我的问题,并在 2018 年秋季进行了更新。它们部分解决了我在这里遇到的问题,但 README 和一些 makefiles 中的一些信息在这里很有用.

    可以通过 README 找到 32 位到 64 位的问题(将 -Os 更改为 -m64,如上所述)。

    % cat -n README.md | grep -A 4 "64 bits Compilation"
        61  **64 bits Compilation**:
        62  With big alignments, sctk needs to be compiled in 64 bits. By default, the C/C++ software are compiled in 32 bits with the options (`-Os`) but can be compiled in 64 bits. To do so, `-m64` is added to the CFLAGS variable in `src/asclite/core/makefile`, `src/asclite/test/makefile`, `src/rfilter1/makefile` and `src/sclite/makefile`.
        63
        64  Example of `CFLAGS` for OSX 10.4+: `-fast -m64 -arch x86_64 -arch ppc64`
        65
    

    这是第 62 行,带有自动换行

    对于大对齐,sctk 需要以 64 位编译。默认情况下,C/C++ 软件使用选项 (-Os) 编译为 32 位,但可以编译为 64 位。为此,-m64 被添加到 CFLAGS 变量中 src/asclite/core/makefile, src/asclite/test/makefile, src/rfilter1/makefile 和 src/sclite/makefile.

    由于src/rfilter1/makefile中没有-Os,所以我没有做任何更改。

    我能够顺利完成安装(包括没有失败的测试)。这是我的系统信息。

    $ uname -a
    CYGWIN_NT-10.0 MyMachine 3.0.7(0.338/5/3) 2019-04-30 18:08 x86_64 Cygwin
    $ bash --version | head -n 1
    GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)
    $ gcc --version | head -n 1
    gcc (GCC) 7.4.0
    $ g++ --version | head -n 1
    g++ (GCC) 7.4.0
    $ make --version | head -n 2
    GNU Make 4.2.1
    Built for x86_64-unknown-cygwin
    $ systeminfo | sed -n 's/^OS\ *//p'
    Name:                   Microsoft Windows 10 Enterprise
    Version:                10.0.17134 N/A Build 17134
    Manufacturer:           Microsoft Corporation
    Configuration:          Member Workstation
    Build Type:             Multiprocessor Free
    

    但是,似乎其他一些人试图在 Cygwin 上编译时遇到了问题。以下是来自README的更多信息

    % grep "Special Note to Cygwin users" README.md
    *Special Note to Cygwin users:* it has been reported that compilation of `rfilter1` can fail in some case, please read the OPTIONS part of the `rfilter1/makefile` and adapt accordingly before retrying compilation.
    

    好吧,让我们看看rfilter1 对应的makefile,看看你们中的一些人可能需要做什么。

    % head -n 15 src/rfilter1/makefile | tail -7
    ###########################   Options for compilation  #########################
    #######  If you have an very new version of GCC, the strcmp* family of functions
    #######  is included in the distribution.  Changing the value of OPTIONS to
    #######  be blank will diable the use of supplied versions of these functions.
    #######  In particular, this behavior has been noted on some versions of cygwin
    OPTIONS=-DNEED_STRCMP=1 $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
    

    所以,如果您有rfilter1 编译问题,请将未注释的行更改为

    OPTIONS= $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-15
      • 1970-01-01
      • 1970-01-01
      • 2021-01-13
      • 2013-06-12
      • 1970-01-01
      • 1970-01-01
      • 2011-05-25
      相关资源
      最近更新 更多