GNU bug report logs - #73799
guix shell: error: symlink: File exists: "/bin/cc"

Previous Next

Package: guix;

Reported by: Marco Fortina <marco_fortina <at> hotmail.it>

Date: Mon, 14 Oct 2024 02:48:02 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 73799 in the body.
You can then email your comments to 73799 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#73799; Package guix. (Mon, 14 Oct 2024 02:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Marco Fortina <marco_fortina <at> hotmail.it>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 14 Oct 2024 02:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Marco Fortina <marco_fortina <at> hotmail.it>
To: "bug-guix <at> gnu.org" <bug-guix <at> gnu.org>
Subject: guix shell: error: symlink: File exists: "/bin/cc"
Date: Sun, 13 Oct 2024 23:11:30 +0000
[Message part 1 (text/plain, inline)]
Hello there.

I have this issue when with guix time-machine shell when using --emulate-fhs option and having gcc-toolset and clang-toolset in my manifest.scm.

I this this could be solved with this patch:

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 9f851a478e..7a276569e9 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -512,8 +512,10 @@ (define-public (make-clang-toolchain clang libomp)
                      ;; Create 'cc' and 'c++' so that one can use it as a
                      ;; drop-in replacement for the default tool chain and
                      ;; have configure scripts find the compiler.
-                     (symlink "clang" (string-append out "/bin/cc"))
-                     (symlink "clang++" (string-append out "/bin/c++"))
+                     (unless (file-exists? "/bin/cc")
+                         (symlink "clang" (string-append out "/bin/cc")))
+                     (unless (file-exists? "/bin/c++")
+                         (symlink "clang++" (string-append out "/bin/c++")))

                      (union-build (assoc-ref %outputs "debug")
                                   (list (assoc-ref %build-inputs
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index a219b2ac89..72e56367a8 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -465,7 +465,8 @@ (define* (link-contents dir #:key (exclude '()))
   ;; bin directories will link to /bin.
   (let ((gcc-path (string-append profile "/bin/gcc")))
     (if (file-exists? gcc-path)
-        (symlink gcc-path "/bin/cc")))
+        (unless (file-exists? "/bin/cc")
+            (symlink gcc-path "/bin/cc"))))

   ;; Guix's ldconfig doesn't search in FHS default locations, so provide a
   ;; minimal ld.so.conf.


This patch will create the symlinks only if destination files is not already present.

Thanks
[Message part 2 (text/html, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#73799; Package guix. (Mon, 14 Oct 2024 19:15:01 GMT) Full text and rfc822 format available.

Message #8 received at 73799 <at> debbugs.gnu.org (full text, mbox):

From: Rutherther <rutherther <at> ditigal.xyz>
To: 73799 <at> debbugs.gnu.org
Cc: Marco Fortina <marco_fortina <at> hotmail.it>
Subject: Re: guix shell: error: symlink: File exists: "/bin/cc"
Date: Mon, 14 Oct 2024 21:13:33 +0200
Hey Marco,

that llvm.scm change is actually irrelevant to the problem. There
will never be cc in the llvm package itself before the condition.
It occurs prior to the profile merging.
There is no fhs in that case
so checking for /bin/cc does not make sense, moreover
it could pose a problem if one built without a sandbox
on a foreign distro. Then the package output could differ
because /bin/gcc or /bin/c++ exist.

As for the change in environment.scm, that is indeed
what causes the issue.
Since there is an if already, maybe it would make sense to
not introduce another condition statement, but to extend
the existing if?

Regards,
Rutherther




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 10 Nov 2024 23:28:01 GMT) Full text and rfc822 format available.

Notification sent to Marco Fortina <marco_fortina <at> hotmail.it>:
bug acknowledged by developer. (Sun, 10 Nov 2024 23:28:02 GMT) Full text and rfc822 format available.

Message #13 received at 73799-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Marco Fortina <marco_fortina <at> hotmail.it>
Cc: 73799-done <at> debbugs.gnu.org
Subject: Re: bug#73799: guix shell: error: symlink: File exists: "/bin/cc"
Date: Mon, 11 Nov 2024 00:26:59 +0100
Marco Fortina <marco_fortina <at> hotmail.it> skribis:

> I have this issue when with guix time-machine shell when using --emulate-fhs option and having gcc-toolset and clang-toolset in my manifest.scm.

This was fixed in 23ab6fc29f28b0fa9ad94bf2ceed135ee3fdea34, based on the
patch you sent.

Closing.

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 09 Dec 2024 12:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 193 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.