unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#47648: cc-for-target makes --with-c-toolchain unusable for some packages
@ 2021-04-08  0:33 raingloom
  2021-04-12  9:47 ` Maxime Devos
  0 siblings, 1 reply; 2+ messages in thread
From: raingloom @ 2021-04-08  0:33 UTC (permalink / raw)
  To: 47648

I tried compiling lua with clang on a whim and found out about
cc-for-target. Not sure if that's the only instance of hardcoded gcc,
but it's certainly a prominent one.

What would be the idiomatic way to fix it? Detect clang dynamically? Or
move cc-for-target inside the build system module and make it available
at build time?




^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#47648: cc-for-target makes --with-c-toolchain unusable for some packages
  2021-04-08  0:33 bug#47648: cc-for-target makes --with-c-toolchain unusable for some packages raingloom
@ 2021-04-12  9:47 ` Maxime Devos
  0 siblings, 0 replies; 2+ messages in thread
From: Maxime Devos @ 2021-04-12  9:47 UTC (permalink / raw)
  To: raingloom, 47648

[-- Attachment #1: Type: text/plain, Size: 1398 bytes --]

On Thu, 2021-04-08 at 02:33 +0200, raingloom wrote:
> I tried compiling lua with clang on a whim and found out about
> cc-for-target. Not sure if that's the only instance of hardcoded gcc,
> but it's certainly a prominent one.

A little more information:
this is not specific to cc-for-target.  Try searching for "CC=gcc".

Most uses of "CC=gcc" are incorrect when cross-compiling.  When
cross-compiling, these should be "CC=ARCHITECTURE-linux-gnu-gcc" or
something like that.  The "cc-for-target" procedure outputs the correct
string.

> What would be the idiomatic way to fix it? Detect clang dynamically? Or
> move cc-for-target inside the build system module and make it available
> at build time?

To avoid massive rebuilds, perhaps the procedure "cc-for-target" could be
replaced with a macro "cc-for-target" that accesses the native-inputs of
this-package to determine whether it should output "CC=gcc" /
"CC=ARCHITECTURE-linux-gnu-gcc" or "CC=clang" / "CC=ARCHITECTURE-linux-gnu-clang"?

Also, moving cc-for-taget to the build system module would require changing
existing package definitions:
  ,(string-append "CC=" (cc-for-target)) --> (string-append "CC=" (cc-for-target))
  (string-append "CC=" ,(cc-for-target)) --> (string-append "CC=" (cc-for-targt))

Warning: I haven't tested whether this approach works with --with-c-toolchain.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-12 10:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08  0:33 bug#47648: cc-for-target makes --with-c-toolchain unusable for some packages raingloom
2021-04-12  9:47 ` Maxime Devos

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).