I have Ubuntu 16.04 LTS installed and have installed linux-headers. I am in the middle of trying to build uClibc-ng and it needs the linux headers. So when I run the following command from the linux-headers directory I get the following error messages. What step am I missing?

sudo make INSALL_HDR_PATH=/tmp/linux-headers headers_install
  CHK      include/generated/uapi/linux/version.h
  UPD      include/generated/uapi/linux/version.h
make[1]: *** No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl'
 needed by 'arch/x86/entry/syscalls/../include/generated/asm/syscalls_32.h'.
arc/x86/Makefile:216: recipe for target 'archheaders' failed.
make: *** [archheaders] Error 2

I created a new VM to play with, and its uname -a is:

Linux ubuntu 4.15.0-46-generic #49~16.04.1-Ubuntu SMP Tue Feb 12 17:45:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Some questions:

  1. What is the difference between linux-headers-4.15.0-46 and linux-headers-4.15.0-46-generic?
  2. On my VM I have 2 sets linux-header directories. One with 4.14.0-29 and one with 4.14.0-46. Within each of those sets is 2 directories. One with and one without -generic. Do I need to maintain both of these sets?
  3. Does anyone know of any instructions of what steps need to be performed on a fresh 16.04 Ubuntu image in order to be able to get the linux-headers?

I finally figured this out. I went to GitHub and get the Linux sources associated with the version of Ubuntu I am running. I was able to run:

make \
  ARCH=<arch-name> O=. -C <path-to-linux-sources> \
  headers_install INSTALL_HDR_PATH=<output-directory>

This worked like a charm and did not require having to run in an elevated privileged mode.

  • Struggling with ipconfig as part of klibc < 2.0.4-10 . Your response has helped me rebuild klibc from source :-) Have an upvote... I've tried ARCH=x86_64 and it worked. The klibc makefile itself has suggested INSTALL_HDR_PATH=/usr/src/klibc/linux . Now I just hope that all I need is a 'cp usr/kinit/ipconfig/static/ipconfig /usr/lib/klibc/bin/' and update-initramfs... – frr Sep 4 at 11:59

Install the linux-source package:

sudo apt-get install linux-source

uClibc is fairly old; I recommend installing uClibc-ng instead.

  • The first sentence in the question mentions that linux-headers is installed. – Stephen Kitt May 21 at 20:55
  • It does say that, but I don't think that's the case. – JL2210 May 21 at 21:03
  • If you install the appropriate linux-headers package on Ubuntu (or any Debian derivative), and run cd /usr/src/linux-headers-$(uname -r), then make headers_install, you’ll get the same error as the OP, which leads me to believe the package is installed ;-). – Stephen Kitt May 21 at 21:06
  • @StephenKitt Done. You'd think that it would install the headers in /usr/include... – JL2210 May 21 at 21:08
  • Yes, linux-source is installed. Also, the related item did not solve my problem. I did a search for $(PWD) and PWD and did not find anything relevant to correct. So, I'm still not able to get the linux headers. BTW: I am trying to build uClib-ng. I miss-typed it. – JonBelanger May 22 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.