Search code examples
glibcrpmbuildrhel7rhel6

Maintaining binary compatibility with previous versions


Apologies if this is more Server Fault than SO, but it is related to coding so here goes...

I have someone else's code that I am trying to compile on RHEL 7 but will run (for the moment at least) on RHEL 6. I've written my own RPM spec file to build and output an RPM file. The RPM builds fine on both RHEL 6 and RHEL 7 but when I build it on RHEL 7, does not produce an RPM which can be installed on RHEL 6 due to versions of GLIBC.

Is there a simple switch I can add to the build somewhere which will allow the resulting binary to be satisfied with an earlier version of GLIBC and be able to be installed on RHEL 6?

To be clear, I don't actually need a RHEL 7 binary at present, I'd just like to be able to compile for RHEL 6 on a RHEL 7 dev box.


Solution

  • You can use mock (sadly only in EPEL) to create a Red Hat Enterprise Linux 6 chroot on your Red Hat Enterprise Linux 7 system. If you use only libraries with Tier 1 ABI compatibility, your application will continue to run on Red Hat Enterprise Linux 7 without recompilation. Building on the oldest supported release (from the application point of view) is really the only way to do this. If you need a more recent C++ compiler and that's the reason why you are building on Red Hat Enterprise Linux 7, consider using Developer Toolset (DTS) instead.

    Tier 1 libraries are described in the Application Compatibility Guide. There is supposed to be a PDF attachment with the previous list of packages, but I cannot access this right now.