[CentOS] Building for older versions

Mon Nov 23 15:43:24 UTC 2015
Chris Adams <linux at cmadams.net>

Once upon a time, Michael Eager <eager at eagerm.com> said:
> I'm trying to build an application on CentOS 7 which
> can run on older versions of CentOS.  I'm running into
> problems with versioning of memcpy in Glibc.  Executables
> built on CentOS 7 require memcpy from glibc-2.14, which
> causes the program not to load on systems with older
> versions of glibc.

Most shared libraries are "upwards compatible" but not "backwards
compatible" - builds against an old version will run with the new
version, but not the other way around.  You've found this with glibc,
but you could also run into it with other libraries.

> My online search suggests to add an asm() with a .symver
> option to select memcpy from glibc-2.2.5 in each of the
> source files which reference memcpy().  This isn't practical
> with a program with tens of thousands of source files.
> 
> Does anyone have a reasonable solution?

Would it be practical to use mock and build on the oldest version you
want to support?  This is how EPEL packages are built for example.  It
is targeted at building RPMs, but you can manually use copy-in and
copy-out to do other things.

-- 
Chris Adams <linux at cmadams.net>