C语言 编译 HTK 时出现“致命错误:bits/libc-header-start.h:没有这样的文件或目录”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/54082459/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"fatal error: bits/libc-header-start.h: No such file or directory" while compiling HTK
提问by William
I'm getting the following issue when trying to run makeon the HTK library:
尝试make在HTK 库上运行时遇到以下问题:
(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
I'm unsure what to do about this error. The libc-header-start.hfile is present on my system:
我不确定如何处理这个错误。该libc-header-start.h文件存在于我的系统上:
$ find /usr -name libc-header-start.h
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h
Running gcc -H -fsyntax-only /usr/include/stdio.happropriately returns
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
etc.
等等。
Also, compiling and running a sanity-check C file works fine (simply executing printf("hello!");in its main method).
此外,编译和运行健全性检查 C 文件工作正常(只需printf("hello!");在其主要方法中执行)。
Apologies if this is a well-known error - my experience with C libraries stops at compiling and installing them using make.
如果这是一个众所周知的错误,我深表歉意 - 我对 C 库的经验在使用make.
UPDATEPer the accepted answer below I executed sudo apt-get install gcc-multilibto install the missing 32 bit libraries.
更新根据下面接受的答案,我执行sudo apt-get install gcc-multilib安装缺少的 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-devto retrieve the missing 32 bit library.
后来我有一个类似的原因的错误:"/usr/bin/ld: cannot find -lX11" error when installing htk。我通过执行sudo apt-get install libx11-dev:i386 libx11-dev检索丢失的 32 位库解决了这个问题。
回答by Nick ODell
The -m32is 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:
该-m32告诉GCC编译器的32位平台。在 64 位机器上,gcc 通常只带有 64 位库。您有两个选择:
- Install 32-bit headers and libraries. Here's how you'd do this on Ubuntu: https://askubuntu.com/questions/91909/trouble-compiling-a-32-bit-binary-on-a-64-bit-machine
Compile for 64-bit instead. Modify this line in the file named
configure:CFLAGS="-m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH=\"$host_cpu\"' $CFLAGS"Delete
-m32, giving you:CFLAGS="-ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH=\"$host_cpu\"' $CFLAGS"Run
./configure, thenmake clean, thenmakeHowever, 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.)
- 安装 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 位构建此版本,如果您更改它,它可能无法正常工作。(不过,它确实可以编译。)

