Menu

#2847 CMakeLists.txt Need to set c++ 17 Standard for gcc 13.2.1

2020.3
Fixed
None
High
2024-01-23
2023-12-18
No

Seen after an OS upgrade to Fedora 39, 'next' buikds OK but 2020-3 fails to build until c++ 17 standard is set in CMakeLists.txt in both simgear and flightgear. Ref forum post:

Diff for simgear CMakeLists.txt attached

1 Attachments

Discussion

  • Huntley Palmer

    Huntley Palmer - 2023-12-18
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1,4 @@
     Seen after an OS upgrade to Fedora 39,  'next' buikds OK but 2020-3 fails to build until c++ 17 standard is set in CMakeLists.txt in both simgear and flightgear.  Ref forum [post: ](https://forum.flightgear.org/viewtopic.php?f=45&t=41896)
    +
    +Diff for simgear CMakeLists.txt attached 
    +
    
    • Attachments has changed:

    Diff:

    --- old
    +++ new
    @@ -0,0 +1 @@
    +diff-CMakeLists.txt (506 Bytes; text/plain)
    
     
  • James Turner

    James Turner - 2023-12-21

    We are trying to NOT require C++17 on stable. What is the build failure?

     
  • James Turner

    James Turner - 2023-12-21
    • status: New --> NeedInfo
    • assigned_to: James Turner
     
  • Huntley Palmer

    Huntley Palmer - 2023-12-21

    It's detailed in the referenced forum post.

    [ 54%] Built target SimGearCore
    [ 54%] Building CXX object simgear/CMakeFiles/SimGearScene.dir/scene/viewer/Compositor.cxx.o
    In file included from /fgfs/simgear/simgear/scene/viewer/Compositor.cxx:17:
    /fgfs/simgear/simgear/scene/viewer/Compositor.hxx:137:34: error: field '_uniforms' has incomplete type 'simgear::compositor::Compositor::BuiltinUniforms' {aka 'std::array<osg::ref_ptr\<osg::uniform>, 14>'}
    137 | BuiltinUniforms _uniforms;
    | ^~~~~~~~~
    In file included from /usr/include/c++/13/bits/hashtable_policy.h:34,
    from /usr/include/c++/13/bits/hashtable.h:35,
    from /usr/include/c++/13/bits/unordered_map.h:33,
    from /usr/include/c++/13/unordered_map:41,
    from /fgfs/simgear/simgear/scene/viewer/Compositor.hxx:20:
    /usr/include/c++/13/tuple:2005:45: note: declaration of 'simgear::compositor::Compositor::BuiltinUniforms' {aka 'struct std::array<osg::ref_ptr\<osg::uniform>, 14>'}
    2005 | template<typename _tp,="" size_t="" _nm=""> struct array;
    | ^~~~~
    make[2]: *** [simgear/CMakeFiles/SimGearScene.dir/build.make:1840: simgear/CMakeFiles/SimGearScene.dir/scene/viewer/Compositor.cxx.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:887: simgear/CMakeFiles/SimGearScene.dir/all] Error 2
    make: *** [Makefile:156: all] Error 2</typename></osg::ref_ptr\<osg::uniform></osg::ref_ptr\<osg::uniform>

     
  • Huntley Palmer

    Huntley Palmer - 2024-01-17

    This is still stopping a 2020-3 build here, was the information suffucient ?

     
  • James Turner

    James Turner - 2024-01-18
    • assigned_to: James Turner --> Fernando García Liñán
     
  • James Turner

    James Turner - 2024-01-18

    Fernando, did we accidentally make 2020.3 depend on C++17?

     
  • Fernando García Liñán

    I've seen people report this issue before, but I can compile 2020.3 just fine on Fedora 38, using both gcc 13.2.1 and clang.

    Looks like I forgot to add an <array> include. The C++17 standard library might be including it somewhere, while the C++11/14 std library might not. It would explain why I cannot reproduce it and why I forgot to add the include in the first place. :)

    I cannot test whether my theory is correct though. Should I just commit that fix anyway? I guess we should be including <array> even if that's not the issue.

     

    Last edit: Fernando García Liñán 2024-01-23
  • James Turner

    James Turner - 2024-01-23

    Well, 2020.3 is supposed to keep compiling wity only C++11, is my understanding? We only use 14/17 on next?

     
  • Fernando García Liñán

    Yeah, SimGear 2020.3 is setting CMAKE_CXX_STANDARD to 11. The affected file (Compositor.hxx) should be compiling properly on C++11 - I don't think I'm using any C++17 features there.

     
    • James Turner

      James Turner - 2024-01-23

      Ahhh ok

       
  • James Turner

    James Turner - 2024-01-23

    Yes definitiely just commit the fix, sorry, I coud have done that myself ages ago.

     
  • Fernando García Liñán

    It was my bad in the first place for such a sloppy mistake, sorry.

    Looks like it was already fixed on next. I've cherry picked the relevant commit into 2020.3.

     
  • Fernando García Liñán

    • status: NeedInfo --> Fixed
     
  • Huntley Palmer

    Huntley Palmer - 2024-01-23

    2020-3 build looks good with Fedora 39. Thank You !

     

Log in to post a comment.