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