New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multiprecision: compile error only in aarch64 platform #472
Comments
From what I can see, you're using a Boost.Multiprecision type as uint24_t? The problem is that a multipreciison type is not a native integer type, so once you get into here: https://github.com/openbmc/phosphor-host-ipmid/blob/c710b975dce80ba877b9d98b40455746fb9132ec/include/ipmid/message/unpack.hpp#L122 the static_assert is quite correctly triggered. The docs for that type at the start of the file say:
And as Boost.Multiprecision types are user-defined types, you need to do as the docs say and specialize the template? |
Hi @jzmaddock, Thanks your help to check this issue. I wonder why we use same ipmid commit build on arm and arrach64, boost v1.78.0 without this kind of compile error. However, this compile error exist on arrach64 when using boost v1.79.0 (https://github.com/openbmc/openbmc/tree/master/poky/meta/recipes-support/boost) Sorry, I'm not familiar with boost. This issue symptom only happen on arrach64 platform with boost v1.79.0, but v1.78.0. That's why we need all you experts help us to check whether there is any architecture dependence between these two versions then cause this compile error. About ipmid, I will mail to OpenBMC community help to check this symptom in parallel. Thanks. Best regards, |
Just to be clear, from what I can see of the code, this should generate an error on all platforms and with all Boost verisons. Rationale: executeIpmiOemCommand in ipmid-new.cpp calls unpack with a There are similar issues in the I do notice they changed the build system 10 days ago, I wonder if something that wasn't being built before is now? Sorry I can't be more help, but I just don't see how that code could ever have compiled with any Boost version. |
I think this may be the case, looking at the latest commit diff which changed the build system: openbmc/phosphor-host-ipmid@c710b97#diff-0462e381b2fb3286568215681c8983490a37ac9ae0f0c5ee304df7fa6426d4af the old Makefile.am only lists the problem file under:
and then the variable I suspect if you wind back OpenBMC by a couple of weeks, you may well find that things do then build? |
Hi @jzmaddock, First, I didn't use the latest commit about ipmid to build on arm and aarch64 platform. And this old commit is using automake/autoconf to build, the ipmid_SOURCES will be included in Makefile.in eventually. Makefile.in as below: However, I also use the latest commit of ipmid that using meson build method to compile. meson.build as below: ipmid binaryexecutable( I still meet compile error only in aarch64 platform with boost v1.79.0, but v1.78.0 will build pass. |
Actually, ipmid already specialized lots of template for user-defined types. For example, uint24_t will use this template template struct UnpackSingle<fixed_uint_t> |
Ahhh, good catch, my mistake. None the less the error message instantiation-backtrace clearly shows that the primary template of What are the compiler versions being used on the 2 platforms, could this be a compiler bug? |
Thanks your help to discuss this issue symptom with me. I'm very appreciate. In the same build environment, I just copy all files from boost 1.78.0 to replace boost 1.79.0. Below is the difference between these two versions, I just found that there are two patches in 1.78.0, but 1.79.0. However, I found that those two patches already include in 1.79.0. Thus, boost_1.79.0.bb file didn't need apply these two patches. You can refer it here. https://github.com/openbmc/openbmc/blob/master/poky/meta/recipes-support/boost/boost_1.79.0.bb However, the source code between 1.78.0 and 1.79.0 seems lots of file changes, not just those two patches. I try to compare all file changed, but too many files be changed, I don't have idea which file or which commit change might be caused this compile error in aarch64. I still try to find out any clues, but :( The compile information you can check previous I attach compile_error_log.txt and there are many -DBOOST_XXX compile options, might be those compile options will go to different code flow when platform is aarch64. I know this issue is very tough to clarify, hope I can provide more clues to you. Thanks. make[2]: Entering directory '/home/tim/npcm-master/openbmc/build/evb-npcm845/tmp/work/cortexa35-openbmc-linux/phosphor-ipmi-host/1.0+gitAUTOINC+5d38067181-r1/build' |
Hi jzmaddock, And I also attached compile logs for ipmid I hope those compile information can help to clarify this issue. I also dig these logs. Sincerely, |
Found it! Unfortunately I'm not sure what we can do about it :( We changed all bit counts from
Is declared with an unsigned parameter, when partially specializing for I'll try and work up a PR for ipmid shortly. |
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. Please see boostorg/multiprecision#472.
Please see openbmc/phosphor-host-ipmid#183 for a possible fix. |
Hi @jzmaddock, Great!!! You are right, there are many difference is use std::size_t instead of unsigned type between 1.78 and 1.79 when I compare these two versions especially at boost/multiprecision folder. I will check this possible fix and run ipmitool command to make sure the functionality of ipmid. Best regards, |
Are you able to submit this patch via gerrit? I just can't seem to get things working from here. |
OK. I can help to submit this patch via gerrit. |
Hello John, Is this compile error can be solved in boost next release? Is this possible? However, the commit already submit to OpenBMC/ipmid gerrit as below: Best regards, |
It definitely won't be fixed in the next Boost release (for which a beta is due very soon), but in general, I don't believe we can fix this at our end without reverting the change to use std::size_t for bit counts - something we probably should not do. |
Thanks your reply. I think revert all changes about change unsigned to std::size_t might be have some risks. Seems bit counts will have different behavior when change to size_t, is it possible to use unsigned instead of size_t only for bit counts and keep the other files using size_t? As you mentioned before, unsigned is narrower than size_t, specifically for platforms like arm64. That's why I think keep using unsigned type only for bit counts. Thanks. |
Hi John, Tom Joseph said that. Best regards, |
Correct: the correct type for the template is unsigned prior to boost-1.79 and size_t from 1.79 and later. Of course many/most platforms have size_t=unsigned which is why this didn't show up before. So yes, the version check is necessary. |
Thanks your explanation for this question. I will reply to OpenBMC community. Best regards, |
After debugging with boost/multiprecision owner jzmaddock. We have found the root cause why boost v1.79.0 got this compile error in ipmid. More detail you can refer from boostorg/multiprecision#472 Root cause: Boost 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: 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: No compile error at aarch64 platform and test ipmitool sdr command is pass. Signed-off-by: jzmaddock <john@johnmaddock.co.uk> Signed-off-by: Tim Lee <timlee660101@gmail.com> Change-Id: Id7a7c86ef854f4b9c06fc4da054c8021f76812b8
Hi John, Best regards, |
Hi All,
We meet one compile error in "aarch64" platform with OpenBMC software system.
However, previous boost v1.78.0 without this compile error in OpenBMC/ipmid no matter arm or aarch64.
But, the latest boost v1.79.0 meet this compile error in OpenBMC/ipmid only exist aarch64 platform.
I try to diff v1.78.0 and v1.79.0 to find out the root cause, but there are many changes.
Thus, we need your help to review this issue symptom why only error in aarch64 platform?
BTW, OpenBMC/ipmid use the same commit to build on arm and aarch64 platform.
Compile error log as below: (Attachment for complete log information)
error: static assertion failed: Attempt to pack a type that has no IPMI pack operation
/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,
| ~~~~~^~~~~~~~~~~~~~~~
/cortexa35-openbmc-linux/phosphor-ipmi-host/1.0+gitAUTOINC+5d38067181-r1/build/../git/include/ipmid/message/pack.hpp:80:28: note: 'std::is_integral_v<boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<24, 24, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>, boost::multiprecision::et_off> >' evaluates to false
OpenBMC/ipmid github:
https://github.com/openbmc/phosphor-host-ipmid/blob/master/include/ipmid/message/pack.hpp
static_assert() in pack.hpp:
template
struct PackSingle
{
static int op(Payload& p, const T& t)
{
static_assert(std::is_integral_v,
"Attempt to pack a type that has no IPMI pack operation");
Best regards,
Tim
compile_error_log.txt
The text was updated successfully, but these errors were encountered: