Supporting multiple GNU toolchains
Tim Mooney
Tim.Mooney at ndsu.edu
Wed Nov 21 22:28:23 UTC 2012
In regard to: Re: Supporting multiple GNU toolchains, Kyle Kloepper said...:
> Are there any thoughts on how to best support multiple GNU toolchains?
Is this for internal use only, or do you want your spec file(s) for
your RPM(s) to be redistributable and generally useful to others?
Do you do all builds from a build account, or do different users (with
potentially different environment settings) need to be able to do rpm builds?
I personally would be annoyed by having to edit the spec file to switch
which build environment is used. You could obviate the need for setting
_CC and _CXX in your macros.toolchain and allow it to be overridden on
the command line by using something like
%configure \
CC=%{?!_CC: %define _CC /opt/gcc4_6/bin/gcc}; export CC; \
CXX=%{?!_CXX: %define _CXX /opt/gcc4_6/bin/g++}; export CXX; \
...
and then doing something like
rpmbuild --define '%_CC /usr/bin/gcc' --define '%_CXX /usr/bin/g++'
(you may not need the % for each macro with --define. I don't know, as
this isn't something I typically use and I haven't tested it).
However, is all of that machinery really any better than just exporting
CC and CXX in your environment before you run rpmbuild?
Tim
> 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
>
>
--
Tim Mooney Tim.Mooney at ndsu.edu
Enterprise Computing & Infrastructure 701-231-1076 (Voice)
Room 242-J6, IACC Building 701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164
More information about the Rpm-list
mailing list