bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47648: cc-for-target makes --with-c-toolchain unusable for some pack


From: Maxime Devos
Subject: bug#47648: cc-for-target makes --with-c-toolchain unusable for some packages
Date: Mon, 12 Apr 2021 11:47:31 +0200
User-agent: Evolution 3.34.2

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: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]