unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Fredrik Salomonsson <plattfot@posteo.net>
To: Laurent Gatto <laurent.gatto@gmail.com>, help-guix@gnu.org
Subject: Re: C++ error
Date: Tue, 12 Nov 2024 17:54:14 +0000	[thread overview]
Message-ID: <87a5e42v95.fsf@posteo.net> (raw)
In-Reply-To: <CA+uNOzhydFVFCb1k3=Tay4oE3YRh6J1AEc-7rA5d9hA0=LUE=w@mail.gmail.com>

Hi,

Laurent Gatto <laurent.gatto@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


  reply	other threads:[~2024-11-12 17:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12  7:41 C++ error Laurent Gatto
2024-11-12 17:54 ` Fredrik Salomonsson [this message]
2024-11-12 20:26   ` Laurent Gatto
2024-11-13  0:50     ` Fredrik Salomonsson
2024-11-13  6:49       ` Laurent Gatto
2024-11-13 19:12         ` Fredrik Salomonsson
2024-11-13 21:33           ` Laurent Gatto
2024-11-14 18:51             ` Fredrik Salomonsson
2024-11-16 10:56               ` Laurent Gatto
2024-11-16 13:19                 ` Laurent Gatto
2024-11-18 18:49                   ` Fredrik Salomonsson
2024-11-21  8:50                     ` Laurent Gatto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a5e42v95.fsf@posteo.net \
    --to=plattfot@posteo.net \
    --cc=help-guix@gnu.org \
    --cc=laurent.gatto@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).