‘guix shell -CH’ should be able to contain both GCC and Clang

  • Done
  • quality assurance status badge
Details
5 participants
  • John Kehayias
  • Marco Fortina
  • Maxim Cournoyer
  • zamfofex
  • Simon Tournier
Owner
unassigned
Submitted by
zamfofex
Severity
normal
Z
Z
zamfofex wrote on 18 Apr 2023 02:14
‘guix shell -CH’ should be abl e to contain both GCC and Clang
(name . bug-guix@gnu.org)(address . bug-guix@gnu.org)
2085439243.1521663.1681776855547@privateemail.com
When I add ‘gcc-toolchain’, it seems to try to create a ‘/bin/cc’ symlink to GCC, but the Clang package also has a ‘cc’ executable, so it fails.

- - - - - - - - -
% guix shell -CF clang-toolchain gcc-toolchain
guix shell: error: symlink: File exists: "/bin/cc"
- - - - - - - - -
Z
Z
zamfofex wrote on 18 Apr 2023 02:23
[bug report subject correction]
(name . 62917@debbugs.gnu.org)(address . 62917@debbugs.gnu.org)
655414147.1522018.1681777418758@privateemail.com
Apologies for the noise, but the subject of the email I sent is wrong. It should have been ‘guix shell -CF’ rather than ‘guix shell -CH’.
M
M
Marco Fortina wrote on 22 Oct 12:49 +0200
[bug#62917] [bug#73799] [PATCH] Fix 'guix shell: error: symlink: File exists: "/bin/cc"'
AS8PR10MB58291EBFC600E5EDCCB20C39F74C2@AS8PR10MB5829.EURPRD10.PROD.OUTLOOK.COM
This patch closes issue when running "guix shell --container --emulate-fhs clang-toolchain gcc-toolchain" or "guix shell --container --emulate-fhs clang-toolchain gcc-toolchain":


Toggle diff (18 lines)
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index a219b2ac89..37f11395f9 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -464,7 +464,8 @@ (define (setup-fhs profile)
;; /bin since that already has the sh symlink and the other (optional) FHS
;; bin directories will link to /bin.
(let ((gcc-path (string-append profile "/bin/gcc")))
- (if (file-exists? gcc-path)
+ (if (and (file-exists? gcc-path)
+ (not (file-exists? "/bin/cc")))
(symlink gcc-path "/bin/cc")))

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


Cheers,
Marco
Attachment: file
S
S
Simon Tournier wrote on 10 Dec 17:10 +0100
control message for bug #62917
(address . control@debbugs.gnu.org)
87y10ny0wo.fsf@gmail.com
tags 62917 + patch
quit
M
M
Maxim Cournoyer wrote on 15 Dec 05:36 +0100
Re: [bug#62917] [bug#73799] [PATCH] Fix 'guix shell: error: symlink: File exists: "/bin/cc"'
87zfkxy34e.fsf@gmail.com
Hi Marco,

Marco Fortina <marco_fortina@hotmail.it> writes:

Toggle quote (18 lines)
> This patch closes issue when running "guix shell --container --emulate-fhs clang-toolchain gcc-toolchain" or "guix shell --container --emulate-fhs clang-toolchain gcc-toolchain":
>
>
> diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
> index a219b2ac89..37f11395f9 100644
> --- a/guix/scripts/environment.scm
> +++ b/guix/scripts/environment.scm
> @@ -464,7 +464,8 @@ (define (setup-fhs profile)
> ;; /bin since that already has the sh symlink and the other (optional) FHS
> ;; bin directories will link to /bin.
> (let ((gcc-path (string-append profile "/bin/gcc")))
> - (if (file-exists? gcc-path)
> + (if (and (file-exists? gcc-path)
> + (not (file-exists? "/bin/cc")))
> (symlink gcc-path "/bin/cc")))
>
> ;; Guix's ldconfig doesn't search in FHS default locations, so provide a

I see Ludovic pushed a variant of the above fix with
23ab6fc29f28b0fa9ad94bf2ceed135ee3fdea34, and attributed your discovery
of the problem.

Good. Thanks for the report and patch!

--
Thanks,
Maxim
J
J
John Kehayias wrote on 15 Dec 07:04 +0100
(address . 62917-done@debbugs.gnu.org)
874j355vot.fsf@protonmail.com
On Sun, Dec 15, 2024 at 01:36 PM, Maxim Cournoyer wrote:

Toggle quote (28 lines)
> Hi Marco,
>
> Marco Fortina <marco_fortina@hotmail.it> writes:
>
>> This patch closes issue when running "guix shell --container --emulate-fhs clang-toolchain gcc-toolchain" or "guix shell --container --emulate-fhs clang-toolchain gcc-toolchain":
>>
>>
>> diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
>> index a219b2ac89..37f11395f9 100644
>> --- a/guix/scripts/environment.scm
>> +++ b/guix/scripts/environment.scm
>> @@ -464,7 +464,8 @@ (define (setup-fhs profile)
>> ;; /bin since that already has the sh symlink and the other (optional) FHS
>> ;; bin directories will link to /bin.
>> (let ((gcc-path (string-append profile "/bin/gcc")))
>> - (if (file-exists? gcc-path)
>> + (if (and (file-exists? gcc-path)
>> + (not (file-exists? "/bin/cc")))
>> (symlink gcc-path "/bin/cc")))
>>
>> ;; Guix's ldconfig doesn't search in FHS default locations, so provide a
>
> I see Ludovic pushed a variant of the above fix with
> 23ab6fc29f28b0fa9ad94bf2ceed135ee3fdea34, and attributed your discovery
> of the problem.
>
> Good. Thanks for the report and patch!

Thanks for the followup, closing this.

John
Closed
?
Your comment

Commenting via the web interface is currently disabled.

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

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