gcc-toolchain and gfortran-toolchain conflict

  • Open
  • quality assurance status badge
Details
2 participants
  • Laurent Gatto
  • Simon Tournier
Owner
unassigned
Submitted by
Laurent Gatto
Severity
normal
L
L
Laurent Gatto wrote on 21 Nov 2024 08:57
(address . bug-guix@gnu.org)
CA+uNOzhaZbkznRn581=t7JCW1JYoiXftri1RkyybpR=-5u5OYQ@mail.gmail.com
Here's a simple C++ chunk

```
$ cat main.cpp
#include <iostream>

int main(void) {
std::cout << __cplusplus;

return 0;
}
```

that compiles as expected, with the latest gcc version

```
$ guix shell --container gcc-toolchain
The following derivation will be built:
/gnu/store/bvgndd1r6171zly7ir7fzlpygb1ka7b3-profile.drv

listing Emacs sub-directories...
building profile with 1 package...
[env]$ g++ main.cpp
[env]$ gcc --version
gcc (GCC) 14.2.0
Copyright (C) 2024 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.
```

I'm using the following generation

```
$ guix describe
Generation 70 Nov 20 2024 00:02:35 (current)
[...]
guix 1e6d1c3
branch: master
commit: 1e6d1c32117e9f731e50dcd286927a5fa0d17afc
```

This still works if I add gfortran-toolchain *before* gcc-toolchaine

```
$ guix shell --container gfortran-toolchain gcc-toolchain
The following derivation will be built:
/gnu/store/48ryz9p3sc2qmv9xv2s4s032g1bdkxgr-profile.drv

listing Emacs sub-directories...
building profile with 2 packages...
[env]$ g++ main.cpp
```

But fails I add gfortran-toolchain *after* gcc-toolchaine


```
$ guix shell --container gcc-toolchain gfortran-toolchain
The following derivation will be built:
/gnu/store/4ff7am6zjplhi1p9lin09nbqzk30rijn-profile.drv

listing Emacs sub-directories...
building profile with 2 packages...
$ $ g++ main.cpp
In file included from
/gnu/store/hhzpa2yx8cz92cgm7xjpd2pp6pk74g96-profile/include/c++/bits/move.h:57,
from
/gnu/store/hhzpa2yx8cz92cgm7xjpd2pp6pk74g96-profile/include/c++/bits/exception_ptr.h:43,
from
/gnu/store/hhzpa2yx8cz92cgm7xjpd2pp6pk74g96-profile/include/c++/exception:153,
from
/gnu/store/hhzpa2yx8cz92cgm7xjpd2pp6pk74g96-profile/include/c++/ios:39,
from
/gnu/store/hhzpa2yx8cz92cgm7xjpd2pp6pk74g96-profile/include/c++/ostream:38,
from
/gnu/store/hhzpa2yx8cz92cgm7xjpd2pp6pk74g96-profile/include/c++/iostream:39,
from main.cpp:1:
/gnu/store/hhzpa2yx8cz92cgm7xjpd2pp6pk74g96-profile/include/c++/type_traits:732:26:
error: expected identifier before '(' token
732 | _GLIBCXX20_DEPRECATED("use is_standard_layout &&
is_trivial instead")
| ^
/gnu/store/hhzpa2yx8cz92cgm7xjpd2pp6pk74g96-profile/include/c++/type_traits:732:27:
error: expected unqualified-id before string constant
732 | _GLIBCXX20_DEPRECATED("use is_standard_layout &&
is_trivial instead")
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/gnu/store/hhzpa2yx8cz92cgm7xjpd2pp6pk74g96-profile/include/c++/type_traits:732:27:
error: expected ')' before string constant
732 | _GLIBCXX20_DEPRECATED("use is_standard_layout &&
is_trivial instead")
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| )
/gnu/store/hhzpa2yx8cz92cgm7xjpd2pp6pk74g96-profile/include/c++/type_traits:3154:25:
error: expected unqualified-id before string constant
3154 | _GLIBCXX20_DEPRECATED("use is_standard_layout_v &&
is_trivial_v instead")
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/gnu/store/hhzpa2yx8cz92cgm7xjpd2pp6pk74g96-profile/include/c++/type_traits:3154:25:
error: expected ')' before string constant
3154 | _GLIBCXX20_DEPRECATED("use is_standard_layout_v &&
is_trivial_v instead")
|
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| )
```

The discussion on help-guix that led to this is available here
[1]. Don't hesitate to get back to me for more details.

Laurent

S
S
Simon Tournier wrote on 6 Jan 20:11 +0100
871pxfycz7.fsf@gmail.com
Hi,

On Thu, 21 Nov 2024 at 08:57, Laurent Gatto <laurent.gatto@gmail.com> wrote:

Toggle quote (2 lines)
> 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…

Toggle snippet (4 lines)
$ readlink -f /gnu/store/hhzpa2yx8cz92cgm7xjpd2pp6pk74g96-profile/include/c++/type_traits
/gnu/store/piai5ba5fx901hr7pwnz2b9vysrrjmlh-gfortran-11.4.0/include/c++/type_traits

…and bang!

If both are at 11, then it works as expected:

Toggle snippet (24 lines)
$ 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


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
L
L
Laurent Gatto wrote on 7 Jan 10:22 +0100
(name . Simon Tournier)(address . zimon.toutoune@gmail.com)(address . 74455@debbugs.gnu.org)
CA+uNOzin9KSXVfmCAAGgDR_p+46nFD7LJMPxCwtuzY=4R7y_Ew@mail.gmail.com
Hi Simon,

Thank you for looking into this!

Toggle quote (4 lines)
> 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 <zimon.toutoune@gmail.com> wrote:
Toggle quote (58 lines)
>
> Hi,
>
> On Thu, 21 Nov 2024 at 08:57, Laurent Gatto <laurent.gatto@gmail.com> 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
?
Your comment

Commenting via the web interface is currently disabled.

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

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