Supporting multiple GNU toolchains

Kyle Kloepper Kyle.Kloepper at riverbed.com
Mon Nov 19 17:33:23 UTC 2012


Are there any thoughts on how to best support multiple GNU toolchains?

-Kyle

From: Kyle Kloepper <kyle.kloepper at riverbed.com<mailto:kyle.kloepper at riverbed.com>>
Date: Tuesday, November 13, 2012 4:16 PM
To: "rpm-list at lists.rpm.org<mailto:rpm-list at lists.rpm.org>" <rpm-list at lists.rpm.org<mailto:rpm-list at lists.rpm.org>>
Subject: Supporting multiple GNU toolchains

In my build environment I have multiple GNU toolchains. For instance gcc 4.4 to compile kernel, 4.6 for general programs, and 4.7 for experimental work.

To make full use of these toolchains when packaging components, I am looking to do two things:

  1.  Set a default toolchain used by all invocations of rpmbuild (which may or may not be the same toolchain used when I compile outside of rpmbuild)
  2.  Allow a SPEC file to easily select a specific toolchain to use. This selection would override the default toolchain for the machine

My plan to accomplish this was to redefine the %configure macro in /etc/rpm/macros.toolchain and add the following:

%_CC /opt/gcc4_6/bin/gcc
%_CXX /opt/gcc4_6/bin/g++
%configure \
  CC=%{_CC} ; export CC ; \
  CXX=%{_CXX} ; export CXX ; \
  ...

Then in a specific SPEC file the toolchain could be selected by changing the %_CC and %_CXX variables:

...
%define _CC /usr/bin/gcc
%define _CXX /usr/bin/g++
...

Is this the best way to allow multiple toolchains to coexist for packaging with RPM?

-Kyle

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-list/attachments/20121119/732cccfc/attachment.html>


More information about the Rpm-list mailing list