Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
619 views
in Technique[技术] by (71.8m points)

c - "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

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

Running gcc -H -fsyntax-only /usr/include/stdio.h appropriately returns

. /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).

Apologies if this is a well-known error - my experience with C libraries stops at compiling and installing them using make.

UPDATE Per the accepted answer below I executed sudo apt-get install gcc-multilib to install the missing 32 bit libraries.

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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:

  1. 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
  2. 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, then make clean, then make

    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.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...