Skip to content

macos: miscompile/link with nix ld64 #36281

Open

Description

@fanquake

Reported by multiple devs here: #36246 (comment)

Activity

  1. maflcko commented on Sep 17, 2026

    @maflcko
    Member

    It would be good to bisect/fix/report this upstream.

    An alternative would be to partially/temporarily revert fa74f58, but without knowing the exact macOS bug, it is hard to decide which parts to revert for how long ...?

  2. janb84 commented on Sep 17, 2026

    @janb84
    Contributor

    It would be good to bisect/fix/report this upstream.

    An alternative would be to partially/temporarily revert fa74f58, but without knowing the exact macOS bug, it is hard to decide which parts to revert for how long ...?

    Only the wallet.h part (if we choose to do so) the inline-ing of the 2 lines that depend on each other that's the "issue"

  3. maflcko commented on Sep 17, 2026

    @maflcko
    Member

    P2WSH_OP_TRUE in the tests also depends on the prior global, which seems to be the same pattern, no?

  4. janb84 commented on Sep 17, 2026

    @janb84
    Contributor

    P2WSH_OP_TRUE in the tests also depends on the prior global, which seems to be the same pattern, no?

    yes you are correct, missed that because in #36246 it isn't causing an issue, in an other PR it is. The bug is also link-order dependent so it will not show in every PR (depending on the changes)

  5. maflcko commented on Sep 17, 2026

    @maflcko
    Member

    in an other PR it is

    Ah interesting. Do you recall the test error log? I presume the P2WSH_OP_TRUE tests failed?

    The bug is also link-order dependent so it will not show in every PR (depending on the changes)

    ugh. I guess that makes it harder to bisect/fix/report this upstream.

    I guess my new recommendation would be to revert fa74f58 wholesale for now (to err on the safe side for 32.x) and then re-apply it for 33.x later on.

    This should buy enough time to debug this on macOS.

  6. sedited commented on Sep 17, 2026

    @sedited
    Contributor

    I guess my new recommendation would be to revert fa74f58 wholesale for now (to err on the safe side for 32.x) and then re-apply it for 33.x later on.

    @maflcko do you want to open a pull request for that?

  7. maflcko commented on Sep 17, 2026

    @maflcko
    Member

    Sure, done. Only reverted the ones with dependencies. The others should be fine, as we already have stuff like src/protocol.h:274:inline const std::array ALL_NET_MESSAGE_TYPES{std::to_array<std::string>({ for a long time.

  8. added a commit that references this issue on Sep 17, 2026
  9. added a commit that references this issue on Sep 20, 2026
  10. maflcko commented on Sep 23, 2026

    @maflcko
    Member

    Just to clarify: The next steps would be for someone (or a clanker) to bisect/minimize the ld64 bug.

  11. janb84 commented on Sep 23, 2026

    @janb84
    Contributor

    Just to clarify: The next steps would be for someone (or a clanker) to bisect/minimize the ld64 bug.

    Yes will take a shot at it / done some work already, but also busy with testing guide.

    Edit: Update: Me and the agent found a working patch, drafting a bug report for the nix repo now.

  12. fanquake commented on Nov 23, 2026

    @fanquake
    MemberAuthor

    According to upstream NixOS/nixpkgs#567844 (comment):

    If the problem can be worked around using LLD, I’d recommend switching the package to link with LLD. The plan is eventually to switch to LLD on Darwin anyway.

    So it seems like anyone using Nix, should just (early) switch away from using ld64 on Darwin?

  13. janb84 commented on Nov 24, 2026

    @janb84
    Contributor

    According to upstream NixOS/nixpkgs#567844 (comment):

    If the problem can be worked around using LLD, I’d recommend switching the package to link with LLD. The plan is eventually to switch to LLD on Darwin anyway.

    So it seems like anyone using Nix, should just (early) switch away from using ld64 on Darwin?

    Yes that seems to be the "solution" given unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions