build: document why we check for std::system #32491

pull fanquake wants to merge 1 commits into bitcoin:master from fanquake:document_std_system changing 1 files +2 −0
  1. fanquake commented at 8:53 am on May 14, 2025: member

    It’s probably debatable if we support targets like iOS, but for now, document why we are checking for this standard library feature.

    Trying to use std::system for a aarch64-darwin-ios target results in:

    0test.cpp:7:10: error: 'system' is unavailable: not available on iOS
    1    7 |     std::system("some_command");
    2      |          ^
    3/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdlib.h:203:6: note: 'system' has been explicitly marked unavailable here
    4  203 | int      system(const char *) __DARWIN_ALIAS_C(system);
    5      |          ^
    61 error generated.
    
  2. build: document why we check for std::system
    It's probably debatable if we support targets like iOS, but for now,
    document why we are checking for this standard library feature.
    
    Trying to use `std::system` for a `aarch64-darwin-ios` target results in
    ```bash
    test.cpp:7:10: error: 'system' is unavailable: not available on iOS
        7 |     std::system("some_command");
          |          ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdlib.h:203:6: note: 'system' has been explicitly marked unavailable here
      203 | int      system(const char *) __DARWIN_ALIAS_C(system);
          |          ^
    1 error generated.
    ```
    8f4ba90b8f
  3. DrahtBot commented at 8:53 am on May 14, 2025: contributor

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

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32491.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK Sjors

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

  4. DrahtBot added the label Build system on May 14, 2025
  5. Sjors commented at 6:57 am on May 15, 2025: member

    ACK 8f4ba90b8ff47c7f90fe65d3ed37f486f9fe3a74

    My understanding is that QML based QT will run fine on iOs, though I haven’t tried myself.

    Back when this was introduced #15457 (comment) it was observered that there’s also more obscure platforms out there that don’t have and/or sandbox std::system. Though nowadays we would probably direct them towards the kernel project.

  6. fanquake commented at 9:33 am on May 15, 2025: member

    it was observered that there’s also more obscure platforms out there that don’t have and/or sandbox std::system. @laanwj you might remember / know of such systems?

  7. laanwj commented at 10:22 am on May 15, 2025: member

    @laanwj you might remember / know of such systems?

    Yes. At the time there was cloudabi, which was a sandboxed version of POSIX that removed all contextual access and ambient authority, so processes only get capability handles passed in to what they need. So there was no shell and hence no std::system. But that project was abandoned years ago.

    i’m not sure any other such platforms exist right now, i’m fine with removing the check. But adding a comment makes sense nevertheless.

    Aside: i would like to eventually convert usage of std::system to subprocess, especially now (after #32343) that it doesn’t leak file descriptors anymore.

  8. hebasto commented at 10:27 am on May 15, 2025: member

    Aside: i would like to eventually convert usage of std::system to subprocess, especially now (after #32343) that it doesn’t leak file descriptors anymore.

    :+1:

  9. fanquake commented at 10:46 am on May 16, 2025: member

    i’m not sure any other such platforms exist right now, i’m fine with removing the check. But adding a comment makes sense nevertheless.

    Yea. Wanting to remove the check is what led me to end up documenting it, given it’s unclear wether we support these builds or not.

  10. fanquake merged this on May 16, 2025
  11. fanquake closed this on May 16, 2025

  12. fanquake deleted the branch on May 16, 2025

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: 2025-05-29 12:13 UTC

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