sclite (SCTK) 安装,无法识别文件,无法识别文件格式,Cygwin
sclite (SCTK) install, file not recognized, file format not recognized, Cygwin
我目前正在尝试安装 NIST 的 sclite
,它是 SCTK 2.4.0 (github or 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
备注
我在问这个问题,然后回答我自己的问题。 (我喜欢 Whosebug 允许我们这样做。)希望这将使人们更容易帮助我解决我 运行 在安装中进一步遇到的问题。
我 运行 讨论的下一个问题 。你可以在这个问题的答案中看到下一个问题。
(请参阅我在 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
<br/>
因此,我转到列出的 makefile
(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
我问的是 。
这是'EASIER'解决方案。
下面是我所谓的 "the kaldi
solution" 的详细信息。现在,它只是一个没有细节的命令列表。如此处所示,这些命令将在 $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 上使用它的详细信息,请参阅 question/answer。
更简单的解决方案 - 利用 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 自述文件(引用)和我添加的一些评论。
% 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
在这里注明很有用。
32 位到 64 位的问题(将 -Os
更改为 -m64
,如上所述)可通过 README
.
找到
% 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.
好吧,让我们看看 makefile
for rfilter1
,看看你们中的一些人可能需要做什么。
% 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)
我目前正在尝试安装 NIST 的 sclite
,它是 SCTK 2.4.0 (github or 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
备注
我在问这个问题,然后回答我自己的问题。 (我喜欢 Whosebug 允许我们这样做。)希望这将使人们更容易帮助我解决我 运行 在安装中进一步遇到的问题。
我 运行 讨论的下一个问题
(请参阅我在 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 <br/>
因此,我转到列出的 makefile
(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
我问的是
这是'EASIER'解决方案。
下面是我所谓的 "the kaldi
solution" 的详细信息。现在,它只是一个没有细节的命令列表。如此处所示,这些命令将在 $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 上使用它的详细信息,请参阅
更简单的解决方案 - 利用 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 自述文件(引用)和我添加的一些评论。
% 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
在这里注明很有用。
32 位到 64 位的问题(将 -Os
更改为 -m64
,如上所述)可通过 README
.
% 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.
好吧,让我们看看 makefile
for rfilter1
,看看你们中的一些人可能需要做什么。
% 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)