Skip to content

[code_assets] Support fat binaries #2424

@dcharkes

Description

@dcharkes

Code hooks are invoked for a single architecture and single OS.
And in Flutter for MacOS and iOS we combine the thin binaries into fat binaries.

However, it might be that the user already has a fat binary.

We should consider adding support for reporting fat binaries. We have hypothesized this before:

  • If we want to ever add support for fat binaries, we'd probably want to add that as a MultiArchCodeAsset with a MultiArchCodeConfig
    • Which would have multiple architectures in the config.
    • The multi_architecture_code_asset should be listed
    • Must the output contain all requested architectures? Or only a subset?
      • If a subset, then it must be listed in the output.
    • It would be a separate hook invocation.
    • Open questions:
      • How would that work together with the normal code assets? Can these be mixed and matched? Would Flutter for example combine a fat binary with two architectures and and a non-fat-binary with a single architecture if they have the same asset id?
  • These MultiArchitectureCodeAssets would likely live in the same package:code_assets such that they can share OS, Architecture and friends.

Originally posted by @dcharkes in #2127

The workaround is to thin the binary from a fat binary in the build hook:

lipo YourFatBinary -extract arm64 -output YourThinBinary_arm64

Related issue:

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