fix bitcoin-qt app categorization on apple silicon #418

pull jarolrod wants to merge 1 commits into bitcoin-core:master from jarolrod:applesilicon-categorization changing 1 files +5 −0
  1. jarolrod commented at 3:26 am on September 5, 2021: member

    System Information contains many insights into various aspects of your macOS system; the ‘Applications’ tab contains info on apps. Starting with macOS 11, the ‘kind’ column under the ‘Applications’ tab started displaying the CPU architecture of the application. The options are; apple silicon, intel, universal. Previously, the kind column indicated where the application originated. The change was made to conveniently determine if the app installed was built to run natively on the new M1 CPU or an intel app that will run under rosetta. Of course, there are several other tools to confirm this; the ‘kind’ column provides a user-friendly way.

    We expect that Bitcoin Core compiled, built, and deployed on an intel CPU will be classified as Intel. Similarly, we expect that if this is done on an M1 mac, the resulting app is classified as Apple Silicon. In reality, Bitcoin-qt built and deployed on an M1 mac will be classified as IOS. This behavior is incorrect and should be fixed.

    We fix this by setting the CFBundleSupportedPlatforms in our info.plist to the value of MacOSX. In doing this, we are telling macOS, “We do not support IOS; stop it!”.

    Tested and confirmed that this is a no-op on macOS < 11.

    On #22546 Branch #22546 + PR Branch
    Screen Shot 2021-09-04 at 6 21 49 PM Screen Shot 2021-09-04 at 6 12 14 PM

    To Test: For testing, our base branch will be #22546. Please perform the following steps on the base branch and then the base branch with the commit from this PR cherry-picked onto it:

    • Have an M1 mac
    • Compile and deploy bitcoin
    • Open up the deployed *.dmg, installed the bundled app
    • Eject the bitcoin dmg that should currently be mounted
    • Navigate to System Information -> Applications
      • Click on the top-left Apple icon
      • Click about this mac
      • Click on the ‘Storage’ tab
      • Click on the ‘Manage…’ button
      • On the left, click on ‘Applications’
      • Sort by Name
    • Look for the Bitcoin Core application
      • Base Branch: The kind column should state that this application is of type IOS
      • PR Branch: The kind column should state that this application is of type Apple Silicon

    Note: Intel users on at least macOS 11 can help test by confirming that the application still shows up as kind=Intel

  2. jarolrod added the label Bug on Sep 5, 2021
  3. jarolrod added the label macOS on Sep 5, 2021
  4. hebasto commented at 10:19 am on September 5, 2021: member

    Concept ACK.

    I failed to find CFBundleSupportedPlatforms in Apple’s docs (e.g., here and here).

  5. jarolrod commented at 4:05 pm on September 5, 2021: member

    @hebasto The usage of CFBundleSupportedPlatforms was done through deductive reasoning. I went through the info.plist of other applications installed on my machine. For the most part, those who were correctly categorized as Apple Silicon included this key. I had one app, besides Bitcoin Core, that was incorrectly categorized as IOS; this other app lacked the CFBundleSupportedPlatforms key.

    This key is not documented properly, but a google search and the info.plist of installed applications will show that it is used in production quite ubiquitously. Using a key that is not properly documented can have negative consequences, especially down the line. I’m open to other approaches!

    Here’s a qt bug that mentions this key: QTBUG-75917 The linked comment states “CFBundleSupportedPlatforms appears to be needed for MacOS deployment as well.”

    Here we have a qt bug that mentions that QTCreator leaves out the “important” CFBundleSupportedPlatforms key, while it is automatically filled in by Xcode: QTBUG-74872

  6. jarolrod commented at 10:31 pm on September 12, 2021: member
    cc @fanquake: can I get your opinion on this?
  7. fanquake commented at 5:31 am on September 13, 2021: member

    can I get your opinion on this?

    Using CFBundleSupportedPlatforms to get the macOS app categorized / recognized correctly by the OS seems ok.

  8. hebasto commented at 6:54 am on September 13, 2021: member

    I’ve checked out multiple non-Apple sources, including stackoverflow.com and other projects on GitHub. And I agree that CFBundleSupportedPlatforms is a valid key, and it is required to recognize an app in a right way.

    Why not making this PR independent of https://github.com/bitcoin/bitcoin/pull/22546?

  9. qt: fix bitcoin-qt app categorization on apple silicon
    On master, the deployed bitcoin-qt application is categorized as an IOS application.
    This is obviously incorrect, and the built executable is not an IOS executable.
    To fix this, we set the CFBundleSupportedPlatforms key in our info.plist
    3765c486ef
  10. jarolrod force-pushed on Sep 13, 2021
  11. jarolrod commented at 9:22 am on September 13, 2021: member

    Updated from a03a1a6 -> 3765c48 (pr418.01, pr418.02, diff)

    Changes: drop commits from #22546 to address @hebasto comment.

  12. hebasto approved
  13. hebasto commented at 11:42 am on September 13, 2021: member

    ACK 3765c486ef57001d4e313782bf16a69b6988da33

    Guix build:

    0$ env HOSTS='x86_64-apple-darwin18' ./contrib/guix/guix-build
    1$ find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
    2f59636390f1b6c1e51d1c3f1ec5896bfe5ffa65c97f690675e1a1ced9cb6b59e  guix-build-3765c486ef57/output/dist-archive/bitcoin-3765c486ef57.tar.gz
    32476e872eefe3d2733689fb841630f647356f84ca3231ad8b5042f06ec01c8ef  guix-build-3765c486ef57/output/x86_64-apple-darwin18/SHA256SUMS.part
    4eda7eb51866354e5ca2566596fc55fe9ee7b423b3b2ab7af869908751bccfffa  guix-build-3765c486ef57/output/x86_64-apple-darwin18/bitcoin-3765c486ef57-osx-unsigned.dmg
    563c4e2c58cb94026dd564e8fae17e5d7a6a4ff7ffa2bc4501239f86cdbc3b849  guix-build-3765c486ef57/output/x86_64-apple-darwin18/bitcoin-3765c486ef57-osx-unsigned.tar.gz
    6cfda44bb5e56b2bca46024b545cd28b5cc6053a826f9f667da9c732aaf4d8afb  guix-build-3765c486ef57/output/x86_64-apple-darwin18/bitcoin-3765c486ef57-osx64.tar.gz
    
  14. jarolrod commented at 3:38 pm on September 13, 2021: member

    GUIX hashes, mine match @hebasto

    0$ find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
    1
    2f59636390f1b6c1e51d1c3f1ec5896bfe5ffa65c97f690675e1a1ced9cb6b59e  guix-build-3765c486ef57/output/dist-archive/bitcoin-3765c486ef57.tar.gz
    32476e872eefe3d2733689fb841630f647356f84ca3231ad8b5042f06ec01c8ef  guix-build-3765c486ef57/output/x86_64-apple-darwin18/SHA256SUMS.part
    4eda7eb51866354e5ca2566596fc55fe9ee7b423b3b2ab7af869908751bccfffa  guix-build-3765c486ef57/output/x86_64-apple-darwin18/bitcoin-3765c486ef57-osx-unsigned.dmg
    563c4e2c58cb94026dd564e8fae17e5d7a6a4ff7ffa2bc4501239f86cdbc3b849  guix-build-3765c486ef57/output/x86_64-apple-darwin18/bitcoin-3765c486ef57-osx-unsigned.tar.gz
    6cfda44bb5e56b2bca46024b545cd28b5cc6053a826f9f667da9c732aaf4d8afb  guix-build-3765c486ef57/output/x86_64-apple-darwin18/bitcoin-3765c486ef57-osx64.tar.gz
    
  15. hebasto merged this on Sep 14, 2021
  16. hebasto closed this on Sep 14, 2021

  17. sidhujag referenced this in commit 366cfea7b2 on Sep 15, 2021
  18. bitcoin-core locked this on Sep 14, 2022

github-metadata-mirror

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

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