[ffigen] Fail fast when generating Objective-C bindings on non-macOS hosts

Open Beginner friendly
#3,856 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
dart
Domain
tooling

Research direction

Read pkgs/ffigen/lib/src/header_parser/parser.dart at the two cited locations and pkgs/ffigen/lib/src/config_provider/utils.dart to trace the xcrun --show-sdk-path call. First reproduce the uncaught ProcessException on a non-macOS host with ObjectiveC(...) configured. Done means Objective-C generation reports a clear macOS requirement instead of crashing.

Written by the indexing model from the issue text.

Description

needs-triage package:ffigen

parser.dart (and lines 181-184) unconditionally runs xcrun --show-sdk-path via firstLineOfStdout (utils.dart) with no Platform.isMacOS check whenever ObjectiveC(...) is configured.

On Linux/Windows this crashes with an uncaught ProcessException trying to run xcrun. Instead we should fail fast with a clear error explaining that Objective-C generation requires macOS.

It's theoretically possible to support ObjC on Linux (maybe windows?) with a custom SDK and sysroot, but that would be a much bigger job, and I don't know of any users who need that.

Context: https://github.com/dart-lang/native/issues/3837

Note: This bug is AI generated. I've reviewed it and it makes sense, but I haven't attempted to repro. Make sure the bug repros before trying to fix it.

Dominant language
Dart
Stars
280
Forks
166
Avg merge
3d 1h
Merged PRs (30d)
35

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dart-lang/native

All issues in dart-lang/native

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.