build: Static build behavior depends on the used compiler #21771

issue hebasto openend this issue on April 24, 2021
  1. hebasto commented at 7:34 am on April 24, 2021: member

    The qt_mac_applicationIsInDarkMode function

     0bool qt_mac_applicationIsInDarkMode()
     1{
     2#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
     3    if (__builtin_available(macOS 10.14, *)) {
     4        auto appearance = [NSApp.effectiveAppearance bestMatchFromAppearancesWithNames:
     5                @[ NSAppearanceNameAqua, NSAppearanceNameDarkAqua ]];
     6        return [appearance isEqualToString:NSAppearanceNameDarkAqua];
     7    }
     8#endif
     9    return false;
    10}
    

    behavior depends on the compiler that was used for static build.

    It returns true or false depending on OS appearance setting on old compilers:

    • apple clang 10.0.1 on macOS Mojave 10.14.6 (18G8022)
    • llvm clang 8.0.0 used in depends

    It always returns false on newer compilers:

    • apple clang 12.0.0 on macOS Catalina 10.15.7 (19H524) and Big Sur 11.2.3 (20D91)
    • llvm clang 10.0.1 in depends, see #19817 (comment)
  2. hebasto added the label Bug on Apr 24, 2021
  3. hebasto added the label macOS on Apr 24, 2021
  4. hebasto commented at 7:35 am on April 24, 2021: member
  5. hebasto commented at 9:46 am on April 24, 2021: member
    Further debugging shows that being compiled with newer compilers the effectiveAppearance returns NSAppearanceNameAqua regardless of the actual appearance setting.
  6. hebasto commented at 10:01 am on April 26, 2021: member

    Additional info.

    Old compilers set the sdk field explicitly:

    • apple clang 10.0.1 on macOS Mojave 10.14.6 (18G8022)
    0$ otool -l src/qt/bitcoin-qt | grep -A 7 -B 1 BUILD_VERSION
    1Load command 9
    2       cmd LC_BUILD_VERSION
    3   cmdsize 32
    4  platform macos
    5       sdk 10.14
    6     minos 10.14
    7    ntools 1
    8      tool ld
    9   version 450.3
    
    • llvm clang 8.0.0 used in depends
    0$ depends/x86_64-apple-darwin18/native/bin/x86_64-apple-darwin18-otool -l src/qt/bitcoin-qt | grep -A 7 -B 1 BUILD_VERSION
    1Load command 9
    2      cmd LC_BUILD_VERSION
    3  cmdsize 32
    4 platform 1
    5    minos 10.14
    6      sdk 505.0
    7   ntools 1
    8     tool 3
    9  version 530.0
    

    Newer compilers do not assign the sdk field value at all:

    • apple clang 12.0.0 on Big Sur 11.2.3 (20D91)
    0% otool -l src/qt/bitcoin-qt | grep -A 7 -B 1 BUILD_VERSION
    1Load command 9
    2      cmd LC_BUILD_VERSION
    3  cmdsize 32
    4 platform 1
    5    minos 10.14
    6      sdk n/a
    7   ntools 1
    8     tool 3
    9  version 609.8
    
    0$ depends/x86_64-apple-darwin18/native/bin/x86_64-apple-darwin18-otool -l src/qt/bitcoin-qt | grep -A 7 -B 1 BUILD_VERSION
    1Load command 9
    2      cmd LC_BUILD_VERSION
    3  cmdsize 32
    4 platform 1
    5    minos 10.14
    6      sdk n/a
    7   ntools 1
    8     tool 3
    9  version 530.0
    

    And Qt doc states:

    … macOS’s system frameworks will sometimes decide whether or not to enable behavior changes based on the SDK you built your application with.

  7. hebasto commented at 6:56 pm on April 26, 2021: member
    Ok, the root of the issue is the https://github.com/llvm/llvm-project/commit/25ce33a6e4f3b13732c0f851e68390dc2acb9123 commit since llvm clang 10.0.0.
  8. fanquake referenced this in commit bb11a988fa on May 1, 2021
  9. fanquake commented at 6:14 am on May 1, 2021: member
    Closing now that #21793 is merged.
  10. fanquake closed this on May 1, 2021

  11. sidhujag referenced this in commit 788d32deca on May 1, 2021
  12. fanquake referenced this in commit 4bce17bf48 on May 5, 2021
  13. fanquake referenced this in commit ae6a06dcac on May 9, 2021
  14. fanquake referenced this in commit 09d8d72173 on May 12, 2021
  15. fanquake referenced this in commit b82b31a633 on May 12, 2021
  16. fanquake referenced this in commit af717c108f on May 12, 2021
  17. fanquake referenced this in commit f015e1c2ca on May 24, 2021
  18. fanquake referenced this in commit 763437b3aa on Jun 10, 2021
  19. fanquake referenced this in commit aa80b5759d on Jun 10, 2021
  20. fanquake referenced this in commit da69d9965a on Jun 18, 2021
  21. sidhujag referenced this in commit 9e71e81dd6 on Jun 18, 2021
  22. rebroad referenced this in commit 8d1f8d4dec on Jun 23, 2021
  23. rebroad referenced this in commit 1bb3b6f77c on Jun 28, 2021
  24. josibake referenced this in commit 9f8018f0b2 on Jul 21, 2021
  25. DrahtBot locked this on Aug 18, 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-12-19 03:12 UTC

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