Bug 1419452 - boost multi_index/hashed_index.hpp broken on ppc64le
Summary: boost multi_index/hashed_index.hpp broken on ppc64le
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: wesnoth
Version: 26
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Gwyn Ciesla
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-06 08:12 UTC by Pete Walter
Modified: 2018-05-29 11:45 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-29 11:45:14 UTC
Type: Bug


Attachments (Terms of Use)

Description Pete Walter 2017-02-06 08:12:21 UTC
After boost 1.63.0 update, a number of packages are failing on ppc64le with compile errors in <multi_index/hashed_index.hpp>, e.g. wesnoth:

https://koji.fedoraproject.org/koji/taskinfo?taskID=17614212

It builds fine on other arches in koji, just failing on ppc64le.


/usr/include/boost/multi_index/hashed_index.hpp:910:27: error: could not convert '(#'vec_cond_expr' not supported by dump_expr#<expression error> & #'vec_cond_expr' not supported by dump_expr#<expression error>)' from '__vector(4) int' to 'bool'
       if(link_point(v,pos)&&super::replace_(v,x,variant)){
          ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/boost/multi_index/hashed_index.hpp:912:16: error: cannot convert 'bool' to '__vector(4) __bool int' in return
         return true;
                ^~~~
/usr/include/boost/multi_index/hashed_index.hpp:915:14: error: cannot convert 'bool' to '__vector(4) __bool int' in return
       return false;
              ^~~~~

Comment 1 Jonathan Wakely 2017-02-06 09:44:07 UTC
There is nothing ppc64-specific about the code, it's perfectly normal C++:

  template<typename Variant>
  bool replace_(value_param_type v,node_type* x,Variant variant)
  {
    if(eq_(key(v),key(x->value()))){
      return super::replace_(v,x,variant);
    }
      
    unlink_undo undo;
    unlink(x,undo);

    BOOST_TRY{
      std::size_t  buc=find_bucket(v);
      link_info    pos(buckets.at(buc));
      if(link_point(v,pos)&&super::replace_(v,x,variant)){
        link(x,pos);
        return true;
      }
      undo();
      return false;
    }
    BOOST_CATCH(...){
      undo();
      BOOST_RETHROW;
    }
    BOOST_CATCH_END
  }



This is a GCC bug, caused by the silly vector extensions for ppc.

Comment 2 Jonathan Wakely 2017-02-07 13:02:40 UTC
The preprocessed output for that is:

  template<typename Variant>
  __attribute__((altivec(bool__))) unsigned replace_(value_param_type v,node_type* x,Variant variant)
  {

So the compiler's right. This is because SDL2 includes <altivec.h>

# 1 "/usr/include/SDL2/close_code.h" 1 3 4
# 68 "/usr/include/SDL2/SDL_clipboard.h" 2 3 4
# 38 "/usr/include/SDL2/SDL.h" 2 3 4
# 1 "/usr/include/SDL2/SDL_cpuinfo.h" 1 3 4
# 48 "/usr/include/SDL2/SDL_cpuinfo.h" 3 4
# 1 "/usr/lib/gcc/ppc64le-redhat-linux/7/include/altivec.h" 1 3 4

And that has:

/* You are allowed to undef these for C++ compatibility.  */
#define vector __vector
#define pixel __pixel
#define bool __bool

So wesnoth needs to #undef bool after including SDL2 headers, or all C++ code is horribly broken.

Comment 3 Fedora End Of Life 2017-02-28 11:11:15 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 4 Gwyn Ciesla 2017-03-22 16:58:17 UTC
ExcludeArching ppc64le for now.

Comment 5 Jonathan Wakely 2017-03-23 12:25:04 UTC
(In reply to Jonathan Wakely from comment #2)
> So wesnoth needs to #undef bool after including SDL2 headers, or all C++
> code is horribly broken.

Why not just make this change?

Comment 6 Jakub Jelinek 2017-03-23 12:28:14 UTC
Or another option not compile with -std=c++* but -std=gnu++*.

Comment 7 Gwyn Ciesla 2017-03-23 14:35:35 UTC
I didn't put much effort into this because the build takes a long time and I lack a ppc64le machine.

gnu++11 didn't work, and the SDL2 includes are large.  I'll file an upstream bug.

Comment 8 Gwyn Ciesla 2017-03-23 14:40:59 UTC
https://gna.org/bugs/?25616

Comment 9 Gwyn Ciesla 2017-03-24 13:54:41 UTC
Upstream response:

Better file this to whatever project that provides that altivec.h .
If it insists on defining bool for C code("bool" isn't a language keyword in C) it can do so in #ifndef __cplusplus block. Making workaround for this in wesnoth is pointless since pretty much any more or less heavy use of C++ will trigger issues like this and they'll be forced to adopt #ifndef __cplusplus solution in altivec.h anyway eventually. In fact I have no idea why you decided to file this bug to wesnoth since the code that was broken by that macro is in boost. You could as well ask boost to carry this workaround serving all projects using boost.multi_index, not just wesnoth.

Which component should this be filed with?

Comment 10 Jonathan Wakely 2017-03-24 14:04:46 UTC
(In reply to Gwyn Ciesla from comment #9)
> why you decided to file this bug to wesnoth since the code that was broken
> by that macro is in boost. You could as well ask boost to carry this
> workaround serving all projects using boost.multi_index, not just wesnoth.

That's just silly, the problematic macro is included by SDL.h and wesnoth includes that header, boost doesn't.

Even if boost did #undef bool it wouldn't work if the boost headers are included before SDL.h, the code that includes SDL.h would still have to do the #undef.

So the right place to #undef it is either SDL.h or wesnoth.

Comment 11 Jonathan Wakely 2017-03-24 14:06:00 UTC
And even if upstream don't want to fix it, it can still be patched in Fedora to make it build.

Comment 12 Fedora End Of Life 2018-05-03 07:58:30 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 13 Fedora End Of Life 2018-05-29 11:45:14 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.