cc-for-target makes --with-c-toolchain unusable for some packages

  • Open
  • quality assurance status badge
Details
3 participants
  • Ludovic Courtès
  • Maxime Devos
  • raingloom
Owner
unassigned
Submitted by
raingloom
Severity
important

Debbugs page

R
R
raingloom wrote on 7 Apr 2021 17:33
(name . Guix Bugs)(address . bug-guix@gnu.org)
20210408023329.4e6d48d7@riseup.net
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?
M
M
Maxime Devos wrote on 12 Apr 2021 02:47
0139952bd05c10e068ce564d7982a90b032d9874.camel@telenet.be
On Thu, 2021-04-08 at 02:33 +0200, raingloom wrote:
Toggle quote (4 lines)
> 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.

Toggle quote (4 lines)
> 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.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYHQXMxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7s68AQDlXiFzoni85L2OIBV6pvSinJsn
asEjNqbqtXvBGsLVZQEA5rFY5J7LfSVK+abmzqU+lJ7LBi23hso42y6C/JTLSAM=
=CghC
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 16 Apr 2021 08:44
control message for bug #47648
(address . control@debbugs.gnu.org)
87fszq44kz.fsf@gnu.org
severity 47648 important
quit
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 47648@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 47648
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch