Skip to content
Advertisement

glibc configure doesn’t recognize Linux header files

I’ve downloaded Linux kernel source from kernel.org to cross-compile glibc onto aarch64 Linux (emulated by QEMU). However, when I run:

[teo.samarzija@teos-acer-laptop glibc-2.31-build]$ ../glibc-2.31/configure --with-headers=/home/teo.samarzija/linux-5.7.6/include --with-binutils=/home/teo.samarzija/arm-gcc/bin --prefix=/home/teo.samarzija/arm-gcc --build=x86_64-pc-linux --host=aarch64-none-linux-gnu CC=aarch64-none-linux-gnu-gcc

I get this error:

checking installed Linux kernel header files... missing or too old!
configure: error: GNU libc requires kernel header files from
Linux 3.2.0 or later to be installed before configuring.
The kernel header files are found usually in /usr/include/asm and
/usr/include/linux; make sure these directories use files from
Linux 3.2.0 or later.  This check uses <linux/version.h>, so
make sure that file was built correctly when installing the kernel header
files.  To use kernel headers not from /usr/include/linux, use the
configure option --with-headers.

Any idea what I am doing wrong?

Advertisement

Answer

--with-headers=/home/teo.samarzija/linux-5.7.6/include

This looks like a checked-out kernel tree. You need to install the kernel tree first and specify that location, using a command like this:

make -C /home/teo.samarzija/linux-5.7.6 ARCH=arm64 
  INSTALL_HDR_PATH=/home/teo.samarzija/linux-5.7.6-installed/usr 
  headers_install

(You still have to set CC et al. appropriate to pick up the cross-compiler.)

And the use --with-headers=/home/teo.samarzija/linux-5.7.6-installed/usr/include.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement