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