1 |
On Wed, Mar 11, 2020 at 12:49 AM Sergei Trofimovich <slyfox@g.o> |
2 |
wrote: |
3 |
|
4 |
> On Tue, 10 Mar 2020 20:54:12 -0700 |
5 |
> Manoj Gupta <manojgupta@××××××.com> wrote: |
6 |
> |
7 |
> > On Tue, Mar 3, 2020 at 1:17 AM Sergei Trofimovich <slyfox@g.o> |
8 |
> wrote: |
9 |
> > |
10 |
> > > On Mon, 2 Mar 2020 19:03:48 -0800 |
11 |
> > > Manoj Gupta <manojgupta@××××××.com> wrote: |
12 |
> > > |
13 |
> > > > On Thu, Feb 27, 2020 at 11:20 PM Sergei Trofimovich < |
14 |
> slyich@×××××.com> |
15 |
> > > > wrote: |
16 |
> > > > |
17 |
> > > > > On Thu, 27 Feb 2020 at 22:41, Manoj Gupta <manojgupta@××××××.com> |
18 |
> |
19 |
> > > wrote: |
20 |
> > > > > > |
21 |
> > > > > > |
22 |
> > > > > > |
23 |
> > > > > > On Thu, Feb 27, 2020 at 11:22 AM Manoj Gupta < |
24 |
> manojgupta@××××××.com> |
25 |
> > > |
26 |
> > > > > wrote: |
27 |
> > > > > >> |
28 |
> > > > > >> gcc-config installs cc/f77 by default. This may be undesired on |
29 |
> > > > > >> systems that want to set their own versions of cc/f77. |
30 |
> > > > > >> |
31 |
> > > > > >> Add option "-n"/"--no-default-vars" to not install the cc/f77 |
32 |
> > > > > >> wrappers. |
33 |
> > > > > >> |
34 |
> > > > > >> Signed-off-by: Manoj Gupta <manojgupta@××××××.com> |
35 |
> > > > > >> --- |
36 |
> > > > > >> gcc-config | 6 +++++- |
37 |
> > > > > >> 1 file changed, 5 insertions(+), 1 deletion(-) |
38 |
> > > > > >> |
39 |
> > > > > >> diff --git a/gcc-config b/gcc-config |
40 |
> > > > > >> index f03a46a..6f306db 100755 |
41 |
> > > > > >> --- a/gcc-config |
42 |
> > > > > >> +++ b/gcc-config |
43 |
> > > > > >> @@ -262,7 +262,7 @@ update_wrappers() { |
44 |
> > > > > >> # For all toolchains, we want to create the fully |
45 |
> qualified |
46 |
> > > > > >> # `tuple-foo`. Only native ones do we want the simple |
47 |
> > > `foo`. |
48 |
> > > > > >> local all_wrappers=( ${new_wrappers[@]/#/${CTARGET}-} ) |
49 |
> > > > > >> - if ! is_cross_compiler ; then |
50 |
> > > > > >> + if ! is_cross_compiler && [[ "${DEFAULT_PROGS}" == |
51 |
> "yes" |
52 |
> > > ]]; |
53 |
> > > > > then |
54 |
> > > > > >> all_wrappers+=( "${new_wrappers[@]}" ) |
55 |
> > > > > >> # There are a few fun extra progs which we have |
56 |
> to |
57 |
> > > > > handle #412319 |
58 |
> > > > > >> all_wrappers+=( cc:gcc f77:g77 ) |
59 |
> > > > > >> @@ -951,6 +951,7 @@ FORCE="no" |
60 |
> > > > > >> CC_COMP= |
61 |
> > > > > >> ENV_D="${EROOT}etc/env.d" |
62 |
> > > > > >> GCC_ENV_D="${ENV_D}/gcc" |
63 |
> > > > > >> +DEFAULT_PROGS="yes" |
64 |
> > > > > >> |
65 |
> > > > > >> for x in "$@" ; do |
66 |
> > > > > >> case "${x}" in |
67 |
> > > > > >> @@ -972,6 +973,9 @@ for x in "$@" ; do |
68 |
> > > > > >> -l|--list-profiles) |
69 |
> > > > > >> set_doit list_profiles |
70 |
> > > > > >> ;; |
71 |
> > > > > >> + -n|--no-default-vars) |
72 |
> > > > > >> + DEFAULT_PROGS="no" |
73 |
> > > > > >> + ;; |
74 |
> > > > > >> -S|--split-profile) |
75 |
> > > > > >> if [[ ( $1 != "-S" && $1 != |
76 |
> > > "--split-profile" ) |
77 |
> > > > > || $# -eq 1 ]] ; then |
78 |
> > > > > >> usage 1 |
79 |
> > > > > >> -- |
80 |
> > > > > >> |
81 |
> > > > > > |
82 |
> > > > > > Not sure of the correct mailing list for patches to gcc-config |
83 |
> so |
84 |
> > > also |
85 |
> > > > > adding toolchain@gentoo . |
86 |
> > > > > > |
87 |
> > > > > |
88 |
> > > > > toolchain@g.o should generally be fine. |
89 |
> > > > > |
90 |
> > > > > Today cc->gcc and gcc->${CHOST}-gcc symlinks are effectively owned |
91 |
> by |
92 |
> > > > > a single sys-devel/gcc-config package. |
93 |
> > > > > gcc-config is calld to update symlinks every time sys-devel/gcc is |
94 |
> > > > > installed/updated. That way we never get cc/gcc |
95 |
> > > > > out of sync. |
96 |
> > > > > |
97 |
> > > > > Your change makes /usr/bin/cc an orphan symlink. I think we need to |
98 |
> > > > > still keep a 'cc'/'f77' ownership somewhere |
99 |
> > > > > (say, a separate package). |
100 |
> > > > > |
101 |
> > > > > I suggest making a decision to handle or not handle 'cc'/'f77' and |
102 |
> > > > > gcc-config build-time, not gcc-config call-time. |
103 |
> > > > > That way sys-devel/gcc updates will behave the same as manual |
104 |
> > > > > 'gcc-config-' calls. |
105 |
> > > > > |
106 |
> > > > > Mechanically that could be a Makefile variable that switches the |
107 |
> > > > > behaviour on/off at |
108 |
> > > > > https://gitweb.gentoo.org/proj/gcc-config.git/tree/Makefile |
109 |
> > > > > and exposed as an USE flag on sys-devel/gcc-config ebuild. |
110 |
> > > > > |
111 |
> > > > > Later we can create a separate ebuild to manage /usr/bin/cc. For |
112 |
> gcc |
113 |
> > > > > it's not hard, as gcc-config always provides /usr/bin/gcc and |
114 |
> > > > > /usr/bin/${CHOST}-gcc. |
115 |
> > > > > These can be static symlinks that don't require maintenance |
116 |
> updates. |
117 |
> > > > > |
118 |
> > > > > Thanks for the suggestion. I will look into adding a Makefile |
119 |
> > > variable |
120 |
> > > > exposed via an USE flag. |
121 |
> > > |
122 |
> > > You might also need to look in the detail at 'c++', 'cpp' and |
123 |
> ${CHOST}-* |
124 |
> > > equivalents |
125 |
> > > as those also get linked by gcc-config: |
126 |
> > > |
127 |
> > > $ LANG=C ls -l /usr/bin/ | fgrep 10.0.1 | fgrep -v -- '-10.0.1 ->' |
128 |
> > > lrwxrwxrwx 1 root root 43 Feb 4 10:45 c++ -> |
129 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/c++ |
130 |
> > > lrwxrwxrwx 1 root root 43 Feb 4 10:45 cc -> |
131 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc |
132 |
> > > lrwxrwxrwx 1 root root 43 Feb 4 10:45 cpp -> |
133 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/cpp |
134 |
> > > lrwxrwxrwx 1 root root 43 Feb 4 10:45 g++ -> |
135 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/g++ |
136 |
> > > lrwxrwxrwx 1 root root 43 Feb 4 10:45 gcc -> |
137 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc |
138 |
> > > lrwxrwxrwx 1 root root 46 Feb 4 10:45 gcc-ar -> |
139 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc-ar |
140 |
> > > lrwxrwxrwx 1 root root 46 Feb 4 10:45 gcc-nm -> |
141 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc-nm |
142 |
> > > lrwxrwxrwx 1 root root 50 Feb 4 10:45 gcc-ranlib -> |
143 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcc-ranlib |
144 |
> > > lrwxrwxrwx 1 root root 45 Feb 4 10:45 gccgo -> |
145 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gccgo |
146 |
> > > lrwxrwxrwx 1 root root 44 Feb 4 10:45 gcov -> |
147 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov |
148 |
> > > lrwxrwxrwx 1 root root 49 Feb 4 10:45 gcov-dump -> |
149 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov-dump |
150 |
> > > lrwxrwxrwx 1 root root 49 Feb 4 10:45 gcov-tool -> |
151 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov-tool |
152 |
> > > lrwxrwxrwx 1 root root 48 Feb 4 10:45 gfortran -> |
153 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gfortran |
154 |
> > > lrwxrwxrwx 1 root root 45 Feb 4 10:45 go-10 -> |
155 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/go-10 |
156 |
> > > lrwxrwxrwx 1 root root 48 Feb 4 10:45 gofmt-10 -> |
157 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gofmt-10 |
158 |
> > > lrwxrwxrwx 1 root root 48 Feb 4 10:45 lto-dump -> |
159 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/lto-dump |
160 |
> > > lrwxrwxrwx 1 root root 63 Feb 4 10:45 |
161 |
> x86_64-pc-linux-gnu-c++ |
162 |
> > > -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-c++ |
163 |
> > > lrwxrwxrwx 1 root root 63 Feb 4 10:45 |
164 |
> x86_64-pc-linux-gnu-cpp |
165 |
> > > -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-cpp |
166 |
> > > lrwxrwxrwx 1 root root 63 Feb 4 10:45 |
167 |
> x86_64-pc-linux-gnu-g++ |
168 |
> > > -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-g++ |
169 |
> > > lrwxrwxrwx 1 root root 63 Feb 4 10:45 |
170 |
> x86_64-pc-linux-gnu-gcc |
171 |
> > > -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gcc |
172 |
> > > lrwxrwxrwx 1 root root 66 Feb 4 10:45 |
173 |
> > > x86_64-pc-linux-gnu-gcc-ar -> |
174 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gcc-ar |
175 |
> > > lrwxrwxrwx 1 root root 66 Feb 4 10:45 |
176 |
> > > x86_64-pc-linux-gnu-gcc-nm -> |
177 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gcc-nm |
178 |
> > > lrwxrwxrwx 1 root root 70 Feb 4 10:45 |
179 |
> > > x86_64-pc-linux-gnu-gcc-ranlib -> |
180 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gcc-ranlib |
181 |
> > > lrwxrwxrwx 1 root root 65 Feb 4 10:45 |
182 |
> > > x86_64-pc-linux-gnu-gccgo -> |
183 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gccgo |
184 |
> > > lrwxrwxrwx 1 root root 64 Feb 4 10:45 |
185 |
> > > x86_64-pc-linux-gnu-gcov -> |
186 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gcov |
187 |
> > > lrwxrwxrwx 1 root root 49 Feb 4 10:45 |
188 |
> > > x86_64-pc-linux-gnu-gcov-dump -> |
189 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov-dump |
190 |
> > > lrwxrwxrwx 1 root root 49 Feb 4 10:45 |
191 |
> > > x86_64-pc-linux-gnu-gcov-tool -> |
192 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gcov-tool |
193 |
> > > lrwxrwxrwx 1 root root 68 Feb 4 10:45 |
194 |
> > > x86_64-pc-linux-gnu-gfortran -> |
195 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/x86_64-pc-linux-gnu-gfortran |
196 |
> > > lrwxrwxrwx 1 root root 45 Feb 4 10:45 |
197 |
> > > x86_64-pc-linux-gnu-go-10 -> |
198 |
> /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/go-10 |
199 |
> > > lrwxrwxrwx 1 root root 48 Feb 4 10:45 |
200 |
> > > x86_64-pc-linux-gnu-gofmt-10 -> |
201 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/gofmt-10 |
202 |
> > > lrwxrwxrwx 1 root root 48 Feb 4 10:45 |
203 |
> > > x86_64-pc-linux-gnu-lto-dump -> |
204 |
> > > /usr/x86_64-pc-linux-gnu/gcc-bin/10.0.1/lto-dump |
205 |
> > > |
206 |
> > > > Regarding the separate ebuild, I hope someone more knowledgeable |
207 |
> > > > than me regarding ebuilds can handle that. |
208 |
> > > |
209 |
> > > How do you plan to manage those symlinks meanwhile? |
210 |
> > > |
211 |
> > > I guess there is a confusion in the scope of change I want to do. |
212 |
> > |
213 |
> > GCC package does not provide cc and f77 binaries or symlinks. These are |
214 |
> > provided by the gcc-config |
215 |
> > which adds /usr/bin/cc and /usr/bin/f77. |
216 |
> > These are not needed for building packages via portage but were added |
217 |
> > in https://bugs.gentoo.org/412319 just because it is nice to ensure that |
218 |
> > invocations like |
219 |
> > $ make |
220 |
> > work as is without setting CC explicitly e.g. |
221 |
> > $ CC=gcc make |
222 |
> |
223 |
> I'm afraid "not needed" is desired but not strictly true. I keep seeing |
224 |
> packages that use 'cc' accidentally (dev-util/radare2) or explicitly. |
225 |
> Don't know if most of them can safely fall back to 'gcc' at ./configure |
226 |
> time. I suspect many don't. |
227 |
> |
228 |
> > I only want to change gcc-config to NOT create /usr/bin/cc and |
229 |
> /usr/bin/f77 |
230 |
> > via an option. |
231 |
> > Everything else stays unchanged. |
232 |
> |
233 |
> I see. Initially you said you want to set your own 'cc' and 'f77' wrapper. |
234 |
> Can you clarify what is the motivation to change only a subset of programs? |
235 |
> Maybe describe whole intended setup? |
236 |
> |
237 |
> This is only for Chrome OS setup where I want to switch "cc" to point to |
238 |
clang or a different compiler (Switching will be done using a |
239 |
different ebuild not used in Gentoo). |
240 |
I do not want to disturb Gentoo's current setup in any way other than |
241 |
adding an option to "gcc-config" |
242 |
that will serve our needs. |
243 |
|
244 |
It feels very dangerous to have 'cc' point to one compiler (manually set) |
245 |
> and 'c99' to another ('gcc'). |
246 |
> We will start producing more inconsistent environments than we do today. |
247 |
> |
248 |
> Not installing 'cc'/'f77' at all might be less bad. |
249 |
> |
250 |
|
251 |
Yes, this is exactly what I'd like but some internal teams want '$ make' to |
252 |
work |
253 |
as is. This option to "not install" these links will be a good first step |
254 |
to find out |
255 |
if there are any packages relying on 'cc' being present in Chrome OS builds. |
256 |
|
257 |
Thanks, |
258 |
Manoj |
259 |
|
260 |
|
261 |
> -- |
262 |
> |
263 |
> Sergei |
264 |
> |