13

I am trying to use htk (HMM tool kit) for speech recognition.

I follow the instruction guideline in 'readme' file.

Firstly, I typed './configure' and it worked.

Followings are terminal output when I typed './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'

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

And I typed 'make all'. I can find following error message in the terminal output : /usr/bin/ld: cannot find -lX11. Following is complete version of terminal output.

(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

I already installed 'libx11-dev'. But 'make all' still doesn't work. Is there anyone giving me some comments? I really appreciate your help.

Thank you !

2
  • 1
    You should be able to tell the linker in which directory your libX11 lies by using the LDFLAGS environment variable when running configure. So first make clean and run LDFLAGS="-L /usr/lib/x86_64-linux-gnu" ./configure ... Afterwards you should hopefully be able to compile everything. Edit: The LDFLAGS= and ./configure should be in the same line...
    – soulsource
    Aug 21, 2012 at 12:16
  • Also, if you are using ssh, you have to make sure you are logged in with the "-X" flag. Jul 18, 2013 at 21:09

3 Answers 3

11

The following will also enable this to compile properly by making sure the 64bit and 32bit libraries are available.

sudo apt-get install libx11-dev:i386 libx11-dev
2
  • It worked for me. Jun 18, 2014 at 21:06
  • Worked for me as well. Ubuntu 12.04, 64 bit.
    – iamkhush
    Aug 7, 2014 at 18:10
4

I found that you can avoid this error easily if you can afford not to build hslab

./configure --disable-hslab

Which is (I think) the only part that actually relies on using X.

1

Trying to install HTK 3.5.1 on a new platform running Ubuntu (technically, in Docker), I ran into the same issue as the OP. I hope this helps someone…

On Ubuntu 14.04.3, I was able to compile HTK using:

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

I suspect this or nils' solution would carry the same results, but didn't bother to test.

FYI, this did the trick on macOS, too.

On Ubuntu 16.04 and 18.04, I did the same thing but also had to edit HLMTools/Makefile.in on L.77, where I replaced the eight whitespaces with a tab, because the compiler is more picky.

Of course, if you do need HSLab that's not gonna help. You may want to try your luck with HTK's newer version, 3.5 (currently in beta.)


While I'm at it:

Had to edit HRec.c on L. 1650, replacing labid != splabid with labpr != splabid (kudos to this page and that page.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .