When I have installed gcc 5.1.0, I found lots of my programs cannot be used, such as firefox, gnome: they will give me a message "GLIBC_2.1X not found". Now the version of GLIBC is higher than before, so these programs cannot be used. I think it is because the install of gcc 5.1.0 makes the version of GLIBC higher.

What should I do to save my Linux and make gcc so that my old software can normally be used?

  • The way to recover from this depends on your distribution and the steps you took to install gcc5. Could you add these details to your question? – Mark Plotnick Jul 15 '15 at 18:37

Problem

You've run into the circular dependency problem, in a big way. I copied this from another of my answers, because just linking it doesn't do this justice. The issue occurs whether you installed a binary version of GCC 5.1.0, or if you compiled it from source. The discussion below occurs because every package on your system, binary or not, implicitly depends on GLIBC because GLIBC contains the symbols and the internationalization codes needed by every package on your system. The major examples are:

  1. Language Encoding
  2. Currency Symbol
  3. Date Format
  4. Counting Format
  5. Decimal Separator position
  6. Separator Type, comma decimal etc.

Upgrading GCC upgrades GLIBC, and upgrading GLIBC breaks the above list and more. The only way to fix this is to recompile or reinstall every package on your system after upgrading GCC and GLIBC, starting with the toolchain - Ubuntu Specific - Binary Distribution Types, and a General Description of a Toolchain.


It's nearly impossible to mix a source based package with a system based on binary packages, as you easily create a version mismatch. Consider the following:

  1. Binary package Version A depends on and only works with dependency Version B. Dependency Version B uses Library C.
  2. Connecting the Logic in 1, Binary Package Version A, also implicitly depends on Library C.
  3. You built dependency Version B with library Version D (If C = 1.0, D = 1.1)
  4. Dependency Version B built successfully, but Binary Package Version A is still linked to Library Version C, therefore Binary Package A, now loads unresolved symbols, because the symbols in Library Version C were replaced with newer symbols in Version D.
  5. Library Version D, superseded Library Version C, therefore the developer decided not to link his new Version D to Version C.
  6. To Fix this, every package on the system, that is linked to library Version C, must be recompiled using Library Version D.

You're Stuck Here because all the packages on a Binary System were prepackaged, and some or all of them will break, when compiled from source

Solution

Try downgrading gcc-5.1.0 and GLIBC with your package manager tools. If your package manager doesn't work, it would be easier to reinstall your distribution than it would be to work backwards.

You can compile gcc without upgrading the GLIBC. I did it numerous times and usually you just need a recent enough version of the binutils, gmp, mpfr and mpc. Actually, these have nothing to do with each other. By that, I mean that there is no reason to change or recompile GLIBC if you change your version of gcc.

However, if you do install a gcc version you compiled yourself, never do it system-wide: this can be as bad as bluntly changing the GLIBC. Instead, you can keep a working version of gcc in your home and provide runtime information to link to the right libraries (by tweaking LD_LIBRARY_PATH).

Now, GLIBC is backward-compatible, not forward-compatible (to a certain extent at least). If no GLIBC update has been done by yourself, that simply means that the problem is that the gcc version you installed has been compiled with a newer GLIBC. On my system, firefox for instance is linked to:

linux-vdso.so.1 (0x00007fff92d8a000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007ff8a7711000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007ff8a750d000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007ff8a718b000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007ff8a6e87000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007ff8a6ae5000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff8a792e000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007ff8a68cf000)

and most of them are provided by gcc (hence the GLIBC error in firefox which is actually raised by gcc).

The second possibility is that you updated GLIBC (depending on how you installed gcc, this can be as easy as there was a more recent version of GLIBC in the repository you used). In that case, that shouldn't be a problem: programs compiled with prior versions of GLIBC should work with newer versions (to a limited extent). However, some programs keep reference to a very specific versions of GLIBC for various reasons. So that could also be it.


To revert that mess...

If you used an external repository and you can still install packages, just remove the repository and downgrade.

If you installed gcc manually, you can always try to reinstall the repo version of it. But don't have too much hope: you might need to reinstall your distrib.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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