Gentoo Archives: gentoo-amd64

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-amd64@l.g.o
Subject: [gentoo-amd64] Re: gcc in a multislot
Date: Sun, 01 Mar 2009 13:34:36
Message-Id: pan.2009.03.01.13.34.18@cox.net
In Reply to: [gentoo-amd64] gcc in a multislot by "P.V.Anthony"
1 "P.V.Anthony" <pvantony@×××××××××××.sg> posted
2 49AA7ABD.2040706@×××××××××××.sg, excerpted below, on Sun, 01 Mar 2009
3 20:08:29 +0800:
4
5 > I need to have two gcc. One the standard, that comes with gentoo. The
6 > other that is needed only gcc with vanilla flag.
7 >
8 > In a harden gentoo, there is more than one gcc and the gcc can be
9 > selected by using gcc-config.
10 >
11 > In the current server, there is only a standard gentoo gcc. I would like
12 > to install a gcc with vanilla flag. Plus be able to select them using
13 > gcc-config.
14 >
15 > The gcc should be the same version.
16 >
17 > How can this be done?.
18
19 Normally, the gcc-version is what gcc-config changes and you'd need to
20 have at least a micro-version (4.3.0, 4.3.1, and this would require
21 USE=multislot or it'd be 4.2 and 4.3) difference.
22
23 However, gcc-config also changes what (IIRC) are called the spec files,
24 which give gcc some defaults to work with, without having to put it all
25 in the C(XX)FLAGS. Normally these will be system-wide and there's only
26 one per version, but based on various things I've read including your
27 comment above, hardened apparently sets up (at least) two spec files for
28 each version, a hardened and a normal config, allowing you to switch
29 between them. This is somewhat different than a vanilla gcc, however,
30 since it's switching the spec file, but (I believe) using the same gcc
31 binary as compiled from the ebuild -- I do not believe it actually
32 compiles gcc twice, hardened and normal, just changes the spec file
33 invoked when gcc is called.
34
35 I'm not familiar with hardened or with the spec files or the technology
36 behind them directly, so that's about all I know. However, it should be
37 possible to start from a gcc ebuild and follow the code path from there
38 back thru the eclasses, the hardened profile, and gcc-config itself, to
39 see what exactly gcc-config does and how it switches versions and spec
40 files, and use that to create manually a gcc-config profile to switch
41 between gcc-gentoo and gcc-vanilla as appropriate.
42
43 However, a MUCH simpler approach would be to copy one of the gcc ebuilds
44 to your overlay, then reversion it to something like say 4.3.99
45 (something quite unlikely to actually appear, thus causing a versioning
46 conflict) but setup so it uses the 4.3.3 (or whatever) sources. You
47 could then use USE=multislot to get them both slotted onto your machine,
48 setting one up with USE=vanilla as well. That would setup a gcc-config
49 profile for both, so you could switch between them as you normally
50 would. This is what I'd try here if I were doing it as it should be a
51 relatively straightforward ebuild hack to create an overlay 4.3.99 or
52 whatever out of 4.3.3 or whatever, and the rest is easy enough with
53 USE=multislot for both and USE=vanilla for one of the two, with gcc-
54 config and the package management system (portage or alternative) doing
55 the rest.
56
57 --
58 Duncan - List replies preferred. No HTML msgs.
59 "Every nonfree program has a lord, a master --
60 and if you use the program, he is your master." Richard Stallman