build: Fix cross build for Windows with Boost Process #22348

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:210627-boost changing 2 files +10 −0
  1. hebasto commented at 7:35 am on June 27, 2021: member

    On master (9c3751a0c940228c46461c4191f1a57153cb9037) the cross build for Win64 is broken if configured with --enable-external-signer:

     0...
     1  CXX      crypto/libbitcoin_crypto_base_a-chacha_poly_aead.o
     2In file included from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handles.hpp:11,
     3                 from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/used_handles.hpp:17,
     4                 from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/async_in.hpp:20,
     5                 from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/async.hpp:49,
     6                 from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process.hpp:23,
     7                 from util/system.cpp:9:
     8/home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:208:51: error: expected ‘)’ before ‘*’ token
     9  208 | typedef ::boost::winapi::NTSTATUS_ (__kernel_entry *nt_system_query_information_p )(
    10      |                                    ~              ^~
    11      |                                                   )
    12/home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:223:51: error: expected ‘)’ before ‘*’ token
    13  223 | typedef ::boost::winapi::NTSTATUS_ (__kernel_entry *nt_query_object_p )(
    14      |                                    ~              ^~
    15      |                                                   )
    16/home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp: In function ‘boost::winapi::NTSTATUS_ boost::process::detail::windows::workaround::nt_system_query_information(boost::process::detail::windows::workaround::SYSTEM_INFORMATION_CLASS_, void*, boost::winapi::ULONG_, boost::winapi::PULONG_)’:
    17/home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:239:12: error: ‘nt_system_query_information_p’ does not name a type; did you mean ‘nt_system_query_information’?
    18  239 |     static nt_system_query_information_p f = reinterpret_cast<nt_system_query_information_p>(::boost::winapi::get_proc_address(h, "NtQuerySystemInformation"));
    19      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    20      |            nt_system_query_information
    21In file included from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handles.hpp:11,
    22                 from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/used_handles.hpp:17,
    23                 from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/async_in.hpp:20,
    24                 from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/async.hpp:49,
    25                 from /home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process.hpp:23,
    26                 from util/system.cpp:9:
    27/home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:241:14: error: ‘f’ was not declared in this scope
    28  241 |     return (*f)(SystemInformationClass, SystemInformation, SystemInformationLength, ReturnLength);
    29      |              ^
    30/home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp: In function ‘boost::winapi::BOOL_ boost::process::detail::windows::workaround::nt_query_object(boost::winapi::HANDLE_, boost::process::detail::windows::workaround::OBJECT_INFORMATION_CLASS_, void*, boost::winapi::ULONG_, boost::winapi::PULONG_)’:
    31/home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:253:12: error: ‘nt_query_object_p’ does not name a type; did you mean ‘nt_query_object’?
    32  253 |     static nt_query_object_p f = reinterpret_cast<nt_query_object_p>(::boost::winapi::get_proc_address(h, "NtQueryObject"));
    33      |            ^~~~~~~~~~~~~~~~~
    34      |            nt_query_object
    35/home/hebasto/GitHub/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:255:14: error: ‘f’ was not declared in this scope
    36  255 |     return (*f)(Handle, ObjectInformationClass, ObjectInformation, ObjectInformationLength, ReturnLength);
    37      |              ^
    38make[2]: *** [Makefile:9906: util/libbitcoin_util_a-system.o] Error 1
    39make[2]: *** Waiting for unfinished jobs....
    40  CXX      crypto/libbitcoin_crypto_base_a-chacha20.o
    41make[2]: Leaving directory '/home/hebasto/GitHub/bitcoin/src'
    42make[1]: *** [Makefile:16141: all-recursive] Error 1
    43make[1]: Leaving directory '/home/hebasto/GitHub/bitcoin/src'
    44make: *** [Makefile:820: all-recursive] Error 1
    

    The upstream bug: https://github.com/boostorg/process/issues/96 Also see: https://stackoverflow.com/a/59338759

    #22348 (comment):

    This commit, containing the __kernel_entry SAL annotations was included in Boost Process as part of the 1.71.0 release, which broke support for compiling with mingw-w64 because it doesn’t define the __kernel_entry SAL annotation (but it does define some others, i.e see sal.h).

    A commit was made to remove the annotations, however, it hasn’t made it into either of the two Boost releases that have happened since (1.75.0 & 1.76.0). Meaning that this is currently needed for all versions of Boost process from 1.71.0 onwards.

  2. hebasto added the label Windows on Jun 27, 2021
  3. hebasto added the label Build system on Jun 27, 2021
  4. hebasto force-pushed on Jun 27, 2021
  5. theStack commented at 2:35 pm on June 27, 2021: member
    Concept ACK
  6. MarcoFalke commented at 7:15 am on June 28, 2021: member
    Is this also a fix for gitian/guix?
  7. hebasto commented at 7:17 am on June 28, 2021: member

    Yes.

    On Mon, 28 Jun 2021 at 10:16 MarcoFalke @.***> wrote:

    Is this also a fix for gitian/guix?

    — You are receiving this because you authored the thread.

    Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/pull/22348#issuecomment-869423597, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH3PXPS6HFXVCEOXJQJP7CTTVAOTPANCNFSM47MENVFQ .

    – Hennadii Stepanov

  8. jarolrod commented at 1:51 am on June 29, 2021: member

    ACK 91c70a759a1b0622704f3fabb09c6c72e7fee020

    Tested on Windows 10 and 8 with cross compile from both Arch Linux and Ubuntu. Also used this to cross-compile a GUI pr to test on windows.

    master: run into the same error when building

     0/home/xyz/Code/Bitcoin/test-cross/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:208:51: error: expected ‘)’ before ‘*’ token
     1  208 | typedef ::boost::winapi::NTSTATUS_ (__kernel_entry *nt_system_query_information_p )(
     2      |                                    ~              ^~
     3      |                                                   )
     4/home/xyz/Code/Bitcoin/test-cross/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:223:51: error: expected ‘)’ before ‘*’ token
     5  223 | typedef ::boost::winapi::NTSTATUS_ (__kernel_entry *nt_query_object_p )(
     6      |                                    ~              ^~
     7      |                                                   )
     8/home/xyz/Code/Bitcoin/test-cross/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp: In function ‘boost::winapi::NTSTATUS_ boost::process::detail::windows::workaround::nt_system_query_information(boost::process::detail::windows::workaround::SYSTEM_INFORMATION_CLASS_, void*, boost::winapi::ULONG_, boost::winapi::PULONG_)’:
     9/home/xyz/Code/Bitcoin/test-cross/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:239:12: error: ‘nt_system_query_information_p’ does not name a type
    10  239 |     static nt_system_query_information_p f = reinterpret_cast<nt_system_query_information_p>(::boost::winapi::get_proc_address(h, "NtQuerySystemInformation"));
    11      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    12In file included from /home/xyz/Code/Bitcoin/test-cross/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handles.hpp:11,
    13                 from /home/xyz/Code/Bitcoin/test-cross/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/used_handles.hpp:17,
    14                 from /home/xyz/Code/Bitcoin/test-cross/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/async_in.hpp:20,
    15                 from /home/xyz/Code/Bitcoin/test-cross/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/async.hpp:49,
    16                 from /home/xyz/Code/Bitcoin/test-cross/bitcoin/depends/x86_64-w64-mingw32/include/boost/process.hpp:23,
    17                 from util/system.cpp:9:
    18/home/xyz/Code/Bitcoin/test-cross/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:241:14: error: ‘f’ was not declared in this scope
    19  241 |     return (*f)(SystemInformationClass, SystemInformation, SystemInformationLength, ReturnLength);
    20      |              ^
    21/home/xyz/Code/Bitcoin/test-cross/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp: In function ‘boost::winapi::BOOL_ boost::process::detail::windows::workaround::nt_query_object(boost::winapi::HANDLE_, boost::process::detail::windows::workaround::OBJECT_INFORMATION_CLASS_, void*, boost::winapi::ULONG_, boost::winapi::PULONG_)’:
    22/home/xyz/Code/Bitcoin/test-cross/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:253:12: error: ‘nt_query_object_p’ does not name a type
    23  253 |     static nt_query_object_p f = reinterpret_cast<nt_query_object_p>(::boost::winapi::get_proc_address(h, "NtQueryObject"));
    24      |            ^~~~~~~~~~~~~~~~~
    25/home/xyz/Code/Bitcoin/test-cross/bitcoin/depends/x86_64-w64-mingw32/include/boost/process/detail/windows/handle_workaround.hpp:255:14: error: ‘f’ was not declared in this scope
    26  255 |     return (*f)(Handle, ObjectInformationClass, ObjectInformation, ObjectInformationLength, ReturnLength);
    27      |              ^
    

    pr: Builds and works fine 🥃

  9. fanquake commented at 3:05 am on June 30, 2021: member

    Concept ACK. I think the fix is correct, however this needs a better explanation than just linking to a Boost issue or stack overflow post (which just links back to the same Boost issue). Neither actually explain the problem or solution, other than, copy-pasting these lines “made the compilation error(s) go away”. There’s also no indication of when the fix is needed from, or can be dropped.

    My understanding is that between Boost 1.64.0 and 1.70.0, there are no issues using Boost Process and mingw-w64. Although I haven’t tested this.

    This commit, containing the __kernel_entry SAL annotations was included in Boost Process as part of the 1.71.0 release, which broke support for compiling with mingw-w64 because it doesn’t define the __kernel_entry SAL annotation (but it does define some others, i.e see sal.h).

    A commit was made to remove the annotations, however, it hasn’t made it into either of the two Boost releases that have happened since (1.75.0 & 1.76.0). Meaning that this is currently needed for all versions of Boost process from 1.71.0 onwards.

  10. fanquake added this to the milestone 22.0 on Jul 1, 2021
  11. build: Fix Boost Process compatibility with mingw-w64 compiler
    Boost 1.71 has a broken compatibility with mingw-w64 compiler due to the
    added __kernel_entry SAL annotations.
    67669ab425
  12. hebasto force-pushed on Jul 1, 2021
  13. hebasto commented at 9:19 am on July 1, 2021: member
    @fanquake Detailed info added to the OP, the commit message and code comments re-worded.
  14. fanquake approved
  15. fanquake commented at 12:16 pm on July 1, 2021: member
    ACK 67669ab425b52a2b6be3d2f3b3b7e3939b676a2c - thanks for updating this.
  16. fanquake merged this on Jul 1, 2021
  17. fanquake closed this on Jul 1, 2021

  18. hebasto deleted the branch on Jul 1, 2021
  19. sidhujag referenced this in commit 798d545f52 on Jul 1, 2021
  20. luke-jr referenced this in commit a88af26565 on Dec 14, 2021
  21. gwillen referenced this in commit eb214706d4 on Jun 1, 2022
  22. DrahtBot locked this on Aug 16, 2022

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-10-06 16:12 UTC

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