unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Problem with g++ and iostream
@ 2024-03-01  9:50 Baptiste Demoulin
  2024-03-01 10:10 ` Tomas Volf
  0 siblings, 1 reply; 6+ messages in thread
From: Baptiste Demoulin @ 2024-03-01  9:50 UTC (permalink / raw)
  To: help-guix

Hello,

I encountered a problem today with the =g++= compiler from the 
package =gcc-toolchain=.  When compiling a simple hello world 
program:

#+begin_src c++
  #include <iostream>
  
  int main () {
    std::cout << "Hello World\n";
    return 0;
  }
#+end_src

with:
#+begin_src bash
  g++ hello.cc
#+end_src

I have the following errors, tracing back to the =iostream.h= 
file:
#+begin_example
In file included from 
/home/baptiste/.guix-profile/include/c++/bits/move.h:57,
                 from 
                 /home/baptiste/.guix-profile/include/c++/bits/exception_ptr.h:43,
                 from 
                 /home/baptiste/.guix-profile/include/c++/exception:153,
                 from 
                 /home/baptiste/.guix-profile/include/c++/ios:39,
                 from 
                 /home/baptiste/.guix-profile/include/c++/ostream:38,
                 from 
                 /home/baptiste/.guix-profile/include/c++/iostream:39,
                 from iostream.cc:1:
/home/baptiste/.guix-profile/include/c++/type_traits:732:26: 
error: expected identifier before '(' token
  732 |     _GLIBCXX20_DEPRECATED("use is_standard_layout && 
  is_trivial instead")
      |                          ^
/home/baptiste/.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/baptiste/.guix-profile/include/c++/type_traits:732:27: 
error: expected ')' before string constant
  732 |     _GLIBCXX20_DEPRECATED("use is_standard_layout && 
  is_trivial instead")
      | 
      ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                           )
/home/baptiste/.guix-profile/include/c++/type_traits:1497:12: 
error: expected identifier before '__is_nothrow_convertible'
 1497 |     struct __is_nothrow_convertible
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
/home/baptiste/.guix-profile/include/c++/type_traits:1497:12: 
error: expected unqualified-id before '__is_nothrow_convertible'
/home/baptiste/.guix-profile/include/c++/type_traits:3058:66: 
error: template argument 2 is invalid
 3058 |             __is_nothrow_convertible<typename 
 _Result::type, _Ret>>
      | 
      ^~
/home/baptiste/.guix-profile/include/c++/type_traits:3153:25: 
error: expected unqualified-id before string constant
 3153 |   _GLIBCXX20_DEPRECATED("use is_standard_layout_v && 
 is_trivial_v instead")
      | 
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/baptiste/.guix-profile/include/c++/type_traits:3153:25: 
error: expected ')' before string constant
 3153 |   _GLIBCXX20_DEPRECATED("use is_standard_layout_v && 
 is_trivial_v instead")
      | 
      ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                         )
#+end_example

Is it a bug, or am I doing something wrong here ?

Thanks a lot for your help !

bests,

baptiste



-- 
Baptiste Demoulin <baptiste.demoulin@univ-amu.fr>
Research Engineer (Ingénieur de Recherche, CNRS)
Centre Interdisciplinaire de Nanoscience de Marseille (CINaM)
Département Théorie et Simulation Numérique
Campus de Luminy – Case 913
13288 MARSEILLE Cedex 09


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problem with g++ and iostream
  2024-03-01  9:50 Problem with g++ and iostream Baptiste Demoulin
@ 2024-03-01 10:10 ` Tomas Volf
  2024-03-01 10:18   ` Baptiste Demoulin
  0 siblings, 1 reply; 6+ messages in thread
From: Tomas Volf @ 2024-03-01 10:10 UTC (permalink / raw)
  To: Baptiste Demoulin; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

On 2024-03-01 10:50:38 +0100, Baptiste Demoulin wrote:
> Hello,
>
> I encountered a problem today with the =g++= compiler from the package
> =gcc-toolchain=.  When compiling a simple hello world program:
>
> #+begin_src c++
>  #include <iostream>
>  int main () {
>    std::cout << "Hello World\n";
>    return 0;
>  }
> #+end_src
>
> with:
> #+begin_src bash
>  g++ hello.cc
> #+end_src
>
> I have the following errors, tracing back to the =iostream.h= file:
>
> [..]
>
> Is it a bug, or am I doing something wrong here ?

When I try to compile your source code using

    guix shell -C gcc-toolchain -- g++ x.cpp

it does work.  Could you try it as well to check whether it will work at least
in a pure environment?

Have a nice day,
Tomas Volf

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problem with g++ and iostream
  2024-03-01 10:10 ` Tomas Volf
@ 2024-03-01 10:18   ` Baptiste Demoulin
  2024-03-01 12:36     ` Baptiste Demoulin
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Baptiste Demoulin @ 2024-03-01 10:18 UTC (permalink / raw)
  To: Tomas Volf; +Cc: help-guix

Hi,

Tomas Volf <~@wolfsden.cz> writes:
> When I try to compile your source code using
>
>     guix shell -C gcc-toolchain -- g++ x.cpp
>
> it does work.  Could you try it as well to check whether it will 
> work at least
> in a pure environment?
That also works for me. If, however, I also include 
=gfortran-toolchain= in the mix

    guix shell -C gcc-toolchain gfortran-toolchain -- g++ x.cpp

then I come back to the same error as before.

So, is there an incompatibility between both packages ?

Thanks for your answer and your help !


baptiste




-- 
Baptiste Demoulin <baptiste.demoulin@univ-amu.fr>
Research Engineer (Ingénieur de Recherche, CNRS)
Centre Interdisciplinaire de Nanoscience de Marseille (CINaM)
Département Théorie et Simulation Numérique
Campus de Luminy – Case 913
13288 MARSEILLE Cedex 09


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problem with g++ and iostream
  2024-03-01 10:18   ` Baptiste Demoulin
@ 2024-03-01 12:36     ` Baptiste Demoulin
  2024-03-01 12:40     ` Baptiste Demoulin
  2024-03-01 12:43     ` Baptiste Demoulin
  2 siblings, 0 replies; 6+ messages in thread
From: Baptiste Demoulin @ 2024-03-01 12:36 UTC (permalink / raw)
  To: help-guix


> That also works for me. If, however, I also include 
> =gfortran-toolchain= in the mix
>
>    guix shell -C gcc-toolchain gfortran-toolchain -- g++ x.cpp
>
> then I come back to the same error as before.
I found out the problem: =gfortan-toolchain= is at version 
=11.3.0=, while =gcc-toolchain= is at =13.2.0=. Using:

    guix shell -C gcc-toolchain@11.3.0 gfortran-toolchain -- g++ 
    x.cpp

works as expected, without any error.

bests,

baptiste



-- 
Baptiste Demoulin <baptiste.demoulin@univ-amu.fr>
Research Engineer (Ingénieur de Recherche, CNRS)
Centre Interdisciplinaire de Nanoscience de Marseille (CINaM)
Département Théorie et Simulation Numérique
Campus de Luminy – Case 913
13288 MARSEILLE Cedex 09


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problem with g++ and iostream
  2024-03-01 10:18   ` Baptiste Demoulin
  2024-03-01 12:36     ` Baptiste Demoulin
@ 2024-03-01 12:40     ` Baptiste Demoulin
  2024-03-01 12:43     ` Baptiste Demoulin
  2 siblings, 0 replies; 6+ messages in thread
From: Baptiste Demoulin @ 2024-03-01 12:40 UTC (permalink / raw)
  To: help-guix


> That also works for me. If, however, I also include 
> =gfortran-toolchain= in the mix
>
>    guix shell -C gcc-toolchain gfortran-toolchain -- g++ x.cpp
>
> then I come back to the same error as before.
I found out the issue: =gfortran-toolchain= corresponds to GCC 
11.3.0, while =gcc-toolchain= corresponds to version 
13.2.0. Using:

    guix shell -C gcc-toolchain@11.3.0 gfortran-toolchain -- g++ 
    x.cpp

now works without errors.

bests,

baptiste




-- 
Baptiste Demoulin <baptiste.demoulin@univ-amu.fr>
Research Engineer (Ingénieur de Recherche, CNRS)
Centre Interdisciplinaire de Nanoscience de Marseille (CINaM)
Département Théorie et Simulation Numérique
Campus de Luminy – Case 913
13288 MARSEILLE Cedex 09


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problem with g++ and iostream
  2024-03-01 10:18   ` Baptiste Demoulin
  2024-03-01 12:36     ` Baptiste Demoulin
  2024-03-01 12:40     ` Baptiste Demoulin
@ 2024-03-01 12:43     ` Baptiste Demoulin
  2 siblings, 0 replies; 6+ messages in thread
From: Baptiste Demoulin @ 2024-03-01 12:43 UTC (permalink / raw)
  Cc: Tomas Volf, help-guix


> That also works for me. If, however, I also include 
> =gfortran-toolchain= in the mix
>
>    guix shell -C gcc-toolchain gfortran-toolchain -- g++ x.cpp
>
> then I come back to the same error as before.
I found out the issue: =gfortran-toolchain= corresponds to GCC 
11.3.0, while =gcc-toolchain= corresponds to version 
13.2.0. Using:

    guix shell -C gcc-toolchain@11.3.0 gfortran-toolchain -- g++ 
    x.cpp

now works without errors.

bests,

baptiste


-- 
Baptiste Demoulin <baptiste.demoulin@univ-amu.fr>
Research Engineer (Ingénieur de Recherche, CNRS)
Centre Interdisciplinaire de Nanoscience de Marseille (CINaM)
Département Théorie et Simulation Numérique
Campus de Luminy – Case 913
13288 MARSEILLE Cedex 09


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-01 14:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-01  9:50 Problem with g++ and iostream Baptiste Demoulin
2024-03-01 10:10 ` Tomas Volf
2024-03-01 10:18   ` Baptiste Demoulin
2024-03-01 12:36     ` Baptiste Demoulin
2024-03-01 12:40     ` Baptiste Demoulin
2024-03-01 12:43     ` Baptiste Demoulin

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).