unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Marco Fortina <marco_fortina@hotmail.it>
To: 73799@debbugs.gnu.org
Subject: bug#73799: guix shell: error: symlink: File exists: "/bin/cc"
Date: Sun, 13 Oct 2024 23:11:30 +0000	[thread overview]
Message-ID: <GV1PR10MB5817A7B0E6EC92CE1F22ED64F77B2@GV1PR10MB5817.EURPRD10.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8PR10MB5829AF53C13124EA2834134CF77B2@AS8PR10MB5829.EURPRD10.PROD.OUTLOOK.COM>

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

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

[-- Attachment #2: Type: text/html, Size: 7679 bytes --]

       reply	other threads:[~2024-10-14 17:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AS8PR10MB5829AF53C13124EA2834134CF77B2@AS8PR10MB5829.EURPRD10.PROD.OUTLOOK.COM>
2024-10-13 23:11 ` Marco Fortina [this message]
2024-10-14 19:13   ` bug#73799: guix shell: error: symlink: File exists: "/bin/cc" Rutherther via Bug reports for GNU Guix
2024-11-10 23:26   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=GV1PR10MB5817A7B0E6EC92CE1F22ED64F77B2@GV1PR10MB5817.EURPRD10.PROD.OUTLOOK.COM \
    --to=marco_fortina@hotmail.it \
    --cc=73799@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).