1

I am getting this error when I try to compile a C program on Ubuntu:

$ gcc aa.c
aa.c:1:9: fatal error: stdio.h: No such file or directory
 #include<stdio.h>
         ^--------
compilation terminated.

I tried to install libc6-dev and got this:

$ sudo apt-get install libc6-dev
...
The following packages have unmet dependencies:
 libc6-dev : Depends: libc6 (= 2.27-3ubuntu1) but 2.29-10 is to be installed
             Depends: libc-dev-bin (= 2.27-3ubuntu1)
E: Unable to correct problelms, you have held broken packages.

I have tried: sudo dpkg --configure -a, and I got no output.

and

sudo apt-get install -f

and

sudo apt-get clean && sudo apt-get update

and

sudo apt-get upgrade

and

sudo apt-get dist-upgrade

above four codes got the same output:

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

After using all those commands I get the same fatal error when compiling.

apt policy libc6-dev libc6

o/p:

libc6-dev:
  Installed: (none)
  Candidate: 2.27-3ubuntu1
  Version table:
     2.27-3ubuntu1 500
        500 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
libc6:
  Installed: 2.29-10
  Candidate: 2.29-10
  Version table:
 *** 2.29-10 100
        100 /var/lib/dpkg/status
     2.27-3ubuntu1 500
        500 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
3
  • You are on the correct path. You need to install that library. Commented Mar 16, 2020 at 14:33
  • Do you remember where your libc 2.29-10 came from, and why you installed it? Commented Mar 16, 2020 at 15:17
  • no :( @StephenKitt
    – groot
    Commented Mar 16, 2020 at 16:01

1 Answer 1

1

You’ve somehow ended up with the current Debian testing version of libc6, not any Ubuntu version. Presumably there’s a reason for that, so changing it might break something.

At this point you have two options:

  • downgrade libc6 to the Ubuntu version:

    sudo apt install libc6=2.27-3ubuntu1
    

    which will also require downgrading related packages (apt will tell you which ones, but I imagine you’d have at least libc-bin and locales)

    or

  • install the Debian testing libc6-dev package:

    wget http://ftp.fr.debian.org/debian/pool/main/g/glibc/libc6-dev_2.29-10_amd64.deb http://ftp.fr.debian.org/debian/pool/main/g/glibc/libc6-dev-bin_2.29-10_amd64.deb
    sudo apt install ./libc6-dev_2.29-10_amd64.deb ./libc6-dev-bin_2.29-10_amd64.deb
    

I would recommend reverting to the Ubuntu version, if only to make your next distribution upgrade simpler, but that might have other more immediate consequences.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .