Subject: Re: bug#74455: gcc-toolchain and gfortran-toolchain conflict

From: Laurent Gatto <[email-masked]>
Date: Tue, 7 Jan 2025 10:22:17 +0100

Hi Simon,

Thank you for looking into this!

> Well, the naive question: Does it make sense to have in the same profile
> some C/C++ GCC toolchain at one version and some Fortran GCC toolchain
> at another version?

These are the versions I ended up with when installing the latest
toolchains, and thought they would work together. Clearly that's not
the case, and hence my bug isn't a bug.

I have learnt that I need to make sure the toolchain versions match,
that's very useful and addresses the original issue that led to this
report. Wil there be a fortran-toolchain 14 at some point, or are
there technical reasons that hold it back?

Best wishes,

Laurent

On Mon, 6 Jan 2025 at 20:25, Simon Tournier <[email-masked]> wrote:
>
> Hi,
>
> On Thu, 21 Nov 2024 at 08:57, Laurent Gatto <[email-masked]> wrote:
>
> > But fails I add gfortran-toolchain *after* gcc-toolchain
>
> That’s because both are “more or less” some GCC toolchain and provides
> similar subset of files.  Here, the version of the both default
> toolchains does not match (14 vs 11).  Since the profile is built using
> the command line order, then depending on which one comes first, you
> have one version or the other for some of these files.
>
> And as you can see, the compiler is g++ version 14 but using files from
> version 11…
>
> --8<---------------cut here---------------start------------->8---
> $ readlink -f /gnu/store/hhzpa2yx8cz92cgm7xjpd2pp6pk74g96-profile/include/c++/type_traits
> /gnu/store/piai5ba5fx901hr7pwnz2b9vysrrjmlh-gfortran-11.4.0/include/c++/type_traits
> --8<---------------cut here---------------end--------------->8---
>
> …and bang!
>
> If both are at 11, then it works as expected:
>
> --8<---------------cut here---------------start------------->8---
> $ cat main.cpp
> #include <iostream>
>
> int main(void) {
>     std::cout << __cplusplus;
>
>     return 0;
> }
>
> $ guix time-machine -q --commit=1e6d1c3 \
>        -- shell gcc-toolchain@11 gfortran-toolchain \
>        -- g++ --version
> g++ (GCC) 11.4.0
> Copyright (C) 2021 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
> $ guix time-machine -q --commit=1e6d1c3 \
>        -- shell gcc-toolchain@11 gfortran-toolchain \
>        -- g++ main.cpp && ./a.out
> 201703
> --8<---------------cut here---------------end--------------->8---
>
>
> Well, the naive question: Does it make sense to have in the same profile
> some C/C++ GCC toolchain at one version and some Fortran GCC toolchain
> at another version?
>
> Depending on the answer, I guess the fix is not the same. :-)
>
> Cheers,
> simon