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:
--- 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 +
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Diff:
Diff:
We are trying to NOT require C++17 on stable. What is the build failure?
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>
This is still stopping a 2020-3 build here, was the information suffucient ?
Fernando, did we accidentally make 2020.3 depend on C++17?
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
Well, 2020.3 is supposed to keep compiling wity only C++11, is my understanding? We only use 14/17 on next?
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.
Ahhh ok
Yes definitiely just commit the fix, sorry, I coud have done that myself ages ago.
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.
2020-3 build looks good with Fedora 39. Thank You !