[phosphor-ipmi-host] static assertion be raised in aarch64 build

CHLI30 at nuvoton.com CHLI30 at nuvoton.com
Fri Jun 17 13:20:04 AEST 2022


Hi All,
Share the root cause about this kind of compile error in ipmid at aarch64 platform.
After debugging with boost/multiprecision owner, we have found the root cause why boost v1.79.0 got this compile error in ipmid.
More detail you can refer from https://github.com/boostorg/multiprecision/issues/472

Summary root cause from boost community:
We changed all bit counts from unsigned to std::size_t,
specifically for platforms like arm64 (and windows!) where unsigned is narrower than size_t
so that the maximum representable number isn't unnecessarily constrained.

This then changes the interface for cpp_int_backend to use size_t rather than unsigned for the bit counts.
On most platforms and most use cases, this makes no perceptible difference,
but unfortunately this appears to be one situation where it really does make a difference. Apparently this is true even though:

template <unsigned N>
using fixed_uint_t =
    boost::multiprecision::number<boost::multiprecision::cpp_int_backend<
        N, N, boost::multiprecision::unsigned_magnitude,
        boost::multiprecision::unchecked, void>>;

Is declared with an unsigned parameter, when partially specializing for fixed_uint_t
you need to use the actual type of the template parameter in the underlying template, not the type used in the template alias! :(

Solution:
In boost v1.78.0 that use unsigned type for all bit counts, and v1.79.0 use std::size_t type instead it.
Thus, ipmid need to change all usage of unsigned for bitcounts to a new typedef bitcount_t which is size_t for Boost-1.79 and later,
and unsigned for Boost-1.78 and earlier.

Verified:
With this patch then ipmid compile error at aarch64 platform was resolved and ipmitool sdr command also pass.

Best regards,
Tim
From: CS20 CHLi30 <CHLI30 at nuvoton.com>
Sent: Wednesday, June 8, 2022 4:41 PM
To: openbmc at lists.ozlabs.org; Tim Lee <timlee660101 at gmail.com>; CS20 CHLi30 <CHLI30 at nuvoton.com>
Subject: RE: [phosphor-ipmi-host] static assertion be raised in aarch64 build

Dear All,

We have fixed this compile error of ipmid after we change boost version from v1.79.0 to v1.78.0.
(Using openbmc/poky/meta/recipes-support/boost/boost_1.78.0.bb instead of boost_1.79.0.bb)

Previous boost v1.78.0 without this compile error in ipmid no matter arm or aarch64 platform.
But, the latest boost v1.79.0 meet this compile error in ipmid only aarch64 platform when we upgrade newer openbmc.
Currently, we try to diff between v1.78.0 and v1.79.0 of boost. If there is any finding, we will update it.

If you have some suggestions or opinions, welcome provide it. Thanks in advance.

Best regards,
Tim
From: CS20 CHLi30 <CHLI30 at nuvoton.com<mailto:CHLI30 at nuvoton.com>>
Sent: Thursday, June 2, 2022 6:11 PM
To: openbmc at lists.ozlabs.org<mailto:openbmc at lists.ozlabs.org>; CS20 CHLi30 <CHLI30 at nuvoton.com<mailto:CHLI30 at nuvoton.com>>; Tim Lee <timlee660101 at gmail.com<mailto:timlee660101 at gmail.com>>
Subject: [phosphor-ipmi-host] static assertion be raised in aarch64 build

Hi All,
Is anyone meet this kind of static_assert() be raised in "pack.hpp" and "unpack.hpp"?

We meet one compile error in "aarch64" platform with the newer commit (5d38067).
However, the same commit without this compile error in "arm" platform.
I try to diff "arm" and "aarch64" compile options,
Unfortunately, didn't find any clues to fix this build error in aarch64 platform.

Error message of log.do_compile:
error: static assertion failed: Attempt to pack a type that has no IPMI unpack operation
error: static assertion failed: Attempt to unpack a type that has no IPMI unpack operation
....
cc1plus: all warnings being treated as errors
Makefile:1344: recipe for target 'libipmi20_la-sensorhandler.lo' failed
make[2]: Leaving directory '/home/tim/npcm-master/openbmc/build/evb-npcm845/tmp/work/cortexa35-openbmc-linux/phosphor-ipmi-host/1.0+gitAUTOINC+5d38067181-r1/build'
Makefile:1599: recipe for target 'all-recursive' failed
make[2]: *** [libipmi20_la-sensorhandler.lo] Error 1
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/tim/npcm-master/openbmc/build/evb-npcm845/tmp/work/cortexa35-openbmc-linux/phosphor-ipmi-host/1.0+gitAUTOINC+5d38067181-r1/build'
ERROR: oe_runmake failed

More messages in log.do_compile:
/home/tim/npcm-master/openbmc/build/evb-npcm845/tmp/work/cortexa35-openbmc-linux/phosphor-ipmi-host/1.0+gitAUTOINC+5d38067181-r1/build/../git/include/ipmid/message/unpack.hpp: In instantiation of 'static int ipmi::message::details::UnpackSingle<A>::op(ipmi::message::Payload&, T&) [with T = boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<24, 24, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>, boost::multiprecision::et_off>]':
/home/tim/npcm-master/openbmc/build/evb-npcm845/tmp/work/cortexa35-openbmc-linux/phosphor-ipmi-host/1.0+gitAUTOINC+5d38067181-r1/build/../git/include/ipmid/message.hpp:440:45:   required from 'int ipmi::message::Payload::unpack(Arg&&, Args&& ...) [with Arg = boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<24, 24, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>, boost::multiprecision::et_off>&; Args = {}]'
../git/ipmid-new.cpp:300:37:   required from here
/home/tim/npcm-master/openbmc/build/evb-npcm845/tmp/work/cortexa35-openbmc-linux/phosphor-ipmi-host/1.0+gitAUTOINC+5d38067181-r1/build/../git/include/ipmid/message/unpack.hpp:123:46: error: static assertion failed: Attempt to unpack a type that has no IPMI unpack operation
  123 |                 utility::dependent_false<T>::value,
      |                                              ^~~~~
/home/tim/npcm-master/openbmc/build/evb-npcm845/tmp/work/cortexa35-openbmc-linux/phosphor-ipmi-host/1.0+gitAUTOINC+5d38067181-r1/build/../git/include/ipmid/message/unpack.hpp:123:46: note: 'std::integral_constant<bool, false>::value' evaluates to false
/home/tim/npcm-master/openbmc/build/evb-npcm845/tmp/work/cortexa35-openbmc-linux/phosphor-ipmi-host/1.0+gitAUTOINC+5d38067181-r1/build/../git/include/ipmid/message/unpack.hpp:126:5: error: no return statement in function returning non-void [-Werror=return-type]
  126 |     }
      |     ^
......
/home/tim/npcm-master/openbmc/build/evb-npcm845/tmp/work/cortexa35-openbmc-linux/phosphor-ipmi-host/1.0+gitAUTOINC+5d38067181-r1/build/../git/include/ipmid/message/pack.hpp: In instantiation of 'static int ipmi::message::details::PackSingle<A>::op(ipmi::message::Payload&, const T&) [with T = boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<24, 24, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>, boost::multiprecision::et_off>]':
/home/tim/npcm-master/openbmc/build/evb-npcm845/tmp/work/cortexa35-openbmc-linux/phosphor-ipmi-host/1.0+gitAUTOINC+5d38067181-r1/build/../git/include/ipmid/message.hpp:262:43:   required from 'int ipmi::message::Payload::pack(Arg&&, Args&& ...) [with Arg = boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<24, 24, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>, boost::multiprecision::et_off>&; Args = {}]'
../git/ipmid-new.cpp:308:16:   required from here
/home/tim/npcm-master/openbmc/build/evb-npcm845/tmp/work/cortexa35-openbmc-linux/phosphor-ipmi-host/1.0+gitAUTOINC+5d38067181-r1/build/../git/include/ipmid/message/pack.hpp:80:28: error: static assertion failed: Attempt to pack a type that has no IPMI pack operation
   80 |         static_assert(std::is_integral_v<T>,
      |                       ~~~~~^~~~~~~~~~~~~~~~

static_assert() in unpack.hpp:
template <typename T>
struct UnpackSingle
{
    static int op(Payload& p, T& t)
    {
            static_assert(
                utility::dependent_false<T>::value,
                "Attempt to unpack a type that has no IPMI unpack operation");

static_assert() in pack.hpp:
template <typename T>
struct PackSingle
{
    static int op(Payload& p, const T& t)
    {
        static_assert(std::is_integral_v<T>,
                      "Attempt to pack a type that has no IPMI pack operation");

Best regards,
Tim
________________________________
The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20220617/9a90c692/attachment-0001.htm>


More information about the openbmc mailing list