Hi Fredrik, Thank you for taking the time looking into this.
My issue doesn't seem to be related to an old gcc version. ``` $ g++ --version g++ (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. ``` My location is different though ``` $ which g++ /home/lgatto/.guix-profile/bin/g++ ``` Checking the stdc++ lib: ``` $ sed -n '3154p' ~/.guix-profile/include/c++/type_traits _GLIBCXX20_DEPRECATED("use is_standard_layout_v && is_trivial_v instead") ``` And the gcc search paths on my machine: ``` $ echo | g++ -E -Wp,-v - ignoring nonexistent directory "/no-gcc-local-prefix/include" ignoring nonexistent directory "/gnu/store/ikn0imxfc6n0ba12mrf0c4hc1jm7ylc7-gcc-14.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/14.2.0/../../../../../../../x86_64-unknown-linux-gnu/include" ignoring duplicate directory "/home/lgatto/.guix-profile/include" as it is a non-system directory that duplicates a system directory #include "..." search starts here: #include <...> search starts here: /home/lgatto/.guix-profile/include /gnu/store/ikn0imxfc6n0ba12mrf0c4hc1jm7ylc7-gcc-14.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/14.2.0/include /gnu/store/ikn0imxfc6n0ba12mrf0c4hc1jm7ylc7-gcc-14.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/14.2.0/include-fixed /gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/include End of search list. # 0 "<stdin>" # 0 "<built-in>" # 0 "<command-line>" # 1 "/home/lgatto/.guix-profile/include/stdc-predef.h" 1 3 # 0 "<command-line>" 2 # 1 "<stdin>" ```` Except for the version and location, all this looks very similar to what you have, which leaves me quite puzzled. Laurent On Tue, 12 Nov 2024 at 18:54, Fredrik Salomonsson <platt...@posteo.net> wrote: > > Hi, > > Laurent Gatto <laurent.ga...@gmail.com> writes: > > > Dear all, > > > > I have this very simple code chunk > > > > $ cat main.cpp > > #include <iostream> > > > > int main(void) { > > std::cout << __cplusplus; > > > > return 0; > > } > > > > That I can compile in a minimal shell > > > > $ guix shell --container gcc-toolchain > > [env]$ g++ main.cpp && ./a.out > > 201703 > > > > However, on my main system, I get > > > > $ g++ main.cpp > > In file included from /home/lgatto/.guix-profile/include/c++/bits/move.h:57, > > from > > /home/lgatto/.guix-profile/include/c++/bits/exception_ptr.h:43, > > from /home/lgatto/.guix-profile/include/c++/exception:153, > > from /home/lgatto/.guix-profile/include/c++/ios:39, > > from /home/lgatto/.guix-profile/include/c++/ostream:38, > > from /home/lgatto/.guix-profile/include/c++/iostream:39, > > from main.cpp:1: > > /home/lgatto/.guix-profile/include/c++/type_traits:732:26: error: > > expected identifier before ‘(’ token > > 732 | _GLIBCXX20_DEPRECATED("use is_standard_layout && > > is_trivial instead") > > | ^ > > /home/lgatto/.guix-profile/include/c++/type_traits:732:27: error: > > expected unqualified-id before string constant > > 732 | _GLIBCXX20_DEPRECATED("use is_standard_layout && > > is_trivial instead") > > | > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > /home/lgatto/.guix-profile/include/c++/type_traits:732:27: error: > > expected ‘)’ before string constant > > 732 | _GLIBCXX20_DEPRECATED("use is_standard_layout && > > is_trivial instead") > > | > > ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > | ) > > /home/lgatto/.guix-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") > > | > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > /home/lgatto/.guix-profile/include/c++/type_traits:3154:25: error: > > expected ‘)’ before string constant > > 3154 | _GLIBCXX20_DEPRECATED("use is_standard_layout_v && > > is_trivial_v instead") > > | > > ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > | ) > > > > > > Other issues lead me to suspect that I lost support for C++17 and beyond. > > > > Any idea what/how I messed up and how to fix this? > > What version is gcc on your main system? Could be that you somehow are > running an older gcc than what's in that .guix-profile. > > I could compile that example just fine on mine. > > Here is how g++ looks like on my machine, maybe that will help. Note > that I'm using guix home to install gcc-toolchain. > > The version I'm using: > ``` > $ 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. > ``` > > From where I'm picking up g++ from: > ``` > $ which g++ > /home/plattfot/.guix-home/profile/bin/g++ > ``` > > Checking the stdc++ lib: > ``` > $ sed -n '3154p' ~/.guix-home/profile/include/c++/type_traits > _GLIBCXX20_DEPRECATED("use is_standard_layout_v && is_trivial_v instead") > ``` > Which matches what you have. > > Here is the search paths gcc uses on my machine: > > ``` > $ echo | g++ -E -Wp,-v - > ignoring nonexistent directory "/no-gcc-local-prefix/include" > ignoring nonexistent directory > "/gnu/store/w0i4fd8ivrpwz91a0wjwz5l0b2ralj16-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/../../../../../../../x86_64-unknown-linux-gnu/include" > #include "..." search starts here: > #include <...> search starts here: > /home/plattfot/.guix-home/profile/include > > /gnu/store/w0i4fd8ivrpwz91a0wjwz5l0b2ralj16-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/include > > /gnu/store/w0i4fd8ivrpwz91a0wjwz5l0b2ralj16-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/include-fixed > /gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/include > End of search list. > # 0 "<stdin>" > # 0 "<built-in>" > # 0 "<command-line>" > # 1 "/home/plattfot/.guix-home/profile/include/stdc-predef.h" 1 3 > # 0 "<command-line>" 2 > # 1 "<stdin>" > ``` > -- > s/Fred[re]+i[ck]+/Fredrik/g