test: Work around boost compilation error #30834

pull maflcko wants to merge 2 commits into bitcoin:master from maflcko:2409-test-boost-fix changing 2 files +4 −14
  1. maflcko commented at 1:58 pm on September 6, 2024: member

    There seems to be an issue compiling the chainstatemanager_rebalance_caches test case with some specific versions of Boost in combination with some specific versions of Clang. For example, Boost 1.74 may fail in combination with Clang 18. [1]

    The error stems from a mixed-type closeness comparison. Given that the comparison is using floating point, and isn’t meant to be exact, work around the compile error by ensuring both sides of the comparison are using the same type (double).

    This also allows to drop a previous workaround.

    [1] Error:

     0In file included from /usr/include/boost/mpl/integral_c.hpp:32:
     1/usr/include/boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'udt_builtin_mixture_enum' [-Wenum-constexpr-conversion]
     2   73 |     typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior;
     3      |                               ^
     4/usr/include/boost/mpl/aux_/static_cast.hpp:24:47: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
     5   24 | #   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
     6      |                                               ^
     7In file included from ../../../src/test/validation_chainstatemanager_tests.cpp:8:
     8In file included from ../../../src/node/chainstatemanager_args.h:9:
     9In file included from ../../../src/validation.h:28:
    10In file included from ../../../src/txmempool.h:26:
    11In file included from /usr/include/boost/multi_index/hashed_index.hpp:38:
    12In file included from /usr/include/boost/multi_index/detail/node_handle.hpp:22:
    13In file included from /usr/include/boost/multi_index_container_fwd.hpp:18:
    14In file included from /usr/include/boost/multi_index/indexed_by.hpp:17:
    15In file included from /usr/include/boost/mpl/vector.hpp:36:
    16In file included from /usr/include/boost/mpl/vector/vector20.hpp:18:
    17In file included from /usr/include/boost/mpl/vector/vector10.hpp:18:
    18In file included from /usr/include/boost/mpl/vector/vector0.hpp:24:
    19In file included from /usr/include/boost/mpl/vector/aux_/clear.hpp:18:
    20In file included from /usr/include/boost/mpl/vector/aux_/vector0.hpp:22:
    21In file included from /usr/include/boost/mpl/vector/aux_/iterator.hpp:19:
    22In file included from /usr/include/boost/mpl/plus.hpp:19:
    23In file included from /usr/include/boost/mpl/aux_/arithmetic_op.hpp:17:
    24In file included from /usr/include/boost/mpl/integral_c.hpp:32:
    25/usr/include/boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'int_float_mixture_enum' [-Wenum-constexpr-conversion]
    26/usr/include/boost/mpl/aux_/static_cast.hpp:24:47: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
    27   24 | #   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
    28      |                                               ^
    292 errors generated.
    
  2. Revert "build: work around issue with Boost <= 1.80 and Clang >= 18"
    This reverts commit cd062d6684908d526be7423f8f1057b891254a3c.
    fa3ecdf778
  3. test: Work around boost compilation error fa9d7d5d20
  4. DrahtBot commented at 1:58 pm on September 6, 2024: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK hebasto, fanquake

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  5. DrahtBot renamed this:
    test: Work around boost compilation error
    test: Work around boost compilation error
    on Sep 6, 2024
  6. DrahtBot added the label Tests on Sep 6, 2024
  7. fanquake commented at 2:02 pm on September 6, 2024: member
    It looks like this works using clang 20 (Debian clang version 20.0.0 (++20240903115437+0748f4227cd6-1~exp1~20240903115620.935)) & Boost 1.74.0.
  8. maflcko marked this as ready for review on Sep 6, 2024
  9. maflcko commented at 2:04 pm on September 6, 2024: member
    Thanks for testing. It would be good to also check with Clang 18 (and any other known-to-fail combination).
  10. fanquake commented at 2:04 pm on September 6, 2024: member
    Note also, I somehow discovered only now that there is a separate Boost 1.81.0 package available for Bookworm, and the same package is in the backports for Bullseye. So we can also direct any users to those packages.
  11. fanquake added the label Needs backport (28.x) on Sep 6, 2024
  12. fanquake added this to the milestone 28.0 on Sep 6, 2024
  13. hebasto commented at 2:16 pm on September 6, 2024: member

    It would be good to also check with Clang 18 (and any other known-to-fail combination).

    Tested on Fedora 40 using the downloaded Boost 1.74 and commands as follows:

    0$ cmake -B build -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DBoost_INCLUDE_DIR=/home/hebasto/boost_1_74_0
    1$ cmake --build build -t test_bitcoin
    

    No build errors.

  14. hebasto approved
  15. hebasto commented at 2:17 pm on September 6, 2024: member
    ACK fa9d7d5d205ada8915cbbc29599ab8e7bf1fffe0.
  16. fanquake approved
  17. fanquake commented at 3:14 pm on September 6, 2024: member
    ACK fa9d7d5d205ada8915cbbc29599ab8e7bf1fffe0
  18. fanquake merged this on Sep 6, 2024
  19. fanquake closed this on Sep 6, 2024

  20. maflcko deleted the branch on Sep 6, 2024
  21. achow101 referenced this in commit 598415bcc1 on Sep 6, 2024
  22. achow101 commented at 3:31 pm on September 6, 2024: member
    Backported fa9d7d5d205ada8915cbbc29599ab8e7bf1fffe0 in #30827
  23. fanquake removed the label Needs backport (28.x) on Sep 6, 2024
  24. TheCharlatan commented at 7:57 pm on September 6, 2024: contributor
    Nice, post-merge ACK

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-22 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me