Starlink / starlink

Starlink Software Collection
162 stars 53 forks source link

Build of starlink cmake fails on GCC 11 Ubuntu 22.04 #77

Closed jcameron-sso closed 1 year ago

jcameron-sso commented 1 year ago

On Ubuntu 22.04, at 8b280cae8b, a make world fails with errors. Perhaps a later CMake source is required.

In file included from /usr/include/c++/11/map:60,
                 from /tmp/starlink/thirdparty/kitware/vtk/cmake/Source/cmStandardIncludes.h:110,
                 from /tmp/starlink/thirdparty/kitware/vtk/cmake/Source/cmObject.h:15,
                 from /tmp/starlink/thirdparty/kitware/vtk/cmake/Source/CTest/cmCTestGenericHandler.h:17,
                 from /tmp/starlink/thirdparty/kitware/vtk/cmake/Source/CTest/cmCTestBuildHandler.h:17,
                 from /tmp/starlink/thirdparty/kitware/vtk/cmake/Source/CTest/cmCTestBuildHandler.cxx:13:
/usr/include/c++/11/bits/stl_tree.h: In instantiation of ‘static const _Key& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_S_key(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type) [with _Key = cmsys::String; _Val = cmsys::String; _KeyOfValue = std::_Identity<cmsys::String>; _Compare = cmCTestBuildHandler::FragmentCompare; _Alloc = std::allocator<cmsys::String>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type = const std::_Rb_tree_node<cmsys::String>*]’:
/usr/include/c++/11/bits/stl_tree.h:2071:47:   required from ‘std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = cmsys::String; _Val = cmsys::String; _KeyOfValue = std::_Identity<cmsys::String>; _Compare = cmCTestBuildHandler::FragmentCompare; _Alloc = std::allocator<cmsys::String>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::key_type = cmsys::String]’
/usr/include/c++/11/bits/stl_tree.h:2124:4:   required from ‘std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = cmsys::String; _Key = cmsys::String; _Val = cmsys::String; _KeyOfValue = std::_Identity<cmsys::String>; _Compare = cmCTestBuildHandler::FragmentCompare; _Alloc = std::allocator<cmsys::String>]’
/usr/include/c++/11/bits/stl_set.h:521:25:   required from ‘std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::value_type&&) [with _Key = cmsys::String; _Compare = cmCTestBuildHandler::FragmentCompare; _Alloc = std::allocator<cmsys::String>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<cmsys::String, cmsys::String, std::_Identity<cmsys::String>, cmCTestBuildHandler::FragmentCompare, std::allocator<cmsys::String> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<cmsys::String>; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<cmsys::String>, cmsys::String>::rebind<cmsys::String>; typename _Alloc::value_type = cmsys::String; std::set<_Key, _Compare, _Alloc>::value_type = cmsys::String]’
/tmp/starlink/thirdparty/kitware/vtk/cmake/Source/CTest/cmCTestBuildHandler.cxx:617:23:   required from here
/usr/include/c++/11/bits/stl_tree.h:770:15: error: static assertion failed: comparison object must be invocable as const
  770 |               is_invocable_v<const _Compare&, const _Key&, const _Key&>,
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/stl_tree.h:770:15: note: ‘std::is_invocable_v<const cmCTestBuildHandler::FragmentCompare&, const cmsys::String&, const cmsys::String&>’ evaluates to false
make[4]: *** [Source/CMakeFiles/CTestLib.dir/build.make:171: Source/CMakeFiles/CTestLib.dir/CTest/cmCTestBuildHandler.cxx.o] Error 1
make[3]: *** [CMakeFiles/Makefile2:1818: Source/CMakeFiles/CTestLib.dir/all] Error 2
make[2]: *** [Makefile:148: all] Error 2
make[1]: *** [Makefile:679: all] Error 2
make: *** [Makefile.dependencies:3297: /instsoft/extern/starlink/manifests/vtk] Error 1
pwdraper commented 1 year ago

Hi, the answer is yes, there is a discussion of how to get a build working on Ubuntu 22.04 and Fedora 36 in the Starlink Users mailing list at: https://www.jiscmail.ac.uk/cgi-bin/wa-jisc.exe?A0=STARLINK. The thread is "Fedora 36 compilation problem".

I'll extract the instructions here for easier reference.

Changes to the main repository:

diff --git a/thirdparty/kitware/vtk/Makefile.am b/thirdparty/kitware/vtk/Makefile.am
index 7cd0f193fe..1c437004d9 100644
--- a/thirdparty/kitware/vtk/Makefile.am
+++ b/thirdparty/kitware/vtk/Makefile.am
@@ -63,6 +63,7 @@ all:
                -D VTK_USE_INFOVIS:BOOL=OFF \
                -D VTK_USE_MANGLED_MESA:BOOL=OFF \
                -D VTK_USE_VIEWS:BOOL=OFF \
+               -D CMAKE_CXX_STANDARD=11 \
                . && \
          $(MAKE) )
diff --git a/thirdparty/kitware/vtk/configure.ac b/thirdparty/kitware/vtk/configure.ac
index fa94812a4b..19bfa3af76 100644
--- a/thirdparty/kitware/vtk/configure.ac
+++ b/thirdparty/kitware/vtk/configure.ac
@@ -55,7 +55,7 @@ dnl    make in the VTK directory. Remove cmConfigure.h file as that
 dnl    maybe from a full build and include components that are not to be
 dnl    used during a bootstrap (cmELF for instance).
 (
-   cmd="cd cmake && rm -f Source/cmConfigure.h && ./bootstrap";\
+   cmd="cd cmake && rm -f Source/cmConfigure.h && ./bootstrap --no-qt-gui --system-curl";\
    echo $cmd; \
    eval $cmd
 )

Update some sub-projects:

cd thirdparty/eso/skycat/skycat
git checkout master
git pull
cd thirdparty/kitware/vtk/cmake
git checkout master
git pull

Think that will all work. You may need to clean up some things to get these fully working. As I said on the thread in the support lists these fixes cannot currently be added to the main repository as they stop builds on the main supported systems.

jcameron-sso commented 1 year ago

Thanks. I had missed that mailing list, found another one instead.

thirdparty/eso/skycat/skycat did not budge, looks like it was already there.

I also got "cannot compile a C program!" from /daophot which was solved by export CC=gcc. After that, restarting from clone, applying your changes, and removing the target tree, everything built. This was on Ubuntu 22.04 x86_64.

You mentioned supported systems. What is the nature and extent of support, and how much does it cost? I'm making a software bill of materials and that would be handy information to have in there.

pwdraper commented 1 year ago

Good to hear you got things built. It occurred to me that I may as well push a branch with these updates, so I've now done that. It is called fc36-updates.

As for support etc. The only official support is provided from the EAO, who also do the binary releases (which is what I mean when speaking of supported systems, just those that EAO use and build releases on), so they would need to speak about that, if they can. I have nothing to do with that.

jcameron-sso commented 1 year ago

Thanks. I've compared my local deployment branch with fc36-updates, and only have whitespace changes in the vtk/Makefile.am, so it looks fine. I'll close the issue now.