acxz / pkgbuilds

PKGBUILDs for Arch Linux
25 stars 43 forks source link

[ogre-1.9] error: static assertion failed: comparison object must be invocable as const #124

Closed julianoes closed 3 years ago

julianoes commented 3 years ago

I just tried to do a rebuildtree for gazebo and ran into a compile error with ogre-1.9.

/usr/include/c++/11.1.0/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 = OgreBites::Sample*; _Val = OgreBites::Sample*; _KeyOfValue = std::_Identity<OgreBites::Sample*>; _Compare = OgreBites::Sample::Comparer; _Alloc = std::allocator<OgreBites::Sample*>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type = const std::_Rb_tree_node<OgreBites::Sample*>*]’
/usr/include/c++/11.1.0/bits/stl_tree.h:2069: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 = OgreBites::Sample*; _Val = OgreBites::Sample*; _KeyOfValue = std::_Identity<OgreBites::Sample*>; _Compare = OgreBites::Sample::Comparer; _Alloc = std::allocator<OgreBites::Sample*>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::key_type = OgreBites::Sample*]’
/usr/include/c++/11.1.0/bits/stl_tree.h:2122: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 = OgreBites::Sample* const&; _Key = OgreBites::Sample*; _Val = OgreBites::Sample*; _KeyOfValue = std::_Identity<OgreBites::Sample*>; _Compare = OgreBites::Sample::Comparer; _Alloc = std::allocator<OgreBites::Sample*>]’
/usr/include/c++/11.1.0/bits/stl_set.h:512: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(const value_type&) [with _Key = OgreBites::Sample*; _Compare = OgreBites::Sample::Comparer; _Alloc = std::allocator<OgreBites::Sample*>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<OgreBites::Sample*, OgreBites::Sample*, std::_Identity<OgreBites::Sample*>, OgreBites::Sample::Comparer, std::allocator<OgreBites::Sample*> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<OgreBites::Sample*>; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<OgreBites::Sample*>, OgreBites::Sample*>::rebind<OgreBites::Sample*>; typename _Alloc::value_type = OgreBites::Sample*; std::set<_Key, _Compare, _Alloc>::value_type = OgreBites::Sample*]’
/home/julianoes/.cache/yay/ogre-1.9/src/ogre-1.9.1/Samples/Common/include/SamplePlugin.h:81:19:   required from here
/usr/include/c++/11.1.0/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.1.0/bits/stl_tree.h:770:15: note: ‘std::is_invocable_v<const OgreBites::Sample::Comparer&, OgreBites::Sample* const&, OgreBites::Sample* const&>’ evaluates to false
make[2]: *** [Samples/DynTex/CMakeFiles/Sample_DynTex.dir/build.make:76: Samples/DynTex/CMakeFiles/Sample_DynTex.dir/src/DynTex.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1815: Samples/DynTex/CMakeFiles/Sample_DynTex.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
error making: ogre-1.9
m2-farzan commented 3 years ago

https://github.com/OGRECave/ogre/commit/9b1c536b85448ea971822081c7e3c775dbb5cc47 seems to fix this issue. I manually applied it and the error was gone.

julianoes commented 3 years ago

Thanks @m2-farzan. So how does this get in and fixed?

m2-farzan commented 3 years ago
  1. Grab the PKGBULD:

    git clone https://aur.archlinux.org/ogre-1.9.git
    cd ogre-1.9.git
  2. Prepare source files (but not build them):

    makepkg --nobuild
  3. Head to src/ogre-1.9.1/Samples/Common/include/Sample.h and apply this fix: OGRECave/ogre@9b1c536

  4. Build and install:

    makepkg -i --noextract

I also wanted to create a PR but I'm rather new to pkgbuilds. I'm not sure if this should be fixed using git cherry-pick or patch or something else. So I thought I'd let @acxz do it himself. Lol, I forgot I had created a PR.

acxz commented 3 years ago

Closed with #126