Gentoo Archives: gentoo-dev

From: Manoj Gupta <manojgupta@××××××.com>
To: Sergei Trofimovich <slyfox@g.o>
Cc: gentoo-dev@l.g.o, Mike Frysinger <vapier@g.o>, toolchain@g.o
Subject: [gentoo-dev] Re: [PATCH] gcc-config: Add option to not install cc/f77 wrappers.
Date: Wed, 11 Mar 2020 03:54:31
Message-Id: CAH=Qcsjhg+OR_cMoMbHzG_m_85y3n4=+qFcK-XGw0XO7q=Ycpw@mail.gmail.com
In Reply to: [gentoo-dev] Re: [PATCH] gcc-config: Add option to not install cc/f77 wrappers. by Sergei Trofimovich
1 On Tue, Mar 3, 2020 at 1:17 AM Sergei Trofimovich <slyfox@g.o> wrote:
2
3 > On Mon, 2 Mar 2020 19:03:48 -0800
4 > Manoj Gupta <manojgupta@××××××.com> wrote:
5 >
6 > > On Thu, Feb 27, 2020 at 11:20 PM Sergei Trofimovich <slyich@×××××.com>
7 > > wrote:
8 > >
9 > > > On Thu, 27 Feb 2020 at 22:41, Manoj Gupta <manojgupta@××××××.com>
10 > wrote:
11 > > > >
12 > > > >
13 > > > >
14 > > > > On Thu, Feb 27, 2020 at 11:22 AM Manoj Gupta <manojgupta@××××××.com>
15 >
16 > > > wrote:
17 > > > >>
18 > > > >> gcc-config installs cc/f77 by default. This may be undesired on
19 > > > >> systems that want to set their own versions of cc/f77.
20 > > > >>
21 > > > >> Add option "-n"/"--no-default-vars" to not install the cc/f77
22 > > > >> wrappers.
23 > > > >>
24 > > > >> Signed-off-by: Manoj Gupta <manojgupta@××××××.com>
25 > > > >> ---
26 > > > >> gcc-config | 6 +++++-
27 > > > >> 1 file changed, 5 insertions(+), 1 deletion(-)
28 > > > >>
29 > > > >> diff --git a/gcc-config b/gcc-config
30 > > > >> index f03a46a..6f306db 100755
31 > > > >> --- a/gcc-config
32 > > > >> +++ b/gcc-config
33 > > > >> @@ -262,7 +262,7 @@ update_wrappers() {
34 > > > >> # For all toolchains, we want to create the fully qualified
35 > > > >> # `tuple-foo`. Only native ones do we want the simple
36 > `foo`.
37 > > > >> local all_wrappers=( ${new_wrappers[@]/#/${CTARGET}-} )
38 > > > >> - if ! is_cross_compiler ; then
39 > > > >> + if ! is_cross_compiler && [[ "${DEFAULT_PROGS}" == "yes"
40 > ]];
41 > > > then
42 > > > >> all_wrappers+=( "${new_wrappers[@]}" )
43 > > > >> # There are a few fun extra progs which we have to
44 > > > handle #412319
45 > > > >> all_wrappers+=( cc:gcc f77:g77 )
46 > > > >> @@ -951,6 +951,7 @@ FORCE="no"
47 > > > >> CC_COMP=
48 > > > >> ENV_D="${EROOT}etc/env.d"
49 > > > >> GCC_ENV_D="${ENV_D}/gcc"
50 > > > >> +DEFAULT_PROGS="yes"
51 > > > >>
52 > > > >> for x in "$@" ; do
53 > > > >> case "${x}" in
54 > > > >> @@ -972,6 +973,9 @@ for x in "$@" ; do
55 > > > >> -l|--list-profiles)
56 > > > >> set_doit list_profiles
57 > > > >> ;;
58 > > > >> + -n|--no-default-vars)
59 > > > >> + DEFAULT_PROGS="no"
60 > > > >> + ;;
61 > > > >> -S|--split-profile)
62 > > > >> if [[ ( $1 != "-S" && $1 !=
63 > "--split-profile" )
64 > > > || $# -eq 1 ]] ; then
65 > > > >> usage 1
66 > > > >> --
67 > > > >>
68 > > > >
69 > > > > Not sure of the correct mailing list for patches to gcc-config so
70 > also
71 > > > adding toolchain@gentoo .
72 > > > >
73 > > >
74 > > > toolchain@g.o should generally be fine.
75 > > >
76 > > > Today cc->gcc and gcc->${CHOST}-gcc symlinks are effectively owned by
77 > > > a single sys-devel/gcc-config package.
78 > > > gcc-config is calld to update symlinks every time sys-devel/gcc is
79 > > > installed/updated. That way we never get cc/gcc
80 > > > out of sync.
81 > > >
82 > > > Your change makes /usr/bin/cc an orphan symlink. I think we need to
83 > > > still keep a 'cc'/'f77' ownership somewhere
84 > > > (say, a separate package).
85 > > >
86 > > > I suggest making a decision to handle or not handle 'cc'/'f77' and
87 > > > gcc-config build-time, not gcc-config call-time.
88 > > > That way sys-devel/gcc updates will behave the same as manual
89 > > > 'gcc-config-' calls.
90 > > >
91 > > > Mechanically that could be a Makefile variable that switches the
92 > > > behaviour on/off at
93 > > > https://gitweb.gentoo.org/proj/gcc-config.git/tree/Makefile
94 > > > and exposed as an USE flag on sys-devel/gcc-config ebuild.
95 > > >
96 > > > Later we can create a separate ebuild to manage /usr/bin/cc. For gcc
97 > > > it's not hard, as gcc-config always provides /usr/bin/gcc and
98 > > > /usr/bin/${CHOST}-gcc.
99 > > > These can be static symlinks that don't require maintenance updates.
100 > > >
101 > > > Thanks for the suggestion. I will look into adding a Makefile
102 > variable
103 > > exposed via an USE flag.
104 >
105 > You might also need to look in the detail at 'c++', 'cpp' and ${CHOST}-*
106 > equivalents
107 > as those also get linked by gcc-config:
108 >
109 > $ LANG=C ls -l /usr/bin/ | fgrep 10.0.1 | fgrep -v -- '-10.0.1 ->'
110 > lrwxrwxrwx 1 root root 43 Feb 4 10:45 c++ ->
111 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/c++
112 > lrwxrwxrwx 1 root root 43 Feb 4 10:45 cc ->
113 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc
114 > lrwxrwxrwx 1 root root 43 Feb 4 10:45 cpp ->
115 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/cpp
116 > lrwxrwxrwx 1 root root 43 Feb 4 10:45 g++ ->
117 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/g++
118 > lrwxrwxrwx 1 root root 43 Feb 4 10:45 gcc ->
119 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc
120 > lrwxrwxrwx 1 root root 46 Feb 4 10:45 gcc-ar ->
121 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc-ar
122 > lrwxrwxrwx 1 root root 46 Feb 4 10:45 gcc-nm ->
123 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc-nm
124 > lrwxrwxrwx 1 root root 50 Feb 4 10:45 gcc-ranlib ->
125 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc-ranlib
126 > lrwxrwxrwx 1 root root 45 Feb 4 10:45 gccgo ->
127 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gccgo
128 > lrwxrwxrwx 1 root root 44 Feb 4 10:45 gcov ->
129 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov
130 > lrwxrwxrwx 1 root root 49 Feb 4 10:45 gcov-dump ->
131 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov-dump
132 > lrwxrwxrwx 1 root root 49 Feb 4 10:45 gcov-tool ->
133 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov-tool
134 > lrwxrwxrwx 1 root root 48 Feb 4 10:45 gfortran ->
135 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gfortran
136 > lrwxrwxrwx 1 root root 45 Feb 4 10:45 go-10 ->
137 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/go-10
138 > lrwxrwxrwx 1 root root 48 Feb 4 10:45 gofmt-10 ->
139 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gofmt-10
140 > lrwxrwxrwx 1 root root 48 Feb 4 10:45 lto-dump ->
141 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/lto-dump
142 > lrwxrwxrwx 1 root root 63 Feb 4 10:45 x86_64-pc-linux-gnu-c++
143 > -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-c++
144 > lrwxrwxrwx 1 root root 63 Feb 4 10:45 x86_64-pc-linux-gnu-cpp
145 > -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-cpp
146 > lrwxrwxrwx 1 root root 63 Feb 4 10:45 x86_64-pc-linux-gnu-g++
147 > -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-g++
148 > lrwxrwxrwx 1 root root 63 Feb 4 10:45 x86_64-pc-linux-gnu-gcc
149 > -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gcc
150 > lrwxrwxrwx 1 root root 66 Feb 4 10:45
151 > x86_64-pc-linux-gnu-gcc-ar ->
152 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gcc-ar
153 > lrwxrwxrwx 1 root root 66 Feb 4 10:45
154 > x86_64-pc-linux-gnu-gcc-nm ->
155 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gcc-nm
156 > lrwxrwxrwx 1 root root 70 Feb 4 10:45
157 > x86_64-pc-linux-gnu-gcc-ranlib ->
158 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gcc-ranlib
159 > lrwxrwxrwx 1 root root 65 Feb 4 10:45
160 > x86_64-pc-linux-gnu-gccgo ->
161 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gccgo
162 > lrwxrwxrwx 1 root root 64 Feb 4 10:45
163 > x86_64-pc-linux-gnu-gcov ->
164 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gcov
165 > lrwxrwxrwx 1 root root 49 Feb 4 10:45
166 > x86_64-pc-linux-gnu-gcov-dump ->
167 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov-dump
168 > lrwxrwxrwx 1 root root 49 Feb 4 10:45
169 > x86_64-pc-linux-gnu-gcov-tool ->
170 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov-tool
171 > lrwxrwxrwx 1 root root 68 Feb 4 10:45
172 > x86_64-pc-linux-gnu-gfortran ->
173 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gfortran
174 > lrwxrwxrwx 1 root root 45 Feb 4 10:45
175 > x86_64-pc-linux-gnu-go-10 -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/go-10
176 > lrwxrwxrwx 1 root root 48 Feb 4 10:45
177 > x86_64-pc-linux-gnu-gofmt-10 ->
178 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gofmt-10
179 > lrwxrwxrwx 1 root root 48 Feb 4 10:45
180 > x86_64-pc-linux-gnu-lto-dump ->
181 > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/lto-dump
182 >
183 > > Regarding the separate ebuild, I hope someone more knowledgeable
184 > > than me regarding ebuilds can handle that.
185 >
186 > How do you plan to manage those symlinks meanwhile?
187 >
188 > I guess there is a confusion in the scope of change I want to do.
189
190 GCC package does not provide cc and f77 binaries or symlinks. These are
191 provided by the gcc-config
192 which adds /usr/bin/cc and /usr/bin/f77.
193 These are not needed for building packages via portage but were added
194 in https://bugs.gentoo.org/412319 just because it is nice to ensure that
195 invocations like
196 $ make
197 work as is without setting CC explicitly e.g.
198 $ CC=gcc make
199
200 I only want to change gcc-config to NOT create /usr/bin/cc and /usr/bin/f77
201 via an option.
202 Everything else stays unchanged.
203
204 Thanks,
205 manoj
206
207
208 > --
209 >
210 > Sergei
211 >

Replies