guix shell: error: symlink: File exists: "/bin/cc"

  • Open
  • quality assurance status badge
Details
2 participants
  • Marco Fortina
  • Rutherther
Owner
unassigned
Submitted by
Marco Fortina
Severity
normal
M
M
Marco Fortina wrote 5 days ago
(name . bug-guix@gnu.org)(address . bug-guix@gnu.org)
GV1PR10MB5817A7B0E6EC92CE1F22ED64F77B2@GV1PR10MB5817.EURPRD10.PROD.OUTLOOK.COM
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:

Toggle diff (36 lines)
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: file
R
R
Rutherther wrote 4 days ago
(address . 73799@debbugs.gnu.org)(name . Marco Fortina)(address . marco_fortina@hotmail.it)
87cyk233c2.fsf@ditigal.xyz
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
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 73799@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 73799
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