Erro "/ usr / bin / ld: não consegue encontrar -lX11" ao instalar o htk


11

Estou tentando usar o htk (kit de ferramentas HMM) para reconhecimento de fala.

Sigo as orientações de instruções no arquivo 'leia-me'.

Primeiro, digitei './configure' e funcionou.

A seguir, a saída do terminal quando digitei './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'

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

E eu digitei 'make all'. Posso encontrar a seguinte mensagem de erro na saída do terminal: / usr / bin / ld: não é possível encontrar -lX11. A seguir está a versão completa da saída do terminal.

(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

Eu já instalei 'libx11-dev'. Mas 'make all' ainda não funciona. Existe alguém me fazendo alguns comentários? Eu realmente aprecio sua ajuda.

Obrigado !


1
Você deve poder informar ao vinculador em qual diretório sua libX11 se encontra usando a variável de ambiente LDFLAGS ao executar o configure. Então, primeiro faça a limpeza e execute LDFLAGS = "- L / usr / lib / x86_64-linux-gnu" ./configure ... Posteriormente, esperamos que você consiga compilar tudo. Edit: O LDFLAGS = e ./configure deve estar na mesma linha ...
soulsource

Além disso, se você estiver usando ssh, verifique se está conectado com o sinalizador "-X".
David White

Respostas:


9

A seguir, também será possível compilar corretamente, assegurando que as bibliotecas de 64 bits e 32 bits estejam disponíveis.

sudo apt-get install libx11-dev:i386 libx11-dev

Funcionou para mim.
Saul Berardo

Trabalhou para mim também. Ubuntu 12.04, 64 bits.
Iamkhush

4

Descobri que você pode evitar esse erro facilmente se não puder criar o hslab

./configure --disable-hslab

Qual é (eu acho) a única parte que realmente depende do uso do X.


0

Tentando instalar o HTK 3.5.1 em uma nova plataforma executando o Ubuntu (tecnicamente, no Docker), encontrei o mesmo problema que o OP. Espero que isso ajude alguém…

No Ubuntu 14.04.3, consegui compilar HTK usando:

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

Suspeito que essa solução ou nada tenha os mesmos resultados, mas não se preocupou em testar.

Para sua informação, isso também funcionou no macOS.

No Ubuntu 16.04 e 18.04, fiz a mesma coisa, mas também tive que editar HLMTools/Makefile.inno L.77, onde substituí os oito espaços em branco por uma guia, porque o compilador é mais exigente.

Claro, se você precisar do HSLab, isso não vai ajudar. Você pode tentar a sorte com a versão mais recente do HTK , 3.5 (atualmente na versão beta).


Enquanto estou nisso:

Teve que editar HRec.cem L. 1650, substituindo labid != splabidpor labpr != splabid(parabéns para esta página e para essa página ).

Ao utilizar nosso site, você reconhece que leu e compreendeu nossa Política de Cookies e nossa Política de Privacidade.
Licensed under cc by-sa 3.0 with attribution required.