Glibc vs GCC vs binutils compatibility

10,081

it's extremely unlikely you'll be able to build such an old version of glibc with such a new version of gcc. glibc documents the min required version of binutils & gcc in its INSTALL file.

glibc-2.23 states:

Recommended Tools for Compilation
GCC 4.7 or newer
GNU 'binutils' 2.22 or later

typically if you want to go newer than those, glibc will generally work with the version of gcc that was in development at the time of the release. e.g. glibc-2.23 was released 18 Feb 2016 and gcc-6 was under development at that time, so glibc-2.23 will work with gcc-4.7 through gcc-6.

so find the version of gcc you want, then find its release date, then look at the glibc releases from around the same time.

all that said, using an old version of glibc is a terrible idea. it will be full of known security vulnerabilities (include remotely exploitable ones). the latest glibc-2.23 release for example fixed CVE-2015-7547 which affects any application doing DNS network resolution and affects versions starting with glibc-2.9. remember: this is not the only bug lurking.

Share:
10,081
scrutari
Author by

scrutari

Updated on July 07, 2022

Comments

  • scrutari
    scrutari almost 2 years

    Is there a sort of official documentation about version compatibility between binutils, glibc and GCC? I found this matrix for binutils vs GCC version compatibility. It would be good to have something like this for GCC vs glibc as well.

    The point I'm asking this for is that I need to know if I can build, say, cross GCC 4.9.2 with "embedded" glibc 2.2.4 to be able to support quite old targets like CentOS 5.

    Thank you.

  • Vinny
    Vinny over 4 years
    Why would you by unable to build an older version of glibc with a much newer version of gcc? (That is not to say that the much newer version of gcc will be able to use said old version of glibc internally, but if I wanted to build an executable for CentOS 5, as the OP states, shouldn't I be able to use even say, GCC 9, checkout the source for glibc 2.22 and build glibc 2.22. Then to build app for CentOS 5, I would compile source with GCC 9, and applicably old -std=c99, and then manually link using LDFLAGS=-nostdlib, and LDLIBS=-l:libc.so.2.2.2?
  • Mike Frysinger
    Mike Frysinger about 4 years
    there have been many known issues whereby a newer gcc miscompiles an older glibc because glibc relies on behavior that has changed (sometimes on purpose, sometimes by incidentally). it can either fail to compile entirely, or it'll compile & then simply crash when executed. the further apart the releases, the more likely this is to happen.