unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Make and "cc" executable
@ 2018-11-08  8:38 Pierre Neidhardt
  2018-11-09 13:23 ` Ricardo Wurmus
  0 siblings, 1 reply; 4+ messages in thread
From: Pierre Neidhardt @ 2018-11-08  8:38 UTC (permalink / raw)
  To: Help Guix

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

Hi Guix!

With gcc-toolchain install, I still have no "cc" executable.
With many other distributions, "cc" is a symlink to either gcc and
clang.

Programs like "make" default to "cc" as the value of CC, the C compiler
environment variable.
Therefore a simple "make" fails on Guix when the Makefile does not
specify some fallback for CC.

What are the recommendations?  Should all Makefiles specify a fallback
for CC?  Or is it up to the user to either export a properly set CC
environment variable from their .profile or similar?

--
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* Re: Make and "cc" executable
  2018-11-08  8:38 Make and "cc" executable Pierre Neidhardt
@ 2018-11-09 13:23 ` Ricardo Wurmus
  2018-11-09 13:36   ` Pierre Neidhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Wurmus @ 2018-11-09 13:23 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Help Guix


Hi Pierre,

> With gcc-toolchain install, I still have no "cc" executable.
> With many other distributions, "cc" is a symlink to either gcc and
> clang.

Right, “cc” is not provided by upstream GCC.  Some distributions provide
“cc” for compatibility with old Unices, but for Guix we generally don’t
augment upstream packages like that.

> What are the recommendations?

When CC is used, then it should be configured to be GCC with “CC=gcc”.

--
Ricardo

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

* Re: Make and "cc" executable
  2018-11-09 13:23 ` Ricardo Wurmus
@ 2018-11-09 13:36   ` Pierre Neidhardt
  2018-11-17 12:28     ` Pierre Neidhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Pierre Neidhardt @ 2018-11-09 13:36 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Help Guix

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

Alright, so what I did is add the following to my ~/.profile.

--8<---------------cut here---------------start------------->8---
if ! command -v cc >/dev/null 2>&1; then
	if command -v clang >/dev/null 2>&1; then
		export CC=clang
	else
		export CC=gcc
	fi
fi
--8<---------------cut here---------------end--------------->8---

Now I can run `make` and it works as expected for projects that don't define CC.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* Re: Make and "cc" executable
  2018-11-09 13:36   ` Pierre Neidhardt
@ 2018-11-17 12:28     ` Pierre Neidhardt
  0 siblings, 0 replies; 4+ messages in thread
From: Pierre Neidhardt @ 2018-11-17 12:28 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Help Guix

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

Actually it doesn't.  It breaks some Makefiles and some languages like Go (with
cgo).

Instead, I've added a "cc" script to my PATH with the following:

--8<---------------cut here---------------start------------->8---
for i in /usr/local/bin/cc /usr/bin/cc /bin/cc clang gcc; do
	command -v $i >/dev/null 2>&1 && exec $i "$@"
done
--8<---------------cut here---------------end--------------->8---

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

end of thread, other threads:[~2018-11-17 12:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-08  8:38 Make and "cc" executable Pierre Neidhardt
2018-11-09 13:23 ` Ricardo Wurmus
2018-11-09 13:36   ` Pierre Neidhardt
2018-11-17 12:28     ` Pierre Neidhardt

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).