"fatal error: bits/libc-header-start.h: No such file or directory" while compiling HTK
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:
- 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
, thenmake
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.)
Below is one way to debug and fix this issue. Since most linux installations differ in one way or another, YMMV.
- Find which package installed
libc-header-start.h
.
$ dpkg -S libc-header-start.h
libc6-dev:amd64: /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
On a working system, /usr/include/bits
is a symlink to /usr/include/x86_64-linux-gnu/bits
. Running dpkg search gives us:
$ dpkg -S /usr/include/bits
libc6-dev-i386: /usr/include/bits
Installing libc6-dev-i386
creates the symlink and the error is addressed.
However, subsequently I ran into a linker error with the linker not being able to find libgcc (-lgcc
). Apparently Linux default linker needs libgcc in most cases. Further debugging the issue with linker verbosity enabled lead me to missing lib32gcc-10-dev
package.
In short, unless a very controlled build environment is desired, just install gcc-multilib
package when using -m32
(needed for gcc
or clang
). For C++, g++-multilib
is also required.