安装htk时出现“ / usr / bin / ld:找不到-lX11”错误


11

我正在尝试使用htk(HMM工具套件)进行语音识别。

我遵循“自述文件”中的指导原则。

首先,我键入“ ./configure”,它可以正常工作。

以下是我输入“ ./configure”时的终端输出。

checking whether make sets $(MAKE)... yes
checking for gawk... no
checking for mawk... mawk
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for ranlib... ranlib
checking for main in -lX11... yes
checking for main in -lm... yes
checking how to run the C preprocessor... gcc -E
checking for X... libraries , headers 
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking float.h usability... yes
checking float.h presence... yes
checking for float.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking for memory.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking whether gcc needs -traditional... no
checking for working memcmp... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for working strtod... yes
checking return type of signal handlers... void
checking for vprintf... yes
checking for _doprnt... no
checking for floor... yes
checking for gettimeofday... yes
checking for memmove... yes
checking for memset... yes
checking for modf... yes
checking for pow... yes
checking for socket... yes
checking for sqrt... yes
checking for strchr... yes
checking for strcspn... yes
checking for strrchr... yes
checking for strspn... yes
checking for strstr... yes
checking for strtol... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
configure: creating ./config.status
config.status: creating HTKLib/Makefile
config.status: WARNING:  HTKLib/Makefile.in seems to ignore the --datarootdir setting
config.status: creating HTKTools/Makefile
config.status: WARNING:  HTKTools/Makefile.in seems to ignore the --datarootdir setting
config.status: creating HLMLib/Makefile
config.status: WARNING:  HLMLib/Makefile.in seems to ignore the --datarootdir setting
config.status: creating HLMTools/Makefile
config.status: WARNING:  HLMTools/Makefile.in seems to ignore the --datarootdir setting
config.status: creating HTKLVRec/Makefile
config.status: WARNING:  HTKLVRec/Makefile.in seems to ignore the --datarootdir setting
config.status: creating Makefile
config.status: WARNING:  Makefile.in seems to ignore the --datarootdir setting
**************************************************

HTK is now ready to be built.

Type "make all" to build the HTK libraries
and tools.

Then "make install" to install them.

The tools will be installed in /usr/local/bin

Build notes: Language Modelling tools will be
built. HDecode will not be built. You can build
it manually later by running 'make hdecode
install-hdecode'

**************************************************

然后我输入“ make all”。我可以在终端输出中找到以下错误消息:/ usr / bin / ld:找不到-lX11。以下是终端输出的完整版本。

(cd HTKLib && make HTKLib.a) \
      || case "" in *k*) fail=yes;; *) exit 1;; esac;
make[1]: Entering directory `/home/geon-min/Downloads/htk/HTKLib'
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HGraf.o HGraf.c
HGraf.c: In function ‘DecodeKeyPress’:
HGraf.c:179:8: warning: variable ‘n’ set but not used [-Wunused-but-set-variable]
HGraf.c: In function ‘HGetEvent’:
HGraf.c:221:18: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o esig_asc.o esig_asc.c
esig_asc.c: In function ‘ReadAsciiEscape’:
esig_asc.c:2025:16: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o esig_edr.o esig_edr.c
esig_edr.c: In function ‘ReadEdrRecord’:
esig_edr.c:338:25: warning: ‘flags’ may be used uninitialized in this function [-Wuninitialized]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o esignal.o esignal.c
esignal.c: In function ‘GetLine’:
esignal.c:1760:9: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
esignal.c: In function ‘GetLong’:
esignal.c:1808:9: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o esig_nat.o esig_nat.c
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HAdapt.o HAdapt.c
HAdapt.c: In function ‘SetSemiTiedAvCov’:
HAdapt.c:1381:15: warning: variable ‘si’ set but not used [-Wunused-but-set-variable]
HAdapt.c: In function ‘ParseNode’:
HAdapt.c:1550:12: warning: variable ‘size’ set but not used [-Wunused-but-set-variable]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HArc.o HArc.c
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HAudio.o HAudio.c
HAudio.c: In function ‘StartAudioInput’:
HAudio.c:2174:11: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HDict.o HDict.c
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HExactMPE.o HExactMPE.c
HExactMPE.c: In function ‘DoCorrectness’:
HExactMPE.c:288:58: warning: value computed is not used [-Wunused-value]
HExactMPE.c:332:12: warning: variable ‘cb’ set but not used [-Wunused-but-set-variable]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HFB.o HFB.c
HFB.c: In function ‘Setotprob’:
HFB.c:999:15: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
HFB.c: In function ‘SetBeta’:
HFB.c:1161:12: warning: variable ‘hset’ set but not used [-Wunused-but-set-variable]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HFBLat.o HFBLat.c
HFBLat.c: In function ‘StepAlpha’:
HFBLat.c:737:20: warning: variable ‘transP’ set but not used [-Wunused-but-set-variable]
HFBLat.c: In function ‘DoAllMixUpdates’:
HFBLat.c:1070:33: warning: variable ‘al_otvs’ set but not used [-Wunused-but-set-variable]
HFBLat.c: In function ‘UpMixParms’:
HFBLat.c:1198:25: warning: variable ‘vSize’ set but not used [-Wunused-but-set-variable]
HFBLat.c: In function ‘StepForward’:
HFBLat.c:1389:25: warning: variable ‘bqt1’ set but not used [-Wunused-but-set-variable]
HFBLat.c: In function ‘DoAllMixUpdates’:
HFBLat.c:1175:30: warning: ‘mammi’ may be used uninitialized in this function [-Wuninitialized]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HLabel.o HLabel.c
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HLat.o HLat.c
HLat.c: In function ‘LatSetScores’:
HLat.c:690:14: warning: variable ‘best’ set but not used [-Wunused-but-set-variable]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HLM.o HLM.c
HLM.c: In function ‘WriteNGrams’:
HLM.c:235:16: warning: variable ‘N’ set but not used [-Wunused-but-set-variable]
HLM.c: In function ‘ReadNGrams’:
HLM.c:379:18: warning: variable ‘size’ set but not used [-Wunused-but-set-variable]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HMap.o HMap.c
HMap.c: In function ‘TotMixInSet’:
HMap.c:384:10: warning: variable ‘hmm’ set but not used [-Wunused-but-set-variable]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HMath.o HMath.c
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HMem.o HMem.c
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HModel.o HModel.c
HModel.c: In function ‘CompressItemList’:
HModel.c:1149:11: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
HModel.c: In function ‘CreateHMM’:
HModel.c:4225:12: warning: variable ‘newMacro’ set but not used [-Wunused-but-set-variable]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HNet.o HNet.c
HNet.c: In function ‘CreateXEModels’:
HNet.c:3144:36: warning: variable ‘searchNode’ set but not used [-Wunused-but-set-variable]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HParm.o HParm.c
HParm.c: In function ‘SetWaveSpDetParms’:
HParm.c:2584:18: warning: variable ‘nBl’ set but not used [-Wunused-but-set-variable]
HParm.c:2582:11: warning: variable ‘v’ set but not used [-Wunused-but-set-variable]
HParm.c: In function ‘CompressPBlock’:
HParm.c:4945:16: warning: variable ‘count’ set but not used [-Wunused-but-set-variable]
HParm.c: In function ‘OpenAsChannel’:
HParm.c:4351:25: warning: ‘initRows’ may be used uninitialized in this function [-Wuninitialized]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HRec.o HRec.c
HRec.c: In function ‘LatFromPaths’:
HRec.c:1650:33: warning: ‘labid’ may be used uninitialized in this function [-Wuninitialized]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HShell.o HShell.c
HShell.c: In function ‘KeyPressed’:
HShell.c:1489:14: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
HShell.c: In function ‘NextArg’:
HShell.c:725:13: warning: ignoring return value of ‘strtod’, declared with attribute warn_unused_result [-Wunused-result]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HSigP.o HSigP.c
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HTrain.o HTrain.c
HTrain.c: In function ‘RestoreAccsParallel’:
HTrain.c:1716:12: warning: variable ‘size’ set but not used [-Wunused-but-set-variable]
HTrain.c: In function ‘InitClustering’:
HTrain.c:755:22: warning: ‘cov.var’ may be used uninitialized in this function [-Wuninitialized]
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HUtil.o HUtil.c
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HVQ.o HVQ.c
HVQ.c: In function ‘LoadVQTab’:
HVQ.c:199:9: warning: ‘cov.var’ may be used uninitialized in this function [-Wuninitialized]
HVQ.c:169:15: note: ‘cov.var’ was declared here
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o HWave.o HWave.c
HWave.c: In function ‘GetAIFFHeaderInfo’:
HWave.c:997:22: warning: variable ‘commchunk1’ set but not used [-Wunused-but-set-variable]
HWave.c: In function ‘GetWAVHeaderInfo’:
HWave.c:1062:9: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
HWave.c:1068:9: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
HWave.c:1069:9: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
HWave.c:1081:12: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
HWave.c:1082:12: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
HWave.c:1087:15: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
HWave.c:1097:15: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
HWave.c:1105:15: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
HWave.c:1108:15: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
HWave.c:1109:15: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
HWave.c:1110:15: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
HWave.c:1125:33: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
HWave.c: In function ‘PutESIGHeaderInfo’:
HWave.c:1379:21: warning: ‘inList’ may be used uninitialized in this function [-Wuninitialized]
HWave.c: In function ‘OpenWaveInput’:
HWave.c:1042:18: warning: ‘commchunk2.nSamples’ may be used uninitialized in this function [-Wuninitialized]
HWave.c:998:22: note: ‘commchunk2.nSamples’ was declared here
gcc  -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG   -c -o strarr.o strarr.c
if [ -f HTKLib.a ] ; then  /bin/rm HTKLib.a ; fi
ar rv HTKLib.a HGraf.o esig_asc.o esig_edr.o esignal.o esig_nat.o HAdapt.o HArc.o HAudio.o HDict.o HExactMPE.o HFB.o HFBLat.o HLabel.o HLat.o HLM.o HMap.o HMath.o HMem.o HModel.o HNet.o HParm.o HRec.o HShell.o HSigP.o HTrain.o HUtil.o HVQ.o HWave.o strarr.o
ar: creating HTKLib.a
a - HGraf.o
a - esig_asc.o
a - esig_edr.o
a - esignal.o
a - esig_nat.o
a - HAdapt.o
a - HArc.o
a - HAudio.o
a - HDict.o
a - HExactMPE.o
a - HFB.o
a - HFBLat.o
a - HLabel.o
a - HLat.o
a - HLM.o
a - HMap.o
a - HMath.o
a - HMem.o
a - HModel.o
a - HNet.o
a - HParm.o
a - HRec.o
a - HShell.o
a - HSigP.o
a - HTrain.o
a - HUtil.o
a - HVQ.o
a - HWave.o
a - strarr.o
ranlib HTKLib.a
make[1]: Leaving directory `/home/geon-min/Downloads/htk/HTKLib'
(cd HTKTools && make all) \
      || case "" in *k*) fail=yes;; *) exit 1;; esac;
make[1]: Entering directory `/home/geon-min/Downloads/htk/HTKTools'
if [ ! -d /usr/local/bin -a X_ = X_yes ] ; then mkdir -p /usr/local/bin ; fi
if [ xHSLab = xHSLab ] ; then \
        gcc -o HSLab -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I../HTKLib -DPHNALG HSLab.c ../HTKLib/HTKLib.a -L/usr/X11R6/lib  -lm -lX11 ; \
        else \
        gcc -o HSLab -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I../HTKLib -DPHNALG HSLab.c ../HTKLib/HTKLib.a -L/usr/X11R6/lib  -lm ; fi
HSLab.c: In function ‘FileExists’:
HSLab.c:1209:12: warning: variable ‘isEXF’ set but not used [-Wunused-but-set-variable]
HSLab.c: In function ‘DoSpecial’:
HSLab.c:1596:13: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
/usr/bin/ld: cannot find -lX11
collect2: ld returned 1 exit status
make[1]: *** [HSLab] Error 1
make[1]: Leaving directory `/home/geon-min/Downloads/htk/HTKTools'
make: *** [htktools] Error 1

我已经安装了'libx11-dev'。但是“全部制作”仍然行不通。有没有人给我一些意见?非常感谢您的帮助。

谢谢 !


1
运行configure时,您应该能够通过使用LDFLAGS环境变量来告诉链接程序libX11所在的目录。因此,首先清理并运行LDFLAGS =“-L / usr / lib / x86_64-linux-gnu” ./configure ...之后,您应该可以编译所有内容。编辑:LDFLAGS =和./configure应该在同一行...
soulsource

另外,如果使用的是ssh,则必须确保使用“ -X”标志登录。
大卫·怀特

Answers:



4

我发现,如果您负担不起不构建hslab,就可以轻松避免此错误

./configure --disable-hslab

(我认为)这是真正依赖于使用X的唯一部分。


0

尝试在运行Ubuntu的新平台上安装HTK 3.5.1(从技术上讲,在Docker中)时,我遇到了与OP相同的问题。我希望这可以帮助别人…

在Ubuntu 14.04.3上,我能够使用以下命令编译HTK:

./configure --without-x --disable-hslab

我怀疑此解决方案或nils的解决方案会获得相同的结果,但没有费心进行测试。

仅供参考,这在macOS上也达到了目的。

在Ubuntu 16.04和18.04上,我做了同样的事情,但是还必须HLMTools/Makefile.in在L.77上进行编辑,在L.77上我用制表符替换了八个空格,因为编译器更加挑剔。

当然,如果您确实需要HSLab,那将无济于事。您可能希望尝试使用HTK的较新版本 3.5(目前处于Beta版)。


在我的时候:

必须在L.1650 HRec.c上进行编辑,以替换labid != splabidlabpr != splabid对该页面该页面的荣誉。)

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.