Bug 781859

Summary: Boost + gcc-4.7 is causing build failures
Product: [Fedora] Fedora Reporter: Hans de Goede <hdegoede>
Component: boostAssignee: Petr Machata <pmachata>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: denis.arnaud_fedora, mnewsome, pertusus, pmachata
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-01-16 18:12:57 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 754865    
Attachments:
Description Flags
Compilation fix
none
Boost fix
none
Boost fix none

Description Hans de Goede 2012-01-15 13:34:47 EST
Description of problem:

/usr/include/boost/random/detail/integer_log2.hpp:39:5: error: 'always_inline' was not declared in this scope
/usr/include/boost/random/detail/integer_log2.hpp:39:5: error: expected ')' before 'inline'
/usr/include/boost/random/detail/integer_log2.hpp:39:5: error: expected ')' before 'inline'
/usr/include/boost/random/detail/integer_log2.hpp:39:5: error: expected unqualified-id before ')' token
/usr/include/boost/random/detail/integer_log2.hpp:51:5: error: 'always_inline' was not declared in this scope
/usr/include/boost/random/detail/integer_log2.hpp:51:5: error: expected ')' before 'inline'
/usr/include/boost/random/detail/integer_log2.hpp:51:5: error: expected ')' before 'inline'
/usr/include/boost/random/detail/integer_log2.hpp:51:5: error: expected unqualified-id before ')' token
/usr/include/boost/random/detail/integer_log2.hpp:58:1: error: 'always_inline' was not declared in this scope
/usr/include/boost/random/detail/integer_log2.hpp:58:1: error: expected ')' before 'inline'
/usr/include/boost/random/detail/integer_log2.hpp:58:1: error: expected ')' before 'inline'
/usr/include/boost/random/detail/integer_log2.hpp:58:1: error: expected unqualified-id before ')' token

Also see:
http://koji.fedoraproject.org/koji/getfile?taskID=3697161&name=build.log
Comment 1 Petr Machata 2012-01-16 09:52:46 EST
Created attachment 555525 [details]
Compilation fix

The problem is that OpenLieroX/src/gusanos/blitters/mmx.h defines a macro always_inline.  This gets expanded inside __attribute__((always_inline)) that boost random uses, resulting in expansions like:

    template<class T> __attribute__((const))
    __attribute__((__attribute__((always_inline)) inline))
    inline static int apply(T t, int accum, int update = 0) /* ... */

GCC barfs on that.  I grepped through the sources and it doesn't seem that the value of always_inline macro is not used anywhere in the source, apart from that definition.  (Unless the expansion is cleverly masked somewhere.)  So the easiest fix seems to be to just drop the definition.  That's what's in this patch.  Liero compiles successfully with this patch applied.
Comment 2 Petr Machata 2012-01-16 10:08:48 EST
Created attachment 555527 [details]
Boost fix

In any case, on boost side, I think it would be prudent to name the attribute with the underscores, __attribute__((__always_inline__)), instead of the bare thing.  This way, we would avoid clashes with user-defined attributes.
Comment 3 Petr Machata 2012-01-16 17:03:26 EST
Created attachment 555617 [details]
Boost fix

Updated version with all publicly-visible occurrences of bare attributes replaced.  This is what I intend to add to Fedora package.  I'll open and link bug reports for this.
Comment 4 Petr Machata 2012-01-16 18:12:57 EST
Corresponding upstream bugs are https://svn.boost.org/trac/boost/ticket/6406 to https://svn.boost.org/trac/boost/ticket/6416
Comment 5 Hans de Goede 2012-01-17 03:16:01 EST
Many thanks for working on this, the lierox patch as well as the boost based solution!