“致命错误:bits/libc-header-start.h:没有这样的文件或目录"在编译HTK时 [英] "fatal error: bits/libc-header-start.h: No such file or directory" while compiling HTK
问题描述
I'm getting the following issue when trying to run make
on the HTK library:
(cd HTKLib && make HTKLib.a) \
|| case "" in *k*) fail=yes;; *) exit 1;; esac;
make[1]: Entering directory '/home/william/speech/htk/HTK-3.4.1/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
In file included from HShell.h:40:0,
from HGraf.c:54:
/usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory
#include <bits/libc-header-start.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
<builtin>: recipe for target 'HGraf.o' failed
make[1]: *** [HGraf.o] Error 1
make[1]: Leaving directory '/home/william/speech/htk/HTK-3.4.1/htk/HTKLib'
Makefile:96: recipe for target 'HTKLib/HTKLib.a' failed
make: *** [HTKLib/HTKLib.a] Error 1
我不确定该怎么办. libc-header-start.h
文件在我的系统上存在:
I'm unsure what to do about this error. The libc-header-start.h
file is present on my system:
$ find /usr -name libc-header-start.h
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h
运行gcc -H -fsyntax-only /usr/include/stdio.h
会正确返回
. /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
.. /usr/include/features.h
... /usr/include/x86_64-linux-gnu/sys/cdefs.h
等
此外,编译并运行健全性检查C文件也可以正常工作(只需在其main方法中执行printf("hello!");
即可).
Also, compiling and running a sanity-check C file works fine (simply executing printf("hello!");
in its main method).
如果这是一个众所周知的错误,我们深表歉意-我对C库的经验不再是使用make
进行编译和安装.
Apologies if this is a well-known error - my experience with C libraries stops at compiling and installing them using make
.
更新
根据下面接受的答案,我执行了sudo apt-get install gcc-multilib
来安装缺少的32位库.
UPDATE
Per the accepted answer below I executed sudo apt-get install gcc-multilib
to install the missing 32 bit libraries.
之后,我得到了一个错误,原因相似:"/usr/bin/ld: cannot find -lX11" error when installing htk
.我通过执行sudo apt-get install libx11-dev:i386 libx11-dev
来检索丢失的32位库来解决此问题.
Afterwards I got an error with a similar cause: "/usr/bin/ld: cannot find -lX11" error when installing htk
. I resolved this by executing sudo apt-get install libx11-dev:i386 libx11-dev
to retrieve the missing 32 bit library.
推荐答案
-m32
告诉gcc为32位平台进行编译.在64位计算机上,gcc通常仅随附64位库.您有两种选择:
The -m32
is telling gcc to compile for a 32-bit platform. On a 64-bit machine, gcc normally only comes with 64-bit libraries. You have two options:
- 安装32位标头和库.在Ubuntu上执行此操作的方法如下: https://askubuntu.com/questions/91909/trouble-compiling-a-32-bit-binary-on-a-64-bit-machine
-
改为编译为64位.在名为
configure
:
CFLAGS="-m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH=\"$host_cpu\"' $CFLAGS"
删除-m32
,为您提供:
CFLAGS="-ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH=\"$host_cpu\"' $CFLAGS"
依次运行./configure
,make clean
和make
但是,我不建议您这样做.库作者竭尽全力在64位系统上构建32位版本,如果您更改此版本,它可能无法正常工作. (尽管它确实可以编译.)
However, I would not suggest doing this. The library authors went out of their way to make this build for 32 bits on a 64 bit system, and it might not work correctly if you change this. (It does compile, though.)
这篇关于“致命错误:bits/libc-header-start.h:没有这样的文件或目录"在编译HTK时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!