/usr/include/x86_64-linux-gnu/sys contains only broken symbolic links

gb flag

My O/S is Ubuntu 20.04.

The initial problem: I was trying to run a "make" and got errors like:

/usr/include/sys/cdefs.h:453:10: fatal error: bits/long-double.h: No such file or directory
  453 | #include <bits/long-double.h>
      |          ^~~~~~~~~~~~~~~~~~~~

I initially tried solving this by searching for an equivalent header (usually in /usr/include/x86_64-linux-gnu) and adding a symbolic link. The initial ref was typically from /usr/include/c++/9/<whatever>. After a dozen or so of these, there seemed to be a slew of headers missing in /usr/include/sys and each one seemed to have an equivalent in /usr/include/x86_64-linux-gnu/sys. I then tried creating a symlink of the form

/usr/include/sys --> /usr/include/x86_64-linux-gnu/sys

I don't know if that was the cause of my subsequent problems, but it was probably not my brightest idea. It seemed to me that I was going around in circles, because some of the earlier header errors came back. I decided to reinstall the libc6 and libc6:i386. After that all the "headers" in /usr/include/x86_64-linux-gnu/sys were symlinks marked as broken. When I checked the properties of a few, it became clear why... they were all links back to themselves!!

Can anybody give me a hint as to how to undo the damage and get a configuration that will successfully run the Makefile?

zw flag

You should not touch file structure manually in places where files are controlled by APT. Remove and cancel all such manual interventions. Do not do this next time!

You have to (re)install relevant development package which owns bits/long-double.h file by

sudo apt-get install --reinstall libc6-dev

If you have massive damage then reinstall all the packages which provide includes by using below commands:

sudo apt-get install --reinstall $(dpkg -l | grep ^ii | grep "\-dev" | awk '{print $2}')
sudo apt-get install --reinstall $(dpkg -S /usr/include/ | sed 's/,//g' | sed 's/: \/usr\/include//g')
gb flag
Reinstalling libc6-dev did fix up the missing headers in `/usr/include/x86_64-linux-gnu/sys` but I still get the same make errors as before, because there is no directory called `usr/include/sys`. That was the reason for my creation of the symlink. (I suspect I got the syntax wrong.) After reading this page [] it seems to me that `usr/include/sys` should exist. I clearly need to do some more research on this.
N0rbert avatar
zw flag
My main question here - which application do you try to "make" in original question above? Can you please share a link to its sources?
gb flag
Sorry for the late reply... I cannot put the code in here. The main reason is that it is an internal project for the company. My colleagues would probably be upset to put it mildly. The company lets us choose which O/S to use and the others in the team use other flavours of Linux or they use Windows. I might have to try the more complex approach you describe, but before I do I want to figure out exactly what it does. I will let you know what happens.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.